From: pines Date: Mon, 12 Feb 2007 18:44:22 +0000 (+0000) Subject: possible workaround for go_print bug X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9d5e7081aa44cea3632aa04f12362d7714907e96;p=Evergreen.git possible workaround for go_print bug git-svn-id: svn://svn.open-ils.org/ILS/trunk@6932 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js index f292ba639d..184b01e40b 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/print.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js @@ -54,23 +54,17 @@ util.print.prototype = { var w; switch(content_type) { case 'text/html' : - var jsrc = 'data:text/javascript,' + window.escape('var params = { "data" : ' + js2JSON(params.data) + ', "list" : ' + js2JSON(params.list) + '}; function my_init() { if (typeof go_print == "function") { go_print(); } else { alert("Please inform the developers that the go_print bug occurred. After this alert, we will try to print again."); window.print(); } /* FIXME - mozilla bug#301560 - xpcom kills it too */ if (' + (typeof params.modal != 'undefined' ? 'true' : 'false') + ') setTimeout(function(){ try { window.print(); window.close(); } catch(E) { alert(E); } },0); }'); + var jsrc = 'data:text/javascript,' + window.escape('var params = { "data" : ' + js2JSON(params.data) + ', "list" : ' + js2JSON(params.list) + '}; function my_init() { if (typeof go_print == "function") { go_print(); } else { setTimeout( function() { if (typeof go_print == "function") { alert("Please tell the developers that the 2-second go_print workaround executed, and let them know whether this job printed successfully. Thanks!"); go_print(); } else { alert("Please tell the developers that the 2-second go_print workaround did not work. We will try to print one more time; there have been reports of wasted receipt paper at this point. Please check the settings in the print dialog and/or prepare to power off your printer. Thanks!"); window.print(); } }, 2000 ); } /* FIXME - mozilla bug#301560 - xpcom kills it too */ }'); w = obj.win.open('data:text/html,' + window.escape(msg) + '','receipt_temp','chrome,resizable'); w.minimize(); w.go_print = function() { - - //setTimeout( - // function() { - try { - obj.NSPrint(w, silent, params); - } catch(E) { - obj.error.standard_unexpected_error_alert("Print Error in util.print.simple. After this dialog we'll try a second print attempt. content_type = " + content_type,E); - w.print(); - } - w.minimize(); w.close(); - // }, 0 - //); - + try { + obj.NSPrint(w, silent, params); + } catch(E) { + obj.error.standard_unexpected_error_alert("Print Error in util.print.simple. After this dialog we'll try a second print attempt. content_type = " + content_type,E); + w.print(); + } + w.minimize(); w.close(); } break; default: