LP#1857150: eg-fm-record-editor: handle unavailable linked values
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 3 Sep 2020 17:32:46 +0000 (13:32 -0400)
committerJason Etheridge <jason@EquinoxInitiative.org>
Thu, 10 Sep 2020 20:35:56 +0000 (16:35 -0400)
In some cases, a record editor might be handed a base object
that has a linked column whose values cannot be retrieved
because the user has permission to fetch the base object
but not the linked objects. This patch makes the record editor
more resilient in the face of that situation.

Sponsored-by: Evergreen Community Development Initiative
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Etheridge <jason@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 e1ba382..8ca13dc 100644 (file)
@@ -50,7 +50,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 9a1a12e..f6ff441 100644 (file)
@@ -428,7 +428,9 @@ 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]()};
+            }
         });
     }