webstaff: teach volcopy editor how to set default item status
authorGalen Charlton <gmc@esilibrary.com>
Wed, 7 Oct 2015 20:38:24 +0000 (20:38 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:49 +0000 (14:58 -0500)
It now consults the cat.default_copy_status_fast and
cat.default_copy_status_normal library settings as appropriate.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index b32f80e..ae88380 100644 (file)
@@ -1214,6 +1214,7 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap'])
                                         raw: [{
                                             label : $scope.fast_item_callnumber,
                                             barcode : $scope.fast_item_barcode,
+                                            fast_add : true
                                         }],
                                         hide_vols : false,
                                         hide_copies : false
index 0f2efdc..cd1678c 100644 (file)
@@ -970,6 +970,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
 
         $scope.workingGridControls = {};
         $scope.add_vols_copies = false;
+        $scope.is_fast_add = false;
 
         egNet.request(
             'open-ils.actor',
@@ -996,6 +997,8 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                      *      owner      : $org, // optional, defaults to ws_ou
                      *      label      : $cn_label, // optional, to supply a label on a new cn
                      *      barcode    : $cp_barcode // optional, to supply a barcode on a new cp
+                     *      fast_add   : boolean // optional, to specify whether this came
+                     *                              in as a fast add
                      * },...]
                      * 
                      * All can be left out and a completely empty vol/copy combo will be vivicated.
@@ -1004,6 +1007,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                     angular.forEach(
                         data.raw,
                         function (proto) {
+                            if (proto.fast_add) $scope.is_fast_add = true;
                             if (proto.callnumber) {
                                 return egCore.pcrud.retrieve('acn', proto.callnumber)
                                 .then(function(cn) {
@@ -1079,12 +1083,16 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         }).then( function() {
             $scope.data = itemSvc;
             if ($scope.add_vols_copies) {
+                var status_setting = $scope.is_fast_add ?
+                    'cat.default_copy_status_fast' :
+                    'cat.default_copy_status_normal';
                 egCore.org.settings([
-                    'cat.default_copy_status_fast'
+                    status_setting
                 ]).then(function(set) {
-                    $scope.fast_ccs = set['cat.default_copy_status_fast'] || 0;
+                    $scope.default_ccs = set[status_setting] || 
+                        ($scope.is_fast_add ? 0 : 5); // 0 is Available, 5 is In Process
                     angular.forEach($scope.data.copies, function (cp) {
-                        cp.status($scope.fast_ccs);
+                        cp.status($scope.default_ccs);
                     });
                     $scope.workingGridDataProvider.refresh();
                 });