From 40faa92554651d1c70f2bd40b23f66573e305ae1 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 18 Mar 2022 16:14:35 -0400 Subject: [PATCH] LP1904036 Update Inventory checkin modifier fix Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../eg2/src/app/staff/share/circ/circ.service.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts b/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts index 9c51f50ab8..443612c5d7 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/circ.service.ts @@ -774,7 +774,7 @@ export class CircService { fleshCommonData(result: CircResultCommon): Promise { - console.warn('fleshCommonData()'); + console.debug('fleshCommonData()'); const copy = result.copy; const volume = result.volume; @@ -934,12 +934,29 @@ export class CircService { result.mbts = parent_circ.billable_transaction().summary(); } - return this.fleshCommonData(result).then(_ => { + return this.fleshCommonData(result) + .then(_ => this.updateInventory(result)) + .then(_ => { this.addWorkLog('checkin', result); return result; }); } + updateInventory(result: CheckinResult): Promise { + + if (result?.firstEvent?.payload?.do_inventory_update) { + const inv = result?.firstEvent?.payload?.latest_inventory; + + if (inv.id()) { + return this.pcrud.update(inv).toPromise(); + } else { + return this.pcrud.create(inv).toPromise(); + } + } + + return Promise.resolve(); + } + processCheckinResult(result: CheckinResult): Promise { const params = result.params; const allEvents = result.allEvents; -- 2.11.0