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;
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/));
break;
case 'opac.default_pickup_location':
- this.pickupLib = value;
+ this.pickupLib = Number(value);
break;
}
});
'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<IdlObject> {
return this.bcSearch(barcode).toPromise()
.then(barcodes => {
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);
}
}