From: Galen Charlton Date: Wed, 15 Dec 2021 19:56:58 +0000 (-0500) Subject: LP#1942220: implement LI search action Link Invoice X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=109c6097c4c4b7be7f292bde7952d3cef931da3d;p=working%2FEvergreen.git LP#1942220: implement LI search action Link Invoice Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html index 09b666944f..28243a8df1 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.html @@ -6,6 +6,7 @@ + @@ -143,7 +144,7 @@ (onClick)="createInvoiceFromSelected($event)" [disableOnRows]="noSelectedRows"> + (onClick)="linkInvoiceFromSelected($event)" [disableOnRows]="noSelectedRows"> diff --git a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts index a53e132c14..e64e2c3649 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/search/lineitem-results.component.ts @@ -18,6 +18,7 @@ import {AlertDialogComponent} from '@eg/share/dialog/alert.component'; import {ClaimPolicyDialogComponent} from '../lineitem/claim-policy-dialog.component'; import {CancelDialogComponent} from '../lineitem/cancel-dialog.component'; import {DeleteLineitemsDialogComponent} from '../lineitem/delete-lineitems-dialog.component'; +import {LinkInvoiceDialogComponent} from '../lineitem/link-invoice-dialog.component'; @Component({ selector: 'eg-lineitem-results', @@ -34,6 +35,7 @@ export class LineitemResultsComponent implements OnInit { @ViewChild('claimPolicyDialog') claimPolicyDialog: ClaimPolicyDialogComponent; @ViewChild('cancelDialog') cancelDialog: CancelDialogComponent; @ViewChild('deleteLineitemsDialog') deleteLineitemsDialog: DeleteLineitemsDialogComponent; + @ViewChild('linkInvoiceDialog') linkInvoiceDialog: LinkInvoiceDialogComponent; @ViewChild('claimPolicyAppliedString', { static: false }) claimPolicyAppliedString: StringComponent; @ViewChild('lineItemsReceivedString', { static: false }) lineItemsReceivedString: StringComponent; @ViewChild('lineItemsUnReceivedString', { static: false }) lineItemsUnReceivedString: StringComponent; @@ -228,6 +230,24 @@ export class LineitemResultsComponent implements OnInit { }); } + linkInvoiceFromSelected(rows: IdlObject[]) { + // must be attached to PO + const lis = rows.filter(l => l.purchase_order()); + if (lis.length === 0) { + this.noActionableLIs.open(); + return; + } + + this.linkInvoiceDialog.liIds = lis.map(i => Number(i.id())); + this.linkInvoiceDialog.open().subscribe(invId => { + if (!invId) { return; } + + const path = '/eg/staff/acq/legacy/invoice/view/' + invId + '?' + + lis.map(x => 'attach_li=' + x.id()).join('&'); + window.location.href = path; + }); + } + markReceived(rows: IdlObject[]) { // must be on-order const lis = rows.filter(l => l.state() === 'on-order');