From 19c360d08b34e6934d215ce2cda050c10432651a Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 23 Sep 2020 14:24:13 -0400 Subject: [PATCH] LP1887429 Holds supports circ.staff_placed_holds_fallback_to_ws_ou Add support for the 'circ.staff_placed_holds_fallback_to_ws_ou' org unit setting when staff place holds for patrons in the Angular staff catalog. Specifically, if the patron has no preferred pickup lib set, fall back to either the patron's home org or the workstation org depending on the value of the org setting. Signed-off-by: Bill Erickson --- .../src/eg2/src/app/staff/catalog/hold/hold.component.ts | 14 ++++++++++++-- Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) 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 65b7e56ee9..31da8bcda0 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 @@ -7,6 +7,7 @@ import {PcrudService} from '@eg/core/pcrud.service'; import {PermService} from '@eg/core/perm.service'; import {IdlObject} from '@eg/core/idl.service'; import {OrgService} from '@eg/core/org.service'; +import {ServerStoreService} from '@eg/core/server-store.service'; import {BibRecordService, BibRecordSummary} from '@eg/share/catalog/bib-record.service'; import {CatalogService} from '@eg/share/catalog/catalog.service'; import {StaffCatalogService} from '../catalog.service'; @@ -66,6 +67,8 @@ export class HoldComponent implements OnInit { smsEnabled: boolean; placeHoldsClicked: boolean; + puLibWsFallback = false; + @ViewChild('patronSearch', {static: false}) patronSearch: PatronSearchDialogComponent; @@ -76,6 +79,7 @@ export class HoldComponent implements OnInit { private evt: EventService, private net: NetService, private org: OrgService, + private store: ServerStoreService, private auth: AuthService, private pcrud: PcrudService, private bib: BibRecordService, @@ -107,6 +111,9 @@ export class HoldComponent implements OnInit { this.userBarcode = this.staffCat.holdForBarcode; } + this.store.getItem('circ.staff_placed_holds_fallback_to_ws_ou') + .then(setting => this.puLibWsFallback = setting === true); + if (!Array.isArray(this.holdTargets)) { this.holdTargets = [this.holdTargets]; } @@ -282,16 +289,19 @@ export class HoldComponent implements OnInit { } applyUserSettings() { - if (!this.user || !this.user.settings()) { return; } + if (!this.user) { return; } // Start with defaults. this.phoneValue = this.user.day_phone() || this.user.evening_phone(); // Default to work org if placing holds for staff. - if (this.user.id() !== this.requestor.id()) { + if (this.user.id() !== this.requestor.id() && !this.puLibWsFallback) { + // This value may be superseded below by user settings. this.pickupLib = this.user.home_ou(); } + if (!this.user.settings()) { return; } + this.user.settings().forEach(setting => { const name = setting.name(); let value = setting.value(); diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts index 78793730cb..e613fb3c9b 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts @@ -55,7 +55,8 @@ export class CatalogResolver implements Resolve> { 'eg.catalog.search_templates', 'opac.staff_saved_search.size', 'opac.search.enable_bookplate_search', - 'eg.staffcat.exclude_electronic' + 'eg.staffcat.exclude_electronic', + 'circ.staff_placed_holds_fallback_to_ws_ou' ]).then(settings => { this.staffCat.defaultSearchOrg = this.org.get(settings['eg.search.search_lib']); -- 2.11.0