From e620e8ed3975c247f5c5e0bbe7e1c7db16e0542c Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 25 Jun 2009 13:28:12 +0000 Subject: [PATCH] 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/trunk@13470 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/extras/selfcheck/selfcheck.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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; } -- 2.43.2