webstaff: Add call number attrs to copy templates
authorMike Rylander <mrylander@gmail.com>
Wed, 2 Sep 2015 14:56:45 +0000 (10:56 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:18 +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/src/templates/staff/cat/volcopy/t_attr_edit.tt2
Open-ILS/src/templates/staff/cat/volcopy/t_defaults.tt2
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index b38db52..d427704 100644 (file)
         </div>
     </div>
 
+    <div class="row pad-vert" ng-if="template_controls && defaults.show_vol_template_controls">
+        <div class="row">
+            <div class="col-xs-12">
+                <h4 class="center-block">[% l('Volume Attributes') %]</h4>
+            </div>
+        </div>
+    </div>
+
+    <div class="row pad-vert" ng-if="template_controls && defaults.show_vol_template_controls">
+        <div class="col-md-1 bg-info">
+            <b>[% l('Classification') %]</b>
+        </div>
+        <div class="nullable col-md-2" ng-class="{'bg-success': working.callnumber.classification !== undefined}">
+            <select class="form-control" ng-model="working.callnumber.classification" ng-options="cl.id() as cl.name() for cl in classification_list">
+                <option value="">[% l('<NONE>') %]</option>
+            </select>
+        </div>
+        <div class="col-md-1 bg-info">
+            <b>[% l('Prefix') %]</b>
+        </div>
+        <div class="nullable col-xs-2" ng-class="{'bg-success': working.callnumber.prefix !== undefined}">
+            <select class="form-control" ng-model="working.callnumber.prefix" ng-options="p.id() as p.label() for p in prefix_list">
+                <option value="">[% l('<NONE>') %]</option>
+            </select>
+        </div>
+        <div class="col-md-1 bg-info">
+            <b>[% l('Suffix') %]</b>
+        </div>
+        <div class="nullable col-md-2" ng-class="{'bg-success': working.callnumber.suffix !== undefined}">
+            <select class="form-control" ng-model="working.callnumber.suffix" ng-options="s.id() as s.label() for s in suffix_list">
+                <option value="">[% l('<NONE>') %]</option>
+            </select>
+        </div>
+    </div>
+
+    <div class="row pad-vert" ng-if="template_controls && defaults.show_vol_template_controls">
+        <div class="row">
+            <div class="col-xs-12">
+                <h4 class="center-block">[% l('Copy Attributes') %]</h4>
+            </div>
+        </div>
+    </div>
+
     <div class="row pad-vert"></div>
 
     <div class="row bg-info">
index 44c28d8..f589139 100644 (file)
@@ -4,12 +4,24 @@
             <div class="row">
                 <div class="col-xs-12">
                     <h4>[% l('Volume/Copy Detail defaults') %]</h4>
+                </div>
+            </div>
+            <div class="row">
+                <div class="col-xs-12">
                     <label>
                         <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.always_volumes"/>
                         [% l('Always display Volume/Copy Detail pane') %]
                     </label>
                 </div>
             </div>
+            <div class="row">
+                <div class="col-xs-12">
+                    <label>
+                        <input type="checkbox" ng-change="saveDefaults()" ng-model="defaults.show_vol_template_controls"/>
+                        [% l('Allow Call Number attributes in Copy Templates') %]
+                    </label>
+                </div>
+            </div>
 
             <div class="row">
                 <div class="col-xs-12">
index cfe93f9..71d3a2d 100644 (file)
@@ -201,8 +201,8 @@ function(egCore , $q) {
             '</div>',
 
         scope: { copy: "=", callNumber: "=", index: "@" },
-        controller : ['$scope','itemSvc',
-            function ( $scope , itemSvc ) {
+        controller : ['$scope','itemSvc','egCore',
+            function ( $scope , itemSvc , egCore ) {
                 $scope.new_part_id = 0;
 
                 $scope.nextBarcode = function (i) {
@@ -247,7 +247,7 @@ function(egCore , $q) {
                 itemSvc.get_parts($scope.callNumber.record()).then(function(list){
                     $scope.part_list = list;
                     angular.forEach(list, function(p){ $scope.parts.push(p.label()) });
-                    $scope.parts = angluar.copy($scope.parts);
+                    $scope.parts = angular.copy($scope.parts);
                 });
 
             }
@@ -691,8 +691,15 @@ function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , eg
                     $scope.working[k] = angular.copy(v);
                 } else {
                     angular.forEach(v, function (sv,sk) {
-                        $scope.working[k][sk] = angular.copy(sv);
-                        if (k == 'statcats') $scope.statcatUpdate(sk);
+                        if (k == 'callnumber') {
+                            angular.forEach(v, function (cnv,cnk) {
+                                $scope.batch[cnk] = cnv;
+                            });
+                            $scope.applyBatchCNValues();
+                        } else {
+                            $scope.working[k][sk] = angular.copy(sv);
+                            if (k == 'statcats') $scope.statcatUpdate(sk);
+                        }
                     });
                 }
             });
@@ -1012,11 +1019,13 @@ function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , eg
                 cnList.push(v);
             });
 
-            egCore.net.request(
+            egNet.request(
                 'open-ils.cat',
                 'open-ils.cat.asset.volume.fleshed.batch.update.override',
                 cnList, 1, { auto_merge_vols : 1, create_parts : 1 }
-            );
+            ).then(function(update_count) {
+                alert(update_count + ' call numbers updated');
+            });
         }
 
     }
@@ -1263,6 +1272,25 @@ function($scope , $q , $routeParams , $location , $timeout , egCore , egNet , eg
                 createSimpleUpdateWatcher('mint_condition');
                 createSimpleUpdateWatcher('opac_visible');
                 createSimpleUpdateWatcher('ref');
+
+                $scope.suffix_list = [];
+                itemSvc.get_suffixes(egCore.auth.user().ws_ou()).then(function(list){
+                    $scope.suffix_list = list;
+                });
+
+                $scope.prefix_list = [];
+                itemSvc.get_prefixes(egCore.auth.user().ws_ou()).then(function(list){
+                    $scope.prefix_list = list;
+                });
+
+                $scope.classification_list = [];
+                itemSvc.get_classifications().then(function(list){
+                    $scope.classification_list = list;
+                });
+
+                createSimpleUpdateWatcher('working.callnumber.classification');
+                createSimpleUpdateWatcher('working.callnumber.prefix');
+                createSimpleUpdateWatcher('working.callnumber.suffix');
             }
         ]
     }