LP1887429 Holds supports circ.staff_placed_holds_fallback_to_ws_ou
authorBill Erickson <berickxx@gmail.com>
Wed, 23 Sep 2020 18:24:13 +0000 (14:24 -0400)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 6 Jan 2021 00:48:27 +0000 (16:48 -0800)
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 <berickxx@gmail.com>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts
Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts

index 65b7e56..31da8bc 100644 (file)
@@ -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();
index 7879373..e613fb3 100644 (file)
@@ -55,7 +55,8 @@ export class CatalogResolver implements Resolve<Promise<any[]>> {
             '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']);