fm-edit: be more resilient in case linked values cannot be fleshed
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 1 Sep 2020 15:33:45 +0000 (11:33 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 1 Sep 2020 15:33:45 +0000 (11:33 -0400)
(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 <gmc@equinoxinitiative.org>
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.html
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts

index e20c037..431dc28 100644 (file)
@@ -51,7 +51,7 @@
             </ng-container>
 
             <ng-container *ngSwitchCase="'readonly-list'">
-              <ng-container *ngIf="field.linkedValues">
+              <ng-container *ngIf="field.linkedValues && field.linkedValues[0]?.label">
                 <span>{{field.linkedValues[0].label}}</span>
               </ng-container>
             </ng-container>
index 8dfa4e0..7ea7c94 100644 (file)
@@ -420,7 +420,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]()};
         });
     }