LP#1929749: teach multi-LI receive to check LI alerts
authorGalen Charlton <gmc@equinoxOLI.org>
Sat, 5 Feb 2022 22:41:37 +0000 (17:41 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Sat, 5 Feb 2022 22:41:37 +0000 (17:41 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.html
Open-ILS/src/eg2/src/app/staff/acq/lineitem/lineitem-list.component.ts

index 588b839..1e79e11 100644 (file)
@@ -6,6 +6,7 @@
 <eg-acq-link-invoice-dialog #linkInvoiceDialog></eg-acq-link-invoice-dialog>
 <eg-acq-claim-policy-dialog #claimPolicyDialog></eg-acq-claim-policy-dialog>
 <eg-acq-export-attributes-dialog #exportAttributesDialog></eg-acq-export-attributes-dialog>
+<eg-lineitem-alert-dialog #confirmAlertsDialog></eg-lineitem-alert-dialog>
 
 <eg-string #lineItemsUpdatedString i18n-text text="Line Item(s) Updated"></eg-string>
 
index 72bd173..7b5e170 100644 (file)
@@ -22,6 +22,7 @@ import {AddCopiesDialogComponent} from './add-copies-dialog.component';
 import {LinkInvoiceDialogComponent} from './link-invoice-dialog.component';
 import {ExportAttributesDialogComponent} from './export-attributes-dialog.component';
 import {ClaimPolicyDialogComponent} from './claim-policy-dialog.component';
+import {LineitemAlertDialogComponent} from './lineitem-alert-dialog.component';
 
 const DELETABLE_STATES = [
     'new', 'selector-ready', 'order-ready', 'approved', 'pending-order'
@@ -128,6 +129,7 @@ export class LineitemListComponent implements OnInit {
     @ViewChild('noActionableLIs', { static: true }) private noActionableLIs: AlertDialogComponent;
     @ViewChild('selectorReadyConfirmDialog', { static: true }) selectorReadyConfirmDialog: ConfirmDialogComponent;
     @ViewChild('orderReadyConfirmDialog', { static: true }) orderReadyConfirmDialog: ConfirmDialogComponent;
+    @ViewChild('confirmAlertsDialog') confirmAlertsDialog: LineitemAlertDialogComponent;
 
     constructor(
         private router: Router,
@@ -968,11 +970,20 @@ export class LineitemListComponent implements OnInit {
     markReceived(liIds: number[]) {
         if (liIds.length === 0) { return; }
 
-        this.net.request(
-            'open-ils.acq',
-            'open-ils.acq.lineitem.receive.batch',
-            this.auth.token(), liIds
-        ).toPromise().then(resp => this.postBatchAction(resp, liIds));
+        const lis: IdlObject[] = [];
+        this.liService.getFleshedLineitems(liIds, { fromCache: true }).subscribe(
+            liStruct => lis.push(liStruct.lineitem),
+            err => {},
+            () => {
+                this.liService.checkLiAlerts(lis, this.confirmAlertsDialog).then(ok => {
+                    this.net.request(
+                        'open-ils.acq',
+                        'open-ils.acq.lineitem.receive.batch',
+                        this.auth.token(), liIds
+                    ).toPromise().then(resp => this.postBatchAction(resp, liIds));
+                }, err => {}); // avoid console errors
+            }
+        );
     }
 
     markUnReceived(liIds: number[]) {