LP2008834 - Option to Hide Strict Barcode
authorScott Angel <scottangel@mobiusconsortium.org>
Fri, 17 Mar 2023 14:46:20 +0000 (09:46 -0500)
committerScott Angel <scottangel@mobiusconsortium.org>
Fri, 17 Mar 2023 14:46:20 +0000 (09:46 -0500)
Added a feature to allow libraries to hide the strict barcode checkbox
using a new org setting. This was requested to eliminate accidental
clicks. If the library decides to hide the checkbox we also set
strict_barcode to false.

This patch also effects the offline mode as well. In order for this to work in offline mode
the workstation will need to have successfully logged in and accessed
one of the pages where the strict barcode checkbox is displayed. We then
cache this setting in the window.localStorage.

The org setting is called 'circ.hide_patron_strict_barcode' located in
the table 'config.org_unit_setting_type'.

Signed-off-by: Scott Angel <scottangel@mobiusconsortium.org>
Open-ILS/src/sql/Pg/upgrade/xxxx.data.option-to-hide-strict-barcode-checkbox.sql [new file with mode: 0644]
Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2
Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2
Open-ILS/src/templates/staff/circ/renew/t_renew.tt2
Open-ILS/src/templates/staff/offline-interface.tt2
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js
Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js
Open-ILS/web/js/ui/default/staff/circ/renew/app.js
Open-ILS/web/js/ui/default/staff/offline.js

diff --git a/Open-ILS/src/sql/Pg/upgrade/xxxx.data.option-to-hide-strict-barcode-checkbox.sql b/Open-ILS/src/sql/Pg/upgrade/xxxx.data.option-to-hide-strict-barcode-checkbox.sql
new file mode 100644 (file)
index 0000000..6e8e3de
--- /dev/null
@@ -0,0 +1,13 @@
+BEGIN;
+
+insert into config.org_unit_setting_type(name, grp, label, description, datatype, fm_class) values
+('circ.hide_patron_strict_barcode', 'gui',
+ oils_i18n_gettext('circ.hide_patron_strict_barcode',
+     'Hide Strict Barcode checkbox on patron checkout/checkin/renew screens',
+     'coust','label'),
+ oils_i18n_gettext('circ.hide_patron_strict_barcode',
+     'The Strict Barcode checkbox will be hidden on the checkout, checkin and renew screens. This setting hides the strict barcode checkbox eliminating accidental clicks.',
+     'coust','description'),
+     'bool',null);
+
+COMMIT;
\ No newline at end of file
index bbbec0e..a22fb36 100644 (file)
@@ -72,7 +72,7 @@
         <input type="submit" class="btn btn-default" value="[% l('Submit') %]"/>
       </div>
     </form>
-    <div class="checkbox">
+    <div ng-if="!hide_strict_barcode_checkbox" class="checkbox">
      <label>
       <input ng-model="strict_barcode" type="checkbox"
          ng-change="onStrictBarcodeChange()"/>
index feb5138..e09c1aa 100644 (file)
@@ -35,7 +35,7 @@
 
       </div>
     </form>
-  <div class="checkbox">
+    <div ng-if="!hide_strict_barcode_checkbox" class="checkbox">
     <label>
       <input ng-model="strict_barcode" type="checkbox"
         ng-change="onStrictBarcodeChange()"/>
index 053bfb6..f5463e0 100644 (file)
@@ -22,7 +22,7 @@
             ng-disabled="outOfRange" value="[% l('Submit') %]"/>
       </div>
     </form>
-  <div class="checkbox">
+  <div ng-if="!hide_strict_barcode_checkbox" class="checkbox">
     <label>
       <input ng-model="strict_barcode" type="checkbox"
         ng-change="onStrictBarcodeChange()"/>
index 5ea679b..5f6e905 100644 (file)
                 <button class="btn btn-warning" ng-click="clear('checkout')">[% l('Clear') %]</button>
               </div>
               <div class="col-md-4">
-                <input id="do_check_co" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
-                <label for="do_check_co">[% l('Strict Barcode') %]</label>
+                <input ng-if="!hide_strict_barcode_checkbox" id="do_check_co" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
+                <label ng-if="!hide_strict_barcode_checkbox" for="do_check_co">[% l('Strict Barcode') %]</label>
               </div>
               <div class="col-md-6">
                 <input id="do_print_co" type="checkbox" ng-model="do_print" ng-click="changePrint()"></input>
                 <button class="btn btn-warning" ng-click="clear('renew')">[% l('Clear') %]</button>
               </div>
               <div class="col-md-4">
-                <input id="do_check_r" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
-                <label for="do_check_r">[% l('Strict Barcode') %]</label>
+                <input ng-if="!hide_strict_barcode_checkbox" id="do_check_r" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
+                <label ng-if="!hide_strict_barcode_checkbox" for="do_check_r">[% l('Strict Barcode') %]</label>
               </div>
               <div class="col-md-6">
                 <input id="do_print_r" type="checkbox" ng-model="do_print" ng-click="changePrint()"></input>
                 <button class="btn btn-warning" ng-click="clear('in_house_use')">[% l('Clear') %]</button>
               </div>
               <div class="col-md-4">
