From 82fcb5270a1bc705c00449d63985350a3254ead5 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 7 Oct 2021 11:16:28 -0400 Subject: [PATCH] LP1904036 Register patron stores saved user in recents Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/staff/circ/patron/edit.component.ts | 2 ++ Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) 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); -- 2.11.0