LP1904036 copy alerts management (checkout)
authorBill Erickson <berickxx@gmail.com>
Thu, 15 Apr 2021 16:49:52 +0000 (12:49 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:31 +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/share/circ/circ.service.ts

index 111122c..3485152 100644 (file)
@@ -581,6 +581,24 @@ export class CircService {
             return params._renewal ? this.renew(params) : this.checkout(params);
         }
 
+        // New-style alerts are reported via COPY_ALERT_MESSAGE and
+        // includes the alerts in the payload as an array.
+        if (firstEvent.textcode === 'COPY_ALERT_MESSAGE'
+            && Array.isArray(firstEvent.payload)) {
+            this.components.copyAlertManager.alerts = firstEvent.payload;
+
+            this.components.copyAlertManager.mode =
+                params._renewal ? 'renew' : 'checkout';
+
+            return this.components.copyAlertManager.open().toPromise()
+            .then(resp => {
+                if (resp) {
+                    params._override = true;
+                    return this.checkout(params);
+                }
+            });
+        }
+
         return this.showOverrideDialog(result, events);
     }