From 479402aeec518f7b9377c646a7379113604e7e21 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 8 Nov 2019 17:02:48 -0500 Subject: [PATCH] LP1851882 Angular catalog recall/force/part holds Adds entry points for placing Recall, Force, and Part-level holds. For any item-level hold type, the user now has the option to cycle between Item, Recall, and Force hold types. The selected type affects the full batch of holds. For title-level holds, the user now has the option to select a part as the hold target for each hold in the list. Part selection is optional. Signed-off-by: Bill Erickson Signed-off-by: Jennifer Weston Signed-off-by: Chris Sharp --- .../staff/catalog/hold/hold.component.html | 84 ++++++++++++++----- .../app/staff/catalog/hold/hold.component.ts | 64 +++++++++++--- .../app/staff/share/holds/holds.service.ts | 1 + .../lib/OpenILS/Application/Circ/Holds.pm | 5 ++ 4 files changed, 123 insertions(+), 31 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html index dca200dace..6645443174 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.html @@ -167,17 +167,44 @@

-
-
Placing - METARECORD - TITLE - CALL NUMBER - FORCE COPY - COPY - RECALL - ISSUANCE - PARTS - hold on record(s)
+
+
+ Placing + METARECORD + TITLE + CALL NUMBER + FORCE ITEM + ITEM + RECALL + ISSUANCE + PARTS + hold on record(s) + +
+
+
+ + Item-Level Hold Options: + + + + + + + + + + + + + + + + +
@@ -198,8 +225,9 @@
Format
-
Title
-
Author
+
Title
+
Author
+
Part
Call Number
Barcode
Holds Status
@@ -219,12 +247,29 @@
-
+ -
{{ctx.holdMeta.bibSummary.display.author}}
+
{{ctx.holdMeta.bibSummary.display.author}}
+
+ + + + + + {{ctx.holdMeta.part.label()}} + + + N/A + + +
{{ctx.holdMeta.callNum.label()}} @@ -237,17 +282,18 @@
-
Hold Pending
+
Hold Pending
-
Hold Processing...
+
Hold Processing...
-
Hold Succeeded
+
Hold Succeeded
-
+
{{ctx.lastRequest.result.evt.textcode}}
diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts index 687783e37a..133480f4bb 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts @@ -91,6 +91,13 @@ export class HoldComponent implements OnInit { ngOnInit() { + // Respond to changes in hold type. This currently assumes hold + // types only toggle post-init between copy-level types (C,R,F) + // and no other params (e.g. target) change with it. If other + // types require tracking, additional data collection may be needed. + this.route.paramMap.subscribe( + (params: ParamMap) => this.holdType = params.get('type')); + this.holdType = this.route.snapshot.params['type']; this.holdTargets = this.route.snapshot.queryParams['target']; this.holdFor = this.route.snapshot.queryParams['holdFor'] || 'patron'; @@ -316,7 +323,10 @@ export class HoldComponent implements OnInit { // Attempt hold placement on all targets placeHolds(idx?: number) { if (!idx) { idx = 0; } - if (!this.holdTargets[idx]) { return; } + if (!this.holdTargets[idx]) { + this.placeHoldsClicked = false; + return; + } this.placeHoldsClicked = true; const target = this.holdTargets[idx]; @@ -331,9 +341,21 @@ export class HoldComponent implements OnInit { ctx.processing = true; const selectedFormats = this.mrSelectorsToFilters(ctx); + let hType = this.holdType; + let hTarget = ctx.holdTarget; + if (hType === 'T' && ctx.holdMeta.part) { + // A Title hold morphs into a Part hold at hold placement time + // if a part is selected. This can happen on a per-hold basis + // when placing T-level holds. + hType = 'P'; + hTarget = ctx.holdMeta.part.id(); + } + + console.debug(`Placing ${hType}-type hold on ${hTarget}`); + return this.holds.placeHold({ - holdTarget: ctx.holdTarget, - holdType: this.holdType, + holdTarget: hTarget, + holdType: hType, recipient: this.user.id(), requestor: this.requestor.id(), pickupLib: this.pickupLib, @@ -348,20 +370,22 @@ export class HoldComponent implements OnInit { }).toPromise().then( request => { - console.log('hold returned: ', request); ctx.lastRequest = request; ctx.processing = false; - // If this request failed and was not already an override, - // see of this user has permission to override. - if (!request.override && - !request.result.success && request.result.evt) { + if (!request.result.success) { + console.debug('hold failed with: ', request); + + // If this request failed and was not already an override, + // see of this user has permission to override. + if (!request.override && request.result.evt) { - const txtcode = request.result.evt.textcode; - const perm = txtcode + '.override'; + const txtcode = request.result.evt.textcode; + const perm = txtcode + '.override'; - return this.perm.hasWorkPermHere(perm).then( - permResult => ctx.canOverride = permResult[perm]); + return this.perm.hasWorkPermHere(perm).then( + permResult => ctx.canOverride = permResult[perm]); + } } }, error => { @@ -411,6 +435,22 @@ export class HoldComponent implements OnInit { } ); } + + isItemHold(): boolean { + return this.holdType === 'C' + || this.holdType === 'R' + || this.holdType === 'F'; + } + + setPart(ctx: HoldContext, $event) { + const partId = $event.target.value; + if (partId) { + ctx.holdMeta.part = + ctx.holdMeta.parts.filter(p => +p.id() === +partId)[0]; + } else { + ctx.holdMeta.part = null; + } + } } diff --git a/Open-ILS/src/eg2/src/app/staff/share/holds/holds.service.ts b/Open-ILS/src/eg2/src/app/staff/share/holds/holds.service.ts index a6ddb7e881..f1c6d0b106 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/holds/holds.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/holds/holds.service.ts @@ -50,6 +50,7 @@ export interface HoldRequestTarget { bibId?: number; bibSummary?: BibRecordSummary; part?: IdlObject; + parts?: IdlObject[]; callNum?: IdlObject; copy?: IdlObject; issuance?: IdlObject; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index 11c29f8914..25f2633487 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -4874,6 +4874,7 @@ sub hold_metadata { volume => $volume, issuance => $issuance, part => $part, + parts => [], bibrecord => $bre, metarecord => $metarecord, metarecord_filters => {} @@ -4891,6 +4892,10 @@ sub hold_metadata { $meta->{metarecord} = $e->retrieve_metabib_metarecord($map->metarecord); } + + # Also fetch the available parts for bib-level holds. + $meta->{parts} = $e->search_biblio_monograph_part( + {record => $bre->id, deleted => 'f'}); } if ($meta->{metarecord}) { -- 2.43.2