From: erickson Date: Thu, 25 Jun 2009 13:27:59 +0000 (+0000) Subject: adjust the arbitrary print sleep based on the number of items that need printing... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=bf160df231c3aca98225f6ae8d37148990747b22;p=Evergreen.git 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 git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6@13469 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/extras/selfcheck/selfcheck.js b/Open-ILS/web/opac/extras/selfcheck/selfcheck.js index 60646fc959..1cf569ae20 100644 --- a/Open-ILS/web/opac/extras/selfcheck/selfcheck.js +++ b/Open-ILS/web/opac/extras/selfcheck/selfcheck.js @@ -176,10 +176,12 @@ function selfckLogoutPatron() { $('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 @@ function selfckRenew() { * 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 @@ function selfckPrint() { } } window.print(); - return; } + + return numItems; }