<eg-grid-column path="circ.checkin_time" label="Checkin Date" i18n-label
datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
- <eg-grid-column path="patron.family_name" label="Family Name" i18n-label>
- </eg-grid-column>
-
<eg-grid-column path="circ.xact_finish" label="Finish" i18n-label
datatype="timestamp" [datePlusTime]="true"></eg-grid-column>
+ <eg-grid-column path="circ_patron.family_name" label="Last Name" i18n-label>
+ </eg-grid-column>
+
+ <eg-grid-column path="circ_patron.first_given_name" label="First Name" i18n-label>
+ </eg-grid-column>
- <eg-grid-column path="copy.location.name" label="Location" i18n-label>
+ <eg-grid-column path="copy.location.name" label="Location" i18n-label [hidden]="true">
</eg-grid-column>
<eg-grid-column name="routeTo" label="Route To" i18n-label>
circ?: IdlObject;
parent_circ?: IdlObject;
hold?: IdlObject;
+
+ // Set to one of circ_patron or hold_patron depending on the context.
patron?: IdlObject;
+
+ // Set to the patron linked to the relevant circulation.
+ circ_patron?: IdlObject;
+
+ // Set to the patron linked to the relevant hold.
+ hold_patron?: IdlObject;
+
transit?: IdlObject;
copyAlerts?: IdlObject[];
mbts?: IdlObject;
+ routeTo?: string; // org name or in-branch destination
+
// Calculated values
title?: string;
author?: string;
export interface CheckinResult extends CircResultCommon {
params: CheckinParams;
- routeTo?: string; // org name or in-branch destination
destOrg?: IdlObject;
destAddress?: IdlObject;
destCourierCode?: string;
});
}
+ fetchPatron(userId: number): Promise<IdlObject> {
+ return this.pcrud.retrieve('au', userId, {
+ flesh: 1,
+ flesh_fields : {'au' : ['card', 'stat_cat_entries']}
+ })
+ .toPromise();
+ }
+
fleshCommonData(result: CircResultCommon): Promise<CircResultCommon> {
+ console.warn('fleshCommonData()');
+
const copy = result.copy;
const volume = result.volume;
const circ = result.circ;
const hold = result.hold;
const nonCatCirc = (result as CheckoutResult).nonCatCirc;
- let promise = Promise.resolve();
+ let promise: Promise<any> = Promise.resolve();
- if (!result.patron) {
- let patronId;
- if (hold) {
- patronId = hold.usr();
- } else if (circ) {
- patronId = circ.usr();
- } else if (nonCatCirc) {
- patronId = nonCatCirc.patron();
- }
+ if (hold) {
+ console.debug('fleshCommonData() hold ', hold.usr());
+ promise = promise.then(_ => {
+ return this.fetchPatron(hold.usr())
+ .then(usr => {
+ result.hold_patron = usr;
+ console.debug('Setting hold patron to ' + usr.id());
+ });
+ });
+ }
+
+ const circPatronId = circ ? circ.usr() :
+ (nonCatCirc ? nonCatCirc.patron() : null);
- if (patronId) {
- promise = promise.then(_ => {
- return this.pcrud.retrieve('au', patronId,
- {flesh: 1, flesh_fields : {'au' : ['card']}})
- .toPromise().then(p => result.patron = p);
+ if (circPatronId) {
+ console.debug('fleshCommonData() circ ', circPatronId);
+ promise = promise.then(_ => {
+ return this.fetchPatron(circPatronId)
+ .then(usr => {
+ result.circ_patron = usr;
+ console.debug('Setting circ patron to ' + usr.id());
});
- }
+ });
}
+ // Set a default patron value which is used in most cases.
+ promise = promise.then(_ => {
+ result.patron = result.hold_patron || result.circ_patron;
+ });
if (result.record) {
result.title = result.record.title();
}
}
+ promise = promise.then(_ => {
+ // By default, all items route-to their location.
+ // Value replaced later on as needed.
+ if (copy && typeof copy.location() === 'object') {
+ result.routeTo = copy.location().name();
+ }
+ });
+
if (volume) {
// Flesh volume prefixes and suffixes
return from(this.applySettings())
.pipe(concatMap(exit => {
- if (exit) {
- return of(exit);
- } else {
- return from(this.collectData());
- }
+ return from(
+ this.collectData().then(exit2 => {
+ // If either applySettings or collectData() tell us
+ // to exit, make it so.
+ return exit || exit2;
+ })
+ );
}))
.pipe(concatMap(exit => {
let promise = Promise.resolve(null);
const hold = this.checkin.hold;
+ console.debug('Route Dialog collecting data');
+
if (this.slip !== 'hold_shelf_slip') {
// Always fetch the most recent transit for the copy,
}
applySettings(): Promise<boolean> {
+ console.debug('Route Dialog applying print settings');
if (this.checkin.transit) {
if (this.checkin.patron && this.checkin.hold &&