From c43a689178e57b75bd80ab8ec2aef869149fb6bc Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 29 Oct 2014 17:07:49 -0400 Subject: [PATCH] KMAIN-205: SCK message if multiple barcode scans Cross-port: 435f3ee --- Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js | 1 + .../web/js/ui/kcls/circ/selfcheck/selfcheck.js | 27 +++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js b/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js index 438d55678b..168a75501f 100644 --- a/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js +++ b/Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js @@ -12,6 +12,7 @@ "OPEN_CIRCULATION_EXISTS" : "Item ${0} is already checked out to another user", "GENERIC_CIRC_FAILURE" : "Unable to check out item ${0}. Please see staff.", "LOGIN_FAILED" : "Login for ${0} failed", + "LOGIN_BARCODE_DOUBLE" : "Your PIN is needed.", "UNKNOWN_ERROR" : "An unhandled exception occurred with error code ${0}", "MAX_RENEWALS" : "No more renewals allowed for item ${0}", "ITEM_NOT_CATALOGED" : "Item ${0} was not found in the system. Try re-scanning the item.", diff --git a/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js index e4c1b2196a..4ce4077e66 100644 --- a/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js @@ -39,6 +39,7 @@ function SelfCheckManager() { this.staff = null; this.workstation = null; this.authtoken = null; + this.fail_count = 0; this.patron = null; this.patronBarcodeRegex = null; @@ -307,6 +308,7 @@ SelfCheckManager.prototype.drawLoginPage = function() { var txtBox = (dojo.byId('step2').style.display=='none') ? 'patron-login-username' : 'patron-login-password'; try{var a=dojo.byId(txtBox);a.focus();a.select();}catch(e){} + SelfCheckManager.fail_count = 0; } /** @@ -337,12 +339,24 @@ SelfCheckManager.prototype.loginPatron = function(barcode_or_usrname, passwd) { if(res == 0) { // user-not-found results in login failure - this.handleAlert( - dojo.string.substitute(localeStrings.LOGIN_FAILED, [barcode || usrname]), - false, 'login-failure' - ); - this.drawLoginPage(); - openils.Util.show('back_to_login'); + this.fail_count++; + // Double-Scan of Barcode + if (dojo.byId('patron-login-username').value == dojo.byId('patron-login-password').value) { + dojo.byId('patron-login-password').value = ''; + dojo.byId('patron-login-password').focus(); + if (this.fail_count > 0) { + // Barcode and PIN are the same, but fails login? That means double scan + this.handleAlert(localeStrings.LOGIN_BARCODE_DOUBLE, false, 'login-failure'); + openils.Util.show('back_to_login'); + } + } else { + this.handleAlert( + dojo.string.substitute(localeStrings.LOGIN_FAILED, [barcode || usrname]), + false, 'login-failure' + ); + this.drawLoginPage(); + openils.Util.show('back_to_login'); + } return; } //} @@ -1484,6 +1498,7 @@ function checkLogin() { function cancelLogin() { + SelfCheckManager.fail_count = 0; dojo.byId('oils-selfck-status-div').innerHTML = ''; dojo.byId('oils-selfck-status-div2').innerHTML = ''; dojo.byId('oils-selfck-status-div3').innerHTML = ''; -- 2.11.0