From 3996fa89906ae24cfbf34ad1c24ed81b94a96dca Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 13 Jul 2020 16:01:38 -0400 Subject: [PATCH] LP1887429 Properly handle user settings in staffcat holds 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 Signed-off-by: Michele Morgan Signed-off-by: Jane Sandberg --- .../eg2/src/app/staff/catalog/hold/hold.component.ts | 10 +++++++--- .../eg2/src/app/staff/share/patron/patron.service.ts | 4 +++- 2 files changed, 10 insertions(+), 4 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 133480f4bb..65b7e56ee9 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 @@ -266,7 +266,7 @@ export class HoldComponent implements OnInit { const flesh = {flesh: 1, flesh_fields: {au: ['settings']}}; const promise = id ? this.patron.getById(id, flesh) : - this.patron.getByBarcode(this.userBarcode); + this.patron.getByBarcode(this.userBarcode, flesh); promise.then(user => { this.user = user; @@ -294,10 +294,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/)); @@ -306,7 +310,7 @@ export class HoldComponent implements OnInit { break; case 'opac.default_pickup_location': - this.pickupLib = value; + this.pickupLib = Number(value); break; } }); diff --git a/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts index e50fbb2422..9678c4d8c1 100644 --- a/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/share/patron/patron.service.ts @@ -24,6 +24,8 @@ export class PatronService { 'actor', barcode.trim()); } + // Note pcrudOps should be constructed from the perspective + // of a user ('au') retrieval, not a barcode ('ac') retrieval. getByBarcode(barcode: string, pcrudOps?: any): Promise { return this.bcSearch(barcode).toPromise() .then(barcodes => { @@ -35,7 +37,7 @@ export class PatronService { for (let i = 0; i < barcodes.length; i++) { const bc = barcodes[i]; if (!this.evt.parse(bc)) { - return this.getById(bc.id); + return this.getById(bc.id, pcrudOps); } } -- 2.43.2