webstaff: keep $scope.{pre,suf}fix as acnp/acns objects
authorGalen Charlton <gmc@esilibrary.com>
Tue, 20 Oct 2015 19:39:10 +0000 (19:39 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:52 +0000 (14:58 -0500)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 6902a18..b70f81f 100644 (file)
@@ -426,10 +426,14 @@ function(egCore , $q) {
                     if (angular.isObject(currentPrefix)) currentPrefix = currentPrefix.id();
                     itemSvc.get_prefixes($scope.callNumber.owning_lib()).then(function(list){
                         $scope.prefix_list = list;
-                        $scope.prefix = $scope.prefix_list.filter(function (p) {
+                        var newPrefixId = $scope.prefix_list.filter(function (p) {
                             return p.id() == currentPrefix;
                         })[0] || -1;
-                        if ($scope.prefix != currentPrefix) {
+                        if (newPrefixId.id) newPrefixId = newPrefixId.id();
+                        $scope.prefix = $scope.prefix_list.filter(function (p) {
+                            return p.id() == newPrefixId;
+                        })[0];
+                        if ($scope.newPrefixId != currentPrefix) {
                             $scope.callNumber.prefix($scope.prefix);
                         }
                     });
@@ -437,10 +441,14 @@ function(egCore , $q) {
                     if (angular.isObject(currentSuffix)) currentSuffix = currentSuffix.id();
                     itemSvc.get_suffixes($scope.callNumber.owning_lib()).then(function(list){
                         $scope.suffix_list = list;
-                        $scope.suffix = $scope.suffix_list.filter(function (s) {
+                        var newSuffixId = $scope.suffix_list.filter(function (s) {
                             return s.id() == currentSuffix;
                         })[0] || -1;
-                        if ($scope.suffix != currentSuffix) {
+                        if (newSuffixId.id) newSuffixId = newSuffixId.id();
+                        $scope.suffix = $scope.suffix_list.filter(function (s) {
+                            return s.id() == newSuffixId;
+                        })[0];
+                        if ($scope.newSuffixId != currentSuffix) {
                             $scope.callNumber.suffix($scope.suffix);
                         }
                     });