LP#1942220: implement LI search action Create Invoice
authorGalen Charlton <gmc@equinoxOLI.org>
Wed, 15 Dec 2021 19:51:03 +0000 (14:51 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Wed, 15 Dec 2021 19:51:03 +0000 (14:51 -0500)
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html
Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts

index 9afc20f..09b6669 100644 (file)
     (onClick)="markUnReceived($event)" [disableOnRows]="noSelectedRows">
   </eg-grid-toolbar-action>
   <eg-grid-toolbar-action label="Create Invoice from Selected Line Items" i18n-label
-    (onClick)="createInvoice($event)" [disableOnRows]="noSelectedRows">
+    (onClick)="createInvoiceFromSelected($event)" [disableOnRows]="noSelectedRows">
   </eg-grid-toolbar-action>
   <eg-grid-toolbar-action label="Link Selected Line Items to Invoice" i18n-label
     (onClick)="linkToInvoice($event)" [disableOnRows]="noSelectedRows">
index 0475c9b..a53e132 100644 (file)
@@ -157,6 +157,18 @@ export class LineitemResultsComponent implements OnInit {
         });
     }
 
+    createInvoiceFromSelected(rows: IdlObject[]) {
+        // must be attached to PO
+        const lis = rows.filter(l => l.purchase_order());
+        if (lis.length === 0) {
+            this.noActionableLIs.open();
+            return;
+        }
+        const path = '/eg/staff/acq/legacy/invoice/view?create=1&' +
+                     lis.map(x => 'attach_li=' + x.id()).join('&');
+        window.location.href = path;
+    }
+
     createPurchaseOrder(rows: IdlObject[]) {
         // must not be already attached to a PO
         const lis = rows.filter(l => !l.purchase_order());