LP#1626157 more or select repairs
authorBill Erickson <berickxx@gmail.com>
Wed, 18 Apr 2018 16:41:27 +0000 (12:41 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 18 Apr 2018 16:41:27 +0000 (12:41 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/fm-editor/fm-editor.component.ts
Open-ILS/src/eg2/src/app/share/org-select.component.ts

index cb4b587..3ab2ceb 100644 (file)
@@ -150,7 +150,7 @@ export class FmRecordEditorComponent
                 }
             } else if (field.datatype == 'org_unit') {
                 let org = rec[field.name]();
-                if (org != null && typeof org == 'object') {
+                if (org && typeof org == 'object') {
                     rec[field.name](org.id());
                 }
             }
index 7ee2ba5..627dd4e 100644 (file)
@@ -42,9 +42,9 @@ export class EgOrgSelectComponent implements OnInit {
 
     // Apply a default org unit value when none is set.
     // First tries workstation org unit, then user home org unit.
+    // An onChange event WILL be generated when a default is applied.
     @Input() applyDefault: boolean = false;
 
-
     // List of org unit IDs to exclude from the selector
     @Input() set hideOrgs(ids: number[]) {
         if (ids) this.hidden = ids;
@@ -99,6 +99,9 @@ export class EgOrgSelectComponent implements OnInit {
             this.selected = this.formatForDisplay(
                 this.org.get(this.auth.user().ws_ou())
             );
+
+            // avoid notifying mid-digest
+            setTimeout(() => this.onChange.emit(this.startOrg), 0);
         }
 
         if (this.startOrg) {