From: Bill Erickson Date: Thu, 7 Oct 2021 15:16:28 +0000 (-0400) Subject: LP1904036 Register patron stores saved user in recents X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b3e739fbc5ad4b7f614b89605366aca77c8dee29;p=working%2FEvergreen.git LP1904036 Register patron stores saved user in recents Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts index 3ef4a913a5..6823e799fc 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts @@ -1436,6 +1436,8 @@ export class EditComponent implements OnInit, AfterViewInit { ).toPromise().then(result => { if (result && result.classname) { + this.context.addRecentPatron(result.id()); + // Successful result returns the patron IdlObject. return this.modifiedPatron = result; } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts index d0a5118d27..d0f9a7c467 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts @@ -95,7 +95,9 @@ export class PatronContextService { .then(_ => this.addRecentPatron()); } - addRecentPatron(): Promise { + addRecentPatron(patronId?: number): Promise { + + if (!patronId) { patronId = this.summary.id; } return this.serverStore.getItem('ui.staff.max_recent_patrons') .then(num => { @@ -104,12 +106,12 @@ export class PatronContextService { const patrons: number[] = this.store.getLoginSessionItem('eg.circ.recent_patrons') || []; - patrons.splice(0, 0, this.summary.id); // put this user at front + patrons.splice(0, 0, patronId); // put this user at front patrons.splice(this.maxRecentPatrons, 1); // remove excess // remove any other occurrences of this user, which may have been // added before the most recent user. - const idx = patrons.indexOf(this.summary.id, 1); + const idx = patrons.indexOf(patronId, 1); if (idx > 0) { patrons.splice(idx, 1); } this.store.setLoginSessionItem('eg.circ.recent_patrons', patrons);