From 9b0cf345412baab86288800cbe02ca50b9b41ac4 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 14 Oct 2013 08:47:49 -0700 Subject: [PATCH] LP#1086458: invoke new 'refresh_checkout' event This implements using the new custom event rather than xulG.set_tab() to refresh a refresh of the checkout tab. It also removes use of a callback function to request the tab refresh in favor of a simple setTimeout(). Signed-off-by: Galen Charlton Signed-off-by: Mike Rylander --- .../xul/staff_client/server/circ/checkout.js | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/circ/checkout.js b/Open-ILS/xul/staff_client/server/circ/checkout.js index e8a7169afa..c8220b185f 100644 --- a/Open-ILS/xul/staff_client/server/circ/checkout.js +++ b/Open-ILS/xul/staff_client/server/circ/checkout.js @@ -233,21 +233,15 @@ circ.checkout.prototype = { var no_print_prompting = obj.data.hash.aous['circ.staff_client.do_not_auto_attempt_print']; if (no_print_prompting) { if (no_print_prompting.indexOf( "Checkout" ) > -1) { - obj.list.clear(); - xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{}); - return; + obj.refresh_checkout_tab(0); } } if (document.getElementById('checkout_auto').checked) { - obj.print(true,function() { - obj.list.clear(); - xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{}); - }); + obj.print(true); + obj.refresh_checkout_tab(1000); } else { - obj.print(false,function() { - obj.list.clear(); - xulG.set_tab(urls.XUL_PATRON_BARCODE_ENTRY,{},{}); - }); + obj.print(false); + obj.refresh_checkout_tab(1000); } } catch(E) { obj.error.standard_unexpected_error_alert('cmd_checkout_done',E); @@ -305,7 +299,15 @@ circ.checkout.prototype = { } }, - 'print' : function(silent,f) { + 'refresh_checkout_tab' : function(delay) { + setTimeout(function() { + var e = document.createEvent("Events"); + e.initEvent('refresh_checkout', true, false); + document.documentElement.dispatchEvent(e); + }, delay); + }, + + 'print' : function(silent) { var obj = this; try { obj.patron = obj.network.simple_request('FM_AU_FLESHED_RETRIEVE_VIA_ID',[ses(),obj.patron_id]); @@ -317,20 +319,7 @@ circ.checkout.prototype = { 'balance_owed' : util.money.sanitize( obj.most_recent_balance_owed ), }, 'printer_context' : 'receipt', - 'template' : 'checkout', - 'callback' : function() { - setTimeout( - function(){ - if (typeof f == 'function') { - setTimeout( - function() { - f(); - }, 1000 - ); - } - }, 1000 - ); - } + 'template' : 'checkout' }; if (silent) { params.no_prompt = true; } obj.list.print(params); -- 2.43.2