JBAS-1728 Re-focus SCKO barcode input after printing
authorBill Erickson <berickxx@gmail.com>
Wed, 13 Dec 2017 21:28:23 +0000 (16:28 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/kcls/circ/selfcheck/selfcheck.js

index 81159d1..360513e 100644 (file)
@@ -763,25 +763,36 @@ SelfCheckManager.prototype.printList = function(which) {
     // reset timeout
     selfckResetTimer();
 
+    function afterPrint() {
+        // Called after the print window is closed.
+        // Re-focus input box after all print actions.
+        setTimeout(function(){selfckScanBox.focus()}, 100);
+    }
+
     switch(which) {
         case 'checkout':
-            this.printSessionReceipt();
+            this.printSessionReceipt(afterPrint);
             break;
         case 'items_out':
-            this.printItemsOutReceipt();
+            this.printItemsOutReceipt(afterPrint);
             break;
         case 'holds':
-            this.printHoldsReceipt();
+            this.printHoldsReceipt(afterPrint);
             break;
         case 'ready':
             readyHolds = true;
-            this.printHoldsReceipt();
+            this.printHoldsReceipt(afterPrint);
             readyHolds = false;
             break;
         case 'fines':
-            this.printFinesReceipt();
+            this.printFinesReceipt(afterPrint);
             break;
     }
+
+    // afterPrint() is only called as a callback when there is stuff to
+    // print.  Call it here too to ensure it's invokded one way or the
+    // other.
+    afterPrint();
 }
 
 SelfCheckManager.prototype.updateHoldsSummary = function() {