LP1904036 improve checkin modifiers; handling noncats
authorBill Erickson <berickxx@gmail.com>
Thu, 29 Apr 2021 15:35:49 +0000 (11:35 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:33 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.component.ts
Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts
Open-ILS/src/eg2/src/app/staff/share/circ/components.component.html

index 357a2b2..3b6d424 100644 (file)
@@ -169,6 +169,12 @@ export class CheckinComponent implements OnInit, AfterViewInit {
             backdate: this.backdate
         };
 
+        Object.keys(this.modifiers).forEach(mod => {
+            if (this.modifiers[mod]) {
+                params[mod] = true;
+            }
+        });
+
         return this.barcodeSelect.getBarcode('asset', this.barcode)
         .then(selection => {
             if (selection) {
@@ -238,16 +244,8 @@ export class CheckinComponent implements OnInit, AfterViewInit {
 
     hasAlerts(): boolean {
         return (
-            Boolean(this.backdate)              ||
-            this.modifiers.noop                 ||
-            this.modifiers.manual_float         ||
-            this.modifiers.void_overdues        ||
-            this.modifiers.clear_expired        ||
-            this.modifiers.retarget_holds       ||
-            this.modifiers.hold_as_transit      ||
-            this.modifiers.no_precat_alert      ||
-            this.modifiers.do_inventory_update  ||
-            this.modifiers.auto_print_holds_transits
+            Boolean(this.backdate) ||
+            Object.keys(this.modifiers).filter(mod => this.modifiers[mod]).length > 0
         );
     }
 
index bb233c3..53192ba 100644 (file)
@@ -173,6 +173,12 @@ export interface CheckinParams {
     capture?: string;
     next_copy_status?: number[];
     new_copy_alerts?: boolean;
+    clear_expired?: boolean;
+    hold_as_transit?: boolean;
+    manual_float?: boolean;
+    no_precat_alert?: boolean;
+    retarget_holds?: boolean;
+    retarget_holds_all?: boolean;
 
     // internal / local values that are moved from the API request.
     _override?: boolean;
@@ -772,11 +778,6 @@ export class CircService {
         const firstEvent = allEvents[0];
         const payload = firstEvent.payload;
 
-        if (!payload) {
-            this.audio.play('error.unknown.no_payload');
-            return Promise.reject();
-        }
-
         const success =
             firstEvent.textcode.match(/SUCCESS|NO_CHANGE|ROUTE_ITEM/) !== null;
 
@@ -786,15 +787,21 @@ export class CircService {
             allEvents: allEvents,
             params: params,
             success: success,
-            circ: payload.circ,
-            parent_circ: payload.parent_circ,
-            copy: payload.copy,
-            volume: payload.volume,
-            record: payload.record,
-            transit: payload.transit,
-            hold: payload.hold
         };
 
+        if (!payload) {
+            // e.g. ASSET_COPY_NOT_FOUND
+            return Promise.resolve(result);
+        }
+
+        result.circ = payload.circ;
+        result.parent_circ = payload.parent_circ;
+        result.copy = payload.copy;
+        result.volume = payload.volume;
+        result.record = payload.record;
+        result.transit = payload.transit;
+        result.hold = payload.hold;
+
         const copy = result.copy;
         const volume = result.volume;
         const transit = result.transit;
@@ -992,15 +999,15 @@ export class CircService {
     }
 
     handleCheckinUncatAlert(result: CheckinResult): Promise<CheckinResult> {
-        const copy = result.copy;
+        const barcode = result.copy ?
+            result.copy.barcode() : result.params.copy_barcode;
 
         if (this.suppressCheckinPopups) {
             return Promise.resolve(result);
         }
 
         return this.strings.interpolate(
-            'staff.circ.checkin.uncat.alert',
-            {barcode: copy.barcode()}
+            'staff.circ.checkin.uncat.alert', {barcode: barcode}
         ).then(str => {
             this.components.uncatAlertDialog.dialogBody = str;
             return this.components.uncatAlertDialog.open().toPromise()
index a937b4b..59f4373 100644 (file)
 <eg-string key="staff.circ.checkin.location.alert" [template]="locAlertTemplate">
 </eg-string>
 
+<eg-alert-dialog #locationAlertDialog i18n-dialogTitle dialogTitle="Route Item">
+</eg-alert-dialog>
+
 <ng-template #uncatAlertTemplate let-barcode="barcode" i18n>
-  Item {{barcode}} was mis-scanned or is not cataloged
+  Item "{{barcode}}" was mis-scanned or is not cataloged
 </ng-template>
 <!-- dialogBody is generated dynamically from string above -->
 <eg-string key="staff.circ.checkin.uncat.alert" [template]="uncatAlertTemplate">
 </eg-string>
 
-<eg-alert-dialog #locationAlertDialog i18n-dialogTitle dialogTitle="Route Item">
+<eg-alert-dialog #uncatAlertDialog i18n-dialogTitle dialogTitle="Route Item">
 </eg-alert-dialog>
 
 <eg-open-circ-dialog #openCircDialog></eg-open-circ-dialog>