[open-ils-commits] r13470 - trunk/Open-ILS/web/opac/extras/selfcheck (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jun 25 09:28:13 EDT 2009


Author: erickson
Date: 2009-06-25 09:28:12 -0400 (Thu, 25 Jun 2009)
New Revision: 13470

Modified:
   trunk/Open-ILS/web/opac/extras/selfcheck/selfcheck.js
Log:
adjust the arbitrary print sleep based on the number of items that need printing.  this prevents chopping of the data as it's being queued to the printer

Modified: trunk/Open-ILS/web/opac/extras/selfcheck/selfcheck.js
===================================================================
--- trunk/Open-ILS/web/opac/extras/selfcheck/selfcheck.js	2009-06-25 13:27:59 UTC (rev 13469)
+++ trunk/Open-ILS/web/opac/extras/selfcheck/selfcheck.js	2009-06-25 13:28:12 UTC (rev 13470)
@@ -176,10 +176,12 @@
     $('selfck-item-barcode-input').value = ''; // prevent browser caching
     $('selfck-patron-login-input').value = '';
     if(patron) {
-        selfckPrint();
+        var numItems = selfckPrint();
+        var sleepTime = 1000;
+        if(numItems > 0) sleepTime += (numItems / 2) * 1000;
         setTimeout(
             function() { location.href = location.href; },
-            3500 // give the browser time to send the page to the printer
+            sleepTime // give the browser time to send the page to the printer
         );
     }
 }
@@ -406,7 +408,12 @@
   * Sets the print date and prints the page
   */
 function selfckPrint() {
-    for(var x in successfulItems) { // make sure we've checked out at least one item
+
+    var numItems = 0;
+    for(var x in successfulItems)  
+        numItems++;
+
+    if(numItems > 0) {
         hideMe($('selfck-patron-checkout-container'));
         unHideMe($('selfck-print-queuing'));
         appendClear($('selfck-print-date'), text(new Date().toLocaleString()));
@@ -427,8 +434,9 @@
             }
         }
         window.print();
-        return;
     }
+
+    return numItems;
 }
 
 



More information about the open-ils-commits mailing list