From f3e410324e9988431d12081ee62979ff27b2db64 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 1 Sep 2020 10:52:50 -0400 Subject: [PATCH] fm-edit: (SQUASH) deal with potential initialization sequence error Signed-off-by: Galen Charlton fm-edit: be more resilient in case linked values cannot be fleshed (as might happen in various permissions scenarios; for example, a user may be able to fetch providers but not the EDI default account associated with it) Signed-off-by: Galen Charlton --- Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html | 2 +- Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html index febb726673..e07da2eeda 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html @@ -50,7 +50,7 @@ - + {{field.linkedValues[0].label}} diff --git a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts index 109d6a17a9..9e0706ab58 100644 --- a/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts +++ b/Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts @@ -428,7 +428,8 @@ export class FmRecordEditorComponent || this.idl.getClassSelector(class_) || idField; return list.map(item => { - return {id: item[idField](), label: item[selector]()}; + if (item !== undefined) + return {id: item[idField](), label: item[selector]()}; }); } @@ -624,7 +625,9 @@ export class FmRecordEditorComponent this.pcrud[this.mode]([recToSave]).toPromise().then( result => { this.recordSaved.emit(result); - this.fmEditForm.form.markAsPristine(); + if (this.fmEditForm) { + this.fmEditForm.form.markAsPristine(); + } this.successStr.current().then(msg => this.toast.success(msg)); if (this.isDialog()) { this.record = undefined; this.close(result); } }, -- 2.11.0