X-Git-Url: https://git.evergreen-ils.org/?p=Evergreen.git;a=blobdiff_plain;f=Open-ILS%2Fsrc%2Feg2%2Fsrc%2Fapp%2Fstaff%2Fcatalog%2Fhold%2Fhold.component.ts;h=c079a1678c647c787782feaf7b87a74bde8e72a0;hp=f0ae758a75d3d45f839ba897094c90a5c3b0cd68;hb=1afbf5aba860e2ab29884d58b680eb5b77581b67;hpb=a5941cbbf852a4c2baf0ddc2815a8ac620d06a8d 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 f0ae758a75..c079a1678c 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 @@ -202,9 +202,9 @@ export class HoldComponent implements OnInit { } // Load the bib, call number, copy, etc. data associated with each target. - getTargetMeta() { - this.holds.getHoldTargetMeta(this.holdType, this.holdTargets) - .subscribe(meta => { + getTargetMeta(): Promise { + return this.holds.getHoldTargetMeta(this.holdType, this.holdTargets) + .toPromise().then(meta => { this.holdContexts.filter(ctx => ctx.holdTarget === meta.target) .forEach(ctx => { ctx.holdMeta = meta; @@ -318,17 +318,20 @@ export class HoldComponent implements OnInit { this.getUser(); } - getUser(id?: number) { + getUser(id?: number): Promise { - this.resetForm(true); + let promise = this.resetForm(true); const flesh = {flesh: 1, flesh_fields: {au: ['settings']}}; - const promise = id ? this.patron.getById(id, flesh) : - this.patron.getByBarcode(this.userBarcode, flesh); + promise = promise.then(_ => { + return id ? + this.patron.getById(id, flesh) : + this.patron.getByBarcode(this.userBarcode, flesh); + }); this.badBarcode = null; - promise.then(user => { + return promise.then(user => { if (!user) { // IDs are assumed to valid @@ -343,7 +346,7 @@ export class HoldComponent implements OnInit { }); } - resetForm(keepBarcode?: boolean) { + resetForm(keepBarcode?: boolean): Promise { this.user = null; this.notifyEmail = true; this.notifyPhone = true; @@ -361,7 +364,7 @@ export class HoldComponent implements OnInit { }); // Required after rebuilding the contexts - this.getTargetMeta(); + return this.getTargetMeta(); } applyUserSettings() {