From 0ef0c3585976a2ffa265c1cd6cc9a524330b99a3 Mon Sep 17 00:00:00 2001 From: Scott Angel Date: Fri, 17 Mar 2023 09:46:20 -0500 Subject: [PATCH] LP2008834 - Option to Hide Strict Barcode 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 --- .../xxxx.data.option-to-hide-strict-barcode-checkbox.sql | 13 +++++++++++++ Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 | 2 +- Open-ILS/src/templates/staff/circ/patron/t_checkout.tt2 | 2 +- Open-ILS/src/templates/staff/circ/renew/t_renew.tt2 | 2 +- Open-ILS/src/templates/staff/offline-interface.tt2 | 16 ++++++++-------- Open-ILS/web/js/ui/default/staff/circ/checkin/app.js | 7 ++++++- Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js | 7 ++++++- Open-ILS/web/js/ui/default/staff/circ/renew/app.js | 6 ++++++ Open-ILS/web/js/ui/default/staff/offline.js | 1 + 9 files changed, 43 insertions(+), 13 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/xxxx.data.option-to-hide-strict-barcode-checkbox.sql 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 index 0000000000..6e8e3de3b0 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/xxxx.data.option-to-hide-strict-barcode-checkbox.sql @@ -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 diff --git a/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 b/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 index bbbec0e63b..a22fb36dd3 100644 --- a/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 +++ b/Open-ILS/src/templates/staff/circ/checkin/t_checkin.tt2 @@ -72,7 +72,7 @@ -
+
-
+
-
+
- - + +
@@ -421,8 +421,8 @@
- - + +
@@ -488,8 +488,8 @@
- - + +
@@ -553,8 +553,8 @@
- - + +
diff --git a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js index 0cf3439b09..c688823b3d 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/checkin/app.js @@ -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) { diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js index fcdfccf70e..1a0130c777 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/checkout.js @@ -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/ diff --git a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js index 93dc6a4d70..3d6dd11c92 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/renew/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/renew/app.js @@ -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); diff --git a/Open-ILS/web/js/ui/default/staff/offline.js b/Open-ILS/web/js/ui/default/staff/offline.js index f31cc6324e..e87af7525a 100644 --- a/Open-ILS/web/js/ui/default/staff/offline.js +++ b/Open-ILS/web/js/ui/default/staff/offline.js @@ -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) { -- 2.11.0