From bbe4c3c21abab7093010c7fb92e26f4f58ac5660 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 24 Mar 2022 10:43:59 -0400 Subject: [PATCH] LP1904036 Pending patrons stat cats save fix Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/edit.component.ts | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) 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 c5afd227f8..d94f514bb7 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 @@ -440,6 +440,70 @@ export class EditComponent implements OnInit, AfterViewInit { stageData.settings.forEach(setting => { this.userSettings[setting.setting()] = Boolean(setting.value()); }); + + stageData.statcats.forEach(entry => { + + entry.statcat(Number(entry.statcat())); + + const stat: StatCat = + this.statCats.filter(s => s.cat.id() === entry.statcat())[0]; + + let cboxEntry: ComboboxEntry = + stat.entries.filter(e => e.label === entry.value())[0]; + + if (!cboxEntry) { + // If the applied value is not in the list of entries, + // create a freetext combobox entry for it. + cboxEntry = { + id: null, + freetext: true, + label: entry.value() + }; + + stat.entries.unshift(cboxEntry); + } + + this.userStatCats[entry.statcat()] = cboxEntry; + + // This forces the creation of the stat cat entry IDL objects. + this.userStatCatChange(stat.cat, cboxEntry); + }); + + if (patron.billing_address()) { + this.handlePostCodeChange( + patron.billing_address(), patron.billing_address().post_code()); + } + } + + checkStageUserDupes(): Promise { + // Fire duplicate patron checks,once for each category + + const patron = this.patron; + + // Fire-and-forget the email search because it can take several seconds + if (patron.email()) { + this.dupeValueChange('email', patron.email()); + } + + return this.dupeValueChange('name', patron.family_name()) + + .then(_ => { + if (patron.ident_value()) { + return this.dupeValueChange('ident', patron.ident_value()); + } + }) + .then(_ => { + if (patron.day_phone()) { + return this.dupeValueChange('phone', patron.day_phone()); + } + }) + .then(_ => { + let promise = Promise.resolve(); + this.patron.addresses().forEach(addr => { + promise = + promise.then(__ => this.dupeValueChange('address', addr)); + }); + }); } copyCloneData(clone: IdlObject) { -- 2.11.0