webstaff: make authorityControlSet in egTagTable actually be a singleton
authorGalen Charlton <gmc@esilibrary.com>
Thu, 3 Sep 2015 16:03:05 +0000 (16:03 +0000)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:19 +0000 (15:44 -0400)
This resolves an issue where the control set can be incompletely
initialized when jumping from creating a new bib to opening
in in catalog view.

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 b420749..58ec75b 100644 (file)
@@ -518,7 +518,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                 $scope.save_stack_depth = 0;
                 $scope.controlfields = [];
                 $scope.datafields = [];
-                $scope.controlSet = new egTagTable.authorityControlSet();
+                $scope.controlSet = egTagTable.getAuthorityControlSet();
 
                 egTagTable.loadTagTable({ marcRecordType : $scope.record_type });
 
index f32b2de..1580ca5 100644 (file)
@@ -17,7 +17,8 @@ function($q,   egCore,   egAuth) {
         authority_control_set : {
             _remote_loaded : false,
             _controlsets : [ ]
-        }
+        },
+        _active_control_set : undefined
     };
 
     service.initialized = function() {
@@ -500,5 +501,13 @@ function($q,   egCore,   egAuth) {
 
     }
 
+    service.getAuthorityControlSet = function() {
+        if (!service._active_control_set) {
+            service.authority_control_set._remote_loaded = false;
+            service._active_control_set = new service.authorityControlSet();
+        }
+        return service._active_control_set;
+    }
+
     return service;
 }]);