KMAIN-205: SCK message if multiple barcode scans
authorBill Erickson <berickxx@gmail.com>
Wed, 29 Oct 2014 21:07:49 +0000 (17:07 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
    Cross-port: 435f3ee

Open-ILS/web/js/dojo/openils/circ/nls/selfcheck.js
Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js

index 438d556..168a755 100644 (file)
@@ -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.",
index e4c1b21..4ce4077 100644 (file)
@@ -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 = '';