From: Bill Erickson Date: Thu, 22 Apr 2021 16:48:04 +0000 (-0400) Subject: LP1904036 clear holds on checkout support X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=add3315cfe28afa8ec95f1dfbbcc7359045a9079;p=evergreen%2Fpines.git LP1904036 clear holds on checkout support Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.component.html b/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.component.html index 480ae7cd80..e994e68cee 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.component.html @@ -8,6 +8,7 @@ text="Item CONC40000598 has never circulated."> +
diff --git a/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.module.ts b/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.module.ts index 2455fa0209..9e4135d975 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/checkin/checkin.module.ts @@ -10,6 +10,7 @@ import {BookingModule} from '@eg/staff/share/booking/booking.module'; import {PatronModule} from '@eg/staff/share/patron/patron.module'; import {BarcodesModule} from '@eg/staff/share/barcodes/barcodes.module'; import {CheckinComponent} from './checkin.component'; +import {WorkLogModule} from '@eg/staff/share/worklog/worklog.module'; @NgModule({ declarations: [ @@ -25,7 +26,8 @@ import {CheckinComponent} from './checkin.component'; HoldingsModule, BookingModule, PatronModule, - BarcodesModule + BarcodesModule, + WorkLogModule ], providers: [ ] 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 3d4d453f95..1a7046100d 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 @@ -618,13 +618,24 @@ export class CircService { const params = result.params; const mode = checkin ? 'checkin' : (params._renewal ? 'renew' : 'checkout'); + const holdShelfEvent = events.filter(e => e.textcode === 'ITEM_ON_HOLDS_SHELF')[0]; + + if (holdShelfEvent) { + this.components.circEventsDialog.clearHolds = this.clearHoldsOnCheckout; + this.components.circEventsDialog.patronId = holdShelfEvent.payload.patron_id; + this.components.circEventsDialog.patronName = holdShelfEvent.payload.patron_name; + } + this.components.circEventsDialog.events = events; this.components.circEventsDialog.mode = mode; return this.components.circEventsDialog.open().toPromise() - .then(confirmed => { + .then(resp => { + const confirmed = resp.override; if (!confirmed) { return null; } + let promise = Promise.resolve(null); + if (!checkin) { // Indicate these events have been seen and overridden. events.forEach(evt => { @@ -632,11 +643,30 @@ export class CircService { this.autoOverrideCheckoutEvents[evt.textcode] = true; } }); - } - params._override = true; + if (holdShelfEvent && resp.clearHold) { + const holdId = holdShelfEvent.payload.hold_id; + + // Cancel the hold that put our checkout item + // on the holds shelf. + + promise = promise.then(_ => { + return this.net.request( + 'open-ils.circ', + 'open-ils.circ.hold.cancel', + this.auth.token(), + holdId, + 5, // staff forced + 'Item checked out by other patron' // FIXME I18n + ).toPromise(); + }); + } + } - return this[mode](params); // checkout/renew/checkin + return promise.then(_ => { + params._override = true; + return this[mode](params); // checkout/renew/checkin + }); }); } diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.html b/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.html index 0b83e0ccf4..0c35a488fb 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.html +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.html @@ -26,13 +26,29 @@
{{evt.payload}}
+ + {{patronName}}. + +
+
+ + +
+
+ +
diff --git a/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.ts b/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.ts index bd1f21eba5..e7fb4d51e3 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/circ/events-dialog.component.ts @@ -18,6 +18,9 @@ export class CircEventsComponent extends DialogComponent implements OnInit { @Input() events: EgEvent[] = []; @Input() mode: 'checkout' | 'renew' | 'checkin'; modeLabel: string; + clearHolds = false; + patronId: number = null; + patronName: string; constructor( private modal: NgbModal,