-                <input id="do_check_ihu" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
-                <label for="do_check_ihu">[% l('Strict Barcode') %]</label>
+                <input ng-if="!hide_strict_barcode_checkbox" id="do_check_ihu" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
+                <label ng-if="!hide_strict_barcode_checkbox" for="do_check_ihu">[% l('Strict Barcode') %]</label>
               </div>
               <div class="col-md-6">
                 <input id="do_print_ihu" type="checkbox" ng-model="do_print" ng-click="changePrint()"></input>
                 <button class="btn btn-warning" ng-click="clear('checkin')">[% l('Clear') %]</button>
               </div>
               <div class="col-md-4">
-                <input id="do_check_ci" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
-                <label for="do_check_ci">[% l('Strict Barcode') %]</label>
+                <input ng-if="!hide_strict_barcode_checkbox" id="do_check_ci" type="checkbox" ng-model="strict_barcode" ng-click="changeCheck()"></input>
+                <label ng-if="!hide_strict_barcode_checkbox" for="do_check_ci">[% l('Strict Barcode') %]</label>
               </div>
               <div class="col-md-6">
                 <input id="do_print_ci" type="checkbox" ng-model="do_print" ng-click="changePrint()"></input>
index 0cf3439..c688823 100644 (file)
@@ -55,7 +55,12 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg
     // TODO: add this to the setting batch lookup below
     egCore.hatch.getItem('circ.checkin.strict_barcode')
         .then(function(sb){ $scope.strict_barcode = sb });
-
+    egCore.org.settings('ui.circ.hide_patron_strict_barcode')
+        .then(function(setting) {
+            $scope.hide_strict_barcode_checkbox = setting['ui.circ.hide_patron_strict_barcode'];
+            if($scope.hide_strict_barcode_checkbox) $scope.strict_barcode = false;
+            egCore.hatch.setItem('ui.circ.hide_patron_strict_barcode', $scope.hide_strict_barcode_checkbox);
+        });
     egCore.org.settings([
         'ui.circ.suppress_checkin_popups' // add other settings as needed
     ]).then(function(set) {
index fcdfccf..1a0130c 100644 (file)
@@ -124,6 +124,12 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc ,
 
     egCore.hatch.getItem('circ.checkout.strict_barcode')
         .then(function(sb){ $scope.strict_barcode = sb });
+    egCore.org.settings('ui.circ.hide_patron_strict_barcode')
+        .then(function(setting) {
+            $scope.hide_strict_barcode_checkbox = setting['ui.circ.hide_patron_strict_barcode'];
+            if($scope.hide_strict_barcode_checkbox) $scope.strict_barcode = false;
+            egCore.hatch.setItem('ui.circ.hide_patron_strict_barcode', $scope.hide_strict_barcode_checkbox);
+        });
 
     // avoid multiple, in-flight attempts on the same barcode
     var pending_barcodes = {};
@@ -202,7 +208,6 @@ function($scope , $q , $routeParams , egCore , egUser , patronSvc ,
         $scope.gridDataProvider.prepend();
 
         var options = {check_barcode : $scope.strict_barcode};
-
         egCirc.checkout(params, options).then(
             function(co_resp) {
                 // update stats locally so we don't have to fetch them w/
index 93dc6a4..3d6dd11 100644 (file)
@@ -36,6 +36,12 @@ function($scope , $window , $location , egCore , egGridDataProvider , egCirc) {
 
     egCore.hatch.getItem('circ.renew.strict_barcode')
         .then(function(sb){ $scope.strict_barcode = sb });
+    egCore.org.settings('ui.circ.hide_patron_strict_barcode')
+        .then(function(setting) {
+            $scope.hide_strict_barcode_checkbox = setting['ui.circ.hide_patron_strict_barcode'];
+            if($scope.hide_strict_barcode_checkbox) $scope.strict_barcode = false;
+            egCore.hatch.setItem('ui.circ.hide_patron_strict_barcode', $scope.hide_strict_barcode_checkbox);
+        });
     $scope.focusBarcode = true;
     $scope.outOfRange = false;
     $scope.minDate = new Date(now);
index f31cc63..e87af75 100644 (file)
@@ -371,6 +371,7 @@ function($routeProvider , $locationProvider , $compileProvider) {
             if (setting !== undefined) $scope.do_check_changed = true;
         });
 
+        $scope.hide_strict_barcode_checkbox = Boolean(JSON.parse(window.localStorage.getItem('ui.circ.hide_patron_strict_barcode')));
         egCore.hatch.getWorkstations()
         .then(function(all) {
             if (all && all.length) {