webstaff: tweak setting default classification scheme in volcopy editor
authorGalen Charlton <gmc@esilibrary.com>
Tue, 26 Jan 2016 22:34:03 +0000 (17:34 -0500)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:54 +0000 (14:58 -0500)
With this patch, the volume/copy editor creation default for
classification scheme now can have a value of "Use Library Setting".
If this is in effect, the default classification scheme for new
volumes is taken from the library setting.

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

index dc67634..df0a1d7 100644 (file)
@@ -27,7 +27,7 @@
                 <div class="col-xs-12">
                     <h4 class="pad-vert">[% l('Creation Defaults') %]</h4>
                     <select class="form-control" ng-change="saveDefaults()" ng-model="defaults.classification" ng-options="cl.id() as cl.name() for cl in classification_list">
-                        <option value="">Unset Default Classification Scheme</option>
+                        <option value="">[% ('Use Library Setting') %]</option>
                     </select>
                 </div>
             </div>
index f347be7..5ec7c28 100644 (file)
@@ -661,6 +661,14 @@ function(egCore , $q) {
 
                             $scope.struct[cn.id()] = [cp];
                             $scope.allcopies.push(cp);
+                            if (!scope.defaults.classification) {
+                                egCore.org.settings(
+                                    ['cat.default_classification_scheme'],
+                                    cn.owning_lib()
+                                ).then(function (val) {
+                                    cn.label_class(val['cat.default_classification_scheme']);
+                                });
+                            }
                         }
                     } else if (n < o && n >= $scope.orig_cn_count) { // removing
                         var how_many = o - n;
@@ -1088,26 +1096,35 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                                 cn.isnew( true );
                                 cn.prefix( $scope.defaults.prefix || -1 );
                                 cn.suffix( $scope.defaults.suffix || -1 );
-                                cn.label_class( $scope.defaults.classification || 1 );
                                 cn.owning_lib( proto.owner || egCore.auth.user().ws_ou() );
                                 cn.record( $scope.record_id );
-                                if (proto.label) {
-                                     cn.label( proto.label );
-                                } else {
-                                    egCore.net.request(
-                                        'open-ils.cat',
-                                        'open-ils.cat.biblio.record.marc_cn.retrieve',
-                                        $scope.record_id,
-                                        $scope.defaults.classification || 1
-                                    ).then(function(cn_array) {
-                                        if (cn_array.length > 0) {
-                                            for (var field in cn_array[0]) {
-                                                cn.label( cn_array[0][field] );
-                                                break;
+                                egCore.org.settings(
+                                    ['cat.default_classification_scheme'],
+                                    cn.owning_lib()
+                                ).then(function (val) {
+                                    cn.label_class(
+                                        $scope.defaults.classification ||
+                                        val['cat.default_classification_scheme'] ||
+                                        1
+                                    );
+                                    if (proto.label) {
+                                        cn.label( proto.label );
+                                    } else {
+                                        egCore.net.request(
+                                            'open-ils.cat',
+                                            'open-ils.cat.biblio.record.marc_cn.retrieve',
+                                            $scope.record_id,
+                                            cn.label_class()
+                                        ).then(function(cn_array) {
+                                            if (cn_array.length > 0) {
+                                                for (var field in cn_array[0]) {
+                                                    cn.label( cn_array[0][field] );
+                                                    break;
+                                                }
                                             }
-                                        }
-                                    });
-                                } 
+                                        });
+                                    }
+                                });
 
                                 var cp = new egCore.idl.acp();
                                 cp.call_number( cn );