webstaff: check that control set loaded before loading record into MARC editor
authorGalen Charlton <gmc@esilibrary.com>
Tue, 1 Sep 2015 18:44:11 +0000 (18:44 +0000)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:18 +0000 (15:44 -0400)
This seems hacky... but it also seems to work.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
Open-ILS/web/js/ui/default/staff/cat/services/tagtable.js

index e36fac8..f45376a 100644 (file)
@@ -1027,9 +1027,16 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                     }
                 );
 
-                if ($scope.recordId || $scope.marcXml) {
-                    loadRecord();
-                }
+                var unregister = $scope.$watch(function() {
+                    return egTagTable.initialized();
+                }, function(val) {
+                    if (val) {
+                        unregister();
+                        if ($scope.recordId || $scope.marcXml) {
+                            loadRecord();
+                        }
+                    }
+                });
 
                 $scope.mangle_005 = function () {
                     var now = new Date();
index 6b40c9c..f32b2de 100644 (file)
@@ -15,10 +15,15 @@ function($q,   egCore,   egAuth) {
         ff_pos_map : { },
         ff_value_map : { },
         authority_control_set : {
+            _remote_loaded : false,
             _controlsets : [ ]
         }
     };
 
+    service.initialized = function() {
+        return service.authority_control_set._remote_loaded;
+    }
+
     // allow 'bre' and 'biblio' to be synonyms, etc.
     service.normalizeRecordType = function(recordType) {
         if (recordType === 'sre') {