JBAS-821 aviod unnecessary timer resets
authorBill Erickson <berickxx@gmail.com>
Wed, 19 Aug 2015 16:23:06 +0000 (12:23 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
KCLS custom code resets the patron timer even when the patron is not
logged in.  This causes the logout warning to appear even when no patron
is logged in.  Avoid this by preventing the timer from starting when no
patron is logged in.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js

index 1e04a6e..307f5f1 100644 (file)
@@ -19,6 +19,7 @@ var timerId = null;
 var patronTimeoutWarning = 20000; 
 var selfckWarningSetup = false;
 var selfckWarningTimer;
+var selfCheckManager;
 
 
 var selfCheckMgr;
@@ -53,9 +54,13 @@ function selfckStartTimer() {
 
 // reset the logout timer
 function selfckResetTimer() {
-    console.log('resetting timer');
+    console.log('clearing login timer');
     clearTimeout(timerId);
-    selfckStartTimer();
+    
+    if (selfCheckManager && selfCheckManager.patron) {
+        console.log('Starting new login timer');
+        selfckStartTimer();
+    }
 }
 
 function selfckLogoutWarning() {
@@ -1590,7 +1595,8 @@ function cancelLogin() {
  */
 openils.Util.addOnLoad(
     function() {
-        new SelfCheckManager().init();
+        selfCheckManager = new SelfCheckManager();
+        selfCheckManager.init();
                openils.Util.registerEnterHandler(dojo.byId('patron-login-username'), function(){checkLogin();});
                openils.Util.registerEnterHandler(dojo.byId('patron-login-password'), function(){selfCheckMgr.loginPatron(dojo.byId('patron-login-username').value,dojo.byId('patron-login-password').value);});
     }