lp1821950 Require Call Number Label YAOUS
authorKyle Huckins <khuckins@catalyte.io>
Thu, 16 May 2019 22:05:55 +0000 (22:05 +0000)
committerMichele Morgan <mmorgan@noblenet.org>
Thu, 13 Oct 2022 17:32:33 +0000 (13:32 -0400)
- Add YAOUS to Require Call Number Labels in Copy Editor
- Set new YAOUS to true
- Don't display empty call number field warning if call numbers
aren't required on the copy editor.
- Properly enable/disable saving an item in the volcopy editor when
CN label is empty, based on Require Call Number Label setting.

Signed-off-by: Kyle Huckins <khuckins@catalyte.io>

 Changes to be committed:
modified:   Open-ILS/src/sql/Pg/950.data.seed-values.sql
new file:   Open-ILS/src/sql/Pg/upgrade/XXXX.lp1821950-call-number-label-required-yaous.sql
modified:   Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Michele Morgan <mmorgan@noblenet.org>

Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.lp1821950-call-number-label-required-yaous.sql [new file with mode: 0644]
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index ef95011..910e887 100644 (file)
@@ -3331,6 +3331,15 @@ INSERT into config.org_unit_setting_type
         'coust', 'description'),
     'currency', null)
 
+,( 'cat.require_call_number_labels', 'cat',
+    oils_i18n_gettext('cat.require_call_number_labels',
+        'Require call number labels in Copy Editor',
+        'coust', 'label'),
+    oils_i18n_gettext('cat.require_call_number_labels',
+        'Define whether Copy Editor requires Call Number labels',
+        'coust', 'description'),
+    'bool', null)
+
 ,( 'circ.min_item_price', 'finance',
     oils_i18n_gettext('circ.min_item_price',
         'Minimum Item Price',
@@ -5825,6 +5834,7 @@ INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES (
     ,(1, 'cat.label.font.size', 10)
     ,(1, 'cat.label.font.weight', '"normal"')
     ,(1, 'circ.grace.extend', 'true')
+    ,(1, 'cat.require_call_number_labels', 'true')
 ;
 
 --220.schema.rating.sql (Default badge for popularity ranking)
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.lp1821950-call-number-label-required-yaous.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.lp1821950-call-number-label-required-yaous.sql
new file mode 100644 (file)
index 0000000..a0c7870
--- /dev/null
@@ -0,0 +1,19 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT into config.org_unit_setting_type
+( name, grp, label, description, datatype, fm_class ) VALUES
+( 'cat.require_call_number_labels', 'cat',
+  oils_i18n_gettext('cat.require_call_number_labels',
+    'Require call number labels in Copy Editor',
+    'coust', 'label'),
+  oils_i18n_gettext('cat.require_call_number_labels',
+    'Define whether Copy Editor requires Call Number labels',
+    'coust', 'description'),
+  'bool', null);
+
+INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES
+  (1, 'cat.require_call_number_labels', 'true');
+
+COMMIT;
\ No newline at end of file
index bd75754..4a71013 100644 (file)
@@ -682,7 +682,7 @@ function(egCore , $q) {
                 '</div>'+
                 '<div class="col-xs-2">'+
                     '<input class="form-control" type="text" ng-change="updateLabel()" ng-model="label"/>'+
-                    '<div class="label label-danger" ng-if="empty_label">{{empty_label_string}}</div>'+
+                    '<div class="label label-danger" ng-if="empty_label && require_label">{{empty_label_string}}</div>'+
                 '</div>'+
                 '<div class="col-xs-1">'+
                     '<select class="form-control" ng-model="suffix" ng-change="updateSuffix()" ng-options="s.label() for s in suffix_list"></select>'+
@@ -700,6 +700,9 @@ function(egCore , $q) {
                 if (!$scope.callNumber.label()) $scope.callNumber.empty_label = true;
 
                 $scope.empty_label = false;
+                egCore.org.settings('cat.require_call_number_labels').then(function(res) {
+                    $scope.require_label = res['cat.require_call_number_labels'];
+                });
                 $scope.empty_label_string = window.empty_label_string;
 
                 $scope.idTracker = function (x) { if (x && x.id) return x.id() };
@@ -1093,6 +1096,10 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
         }
     };
 
+    egCore.org.settings('cat.require_call_number_labels').then(function(res) {
+        $scope.require_label = res['cat.require_call_number_labels'];
+    });
+
     $scope.new_lib_to_add = egCore.org.get(egCore.auth.user().ws_ou());
     $scope.changeNewLib = function (org) {
         $scope.new_lib_to_add = org;
@@ -1793,10 +1800,13 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                 itemSvc.copies,
                 function (i) {
                     if (!$scope.only_vols) {
-                        if (i.duplicate_barcode || i.empty_barcode || i.call_number().empty_label) {
+                        if (i.duplicate_barcode || i.empty_barcode) {
+                            can_save = false;
+                        }
+                        if (i.call_number().empty_label && $scope.require_label) {
                             can_save = false;
                         }
-                    } else if (i.call_number().empty_label) {
+                    } else if (i.call_number().empty_label && $scope.require_label) {
                         can_save = false;
                     }
                 }