webstaff: Add support for the fast-add copy status org setting
authorMike Rylander <mrylander@gmail.com>
Tue, 8 Sep 2015 16:38:24 +0000 (12:38 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:20 +0000 (15:44 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>

Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 235a37a..27a2d36 100644 (file)
@@ -823,6 +823,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         });
 
         $scope.workingGridControls = {};
+        $scope.add_vols_copies = false;
 
         egNet.request(
             'open-ils.actor',
@@ -841,6 +842,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
                 if (data.raw && data.raw.length) {
                     $scope.dirty = true;
+                    $scope.add_vols_copies = true;
 
                     /* data.raw data structure looks like this:
                      * [{
@@ -897,8 +899,18 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
             }
 
         }).then( function() {
-            $scope.data = itemSvc;
-            $scope.workingGridDataProvider.refresh();
+            if ($scope.add_vols_copies) {
+                egCore.org.settings([
+                    'cat.default_copy_status_fast'
+                ]).then(function(set) {
+                    $scope.fast_ccs = set['cat.default_copy_status_fast'] || 0;
+                    $scope.data = itemSvc;
+                    angular.forEach($scope.data.copies, function (cp) {
+                        cp.status($scope.fast_ccs);
+                    });
+                    $scope.workingGridDataProvider.refresh();
+                });
+            }
         });
 
         $scope.focusNextFirst = function(prev_lib) {