LP#1739460: Be more careful when gathering shelving locations
authorMike Rylander <mrylander@gmail.com>
Wed, 10 Jan 2018 16:55:08 +0000 (11:55 -0500)
committerBill Erickson <berickxx@gmail.com>
Wed, 8 Aug 2018 20:52:45 +0000 (16:52 -0400)
Specifically, make sure we're getting the IDs, and comparing them as numbers.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js
Open-ILS/web/js/ui/default/staff/services/org.js

index 462b5d6..72fee0e 100644 (file)
@@ -1626,10 +1626,12 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         $scope.$watch('data.copies.length', function () {
             if ($scope.data.copies) {
                 var base_orgs = $scope.data.copies.map(function(cp){
-                    return cp.circ_lib()
+                    if (isNaN(cp.circ_lib())) return Number(cp.circ_lib().id());
+                    return Number(cp.circ_lib());
                 }).concat(
                     $scope.data.copies.map(function(cp){
-                        return cp.call_number().owning_lib()
+                        if (isNaN(cp.call_number().owning_lib())) return Number(cp.call_number().owning_lib().id());
+                        return Number(cp.call_number().owning_lib());
                     })
                 ).concat(
                     [egCore.auth.user().ws_ou()]
@@ -1644,7 +1646,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
                 var final_orgs = all_orgs.filter(function(e,i,a){
                     return a.lastIndexOf(e) === i;
-                }).sort(function(a, b){return parseInt(a)-parseInt(b)});
+                }).sort(function(a, b){return a-b});
 
                 if ($scope.location_orgs.toString() != final_orgs.toString()) {
                     $scope.location_orgs = final_orgs;
index 84731f4..e7467e2 100644 (file)
@@ -54,7 +54,7 @@ function($q,  egEnv,  egAuth,  egNet , $injector) {
         while( (node = service.get(node.parent_ou())))
             nodes.push(node);
         if (as_id) 
-            return nodes.map(function(n){return n.id()});
+            return nodes.map(function(n){return Number(n.id())});
         return nodes;
     };
 
@@ -85,7 +85,7 @@ function($q,  egEnv,  egAuth,  egNet , $injector) {
         }
         descend(node);
         if (as_id) 
-            return nodes.map(function(n){return n.id()});
+            return nodes.map(function(n){return Number(n.id())});
         return nodes;
     }
 
@@ -94,7 +94,7 @@ function($q,  egEnv,  egAuth,  egNet , $injector) {
         var list = service.ancestors(node_or_id).concat(
           service.descendants(node_or_id).slice(1));
         if (as_id) 
-            return list.map(function(n){return n.id()});
+            return list.map(function(n){return Number(n.id())});
         return list;
     }