LP1887429 Properly handle user settings in staffcat holds user/berick/lp1887429-staffcat-def-hold-pu-lib-string
authorBill Erickson <berickxx@gmail.com>
Mon, 13 Jul 2020 20:01:38 +0000 (16:01 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 30 Jul 2020 14:36:24 +0000 (10:36 -0400)
Treat user settings like the raw JSON values that they are
when fetched via fleshing.  Also be sure the value for the
'opac.default_pickup_location' user setting is read as a number in the
staff catalog to ensure it can be linked to the org unit in question.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/catalog/hold/hold.component.ts

index c1640b0..6886df9 100644 (file)
@@ -295,10 +295,14 @@ export class HoldComponent implements OnInit {
 
         this.user.settings().forEach(setting => {
             const name = setting.name();
-            const value = setting.value();
+            let value = setting.value();
 
             if (value === '' || value === null) { return; }
 
+            // When fleshing 'settings' on the actor.usr object,
+            // we're grabbing the raw JSON values.
+            value = JSON.parse(value);
+
             switch (name) {
                 case 'opac.hold_notify':
                     this.notifyPhone = Boolean(value.match(/phone/));
@@ -307,7 +311,7 @@ export class HoldComponent implements OnInit {
                     break;
 
                 case 'opac.default_pickup_location':
-                    this.pickupLib = value;
+                    this.pickupLib = Number(value);
                     break;
             }
         });