From 4bcb3309ee6e29b12cd952067b5cd0932af7bd13 Mon Sep 17 00:00:00 2001 From: pines Date: Tue, 29 Aug 2006 02:31:17 +0000 Subject: [PATCH] convert Full Details to non-modal window (in order to workaround print bug) git-svn-id: svn://svn.open-ils.org/ILS/trunk@5750 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../server/patron/bill_details.xul | 48 +++++++++---------- .../server/patron/bill_history.xul | 13 ++--- .../xul/staff_client/server/patron/bills.js | 18 +++---- 3 files changed, 35 insertions(+), 44 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/bill_details.xul b/Open-ILS/xul/staff_client/server/patron/bill_details.xul index 18e5ff80ef..2e8c234ae2 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_details.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_details.xul @@ -203,7 +203,6 @@ JSAN.use('util.money'); JSAN.use('patron.util'); JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'}); - g.data.temp = ''; g.data.stash('temp'); g.error.sdump('D_TRACE','my_init() for bill_details.xul'); @@ -228,36 +227,37 @@ ); } catch(E) { - var err_msg = "!! This software has encountered an error. Please tell your friendly " + - "system administrator or software developer the following:\nbill_details.xul\n" + E + '\n'; - try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); } - alert(err_msg); + try { g.error.standard_unexpected_error_alert('bill_details.xul, my_init:',E); } catch(F) { alert(E); } } } function handle_void() { - JSAN.use('util.functional'); - var msg = 'Are you sure you would like to void bill' + ( g.bill_list_selection.length > 1 ? 's ' : ' ') + util.functional.map_list( g.bill_list_selection, function(o) { return g.mb_list[o].id(); }) + '?'; - var r = g.error.yns_alert(msg,'Voiding Bills','Yes','No',null,'Check here to confirm this message'); - if (r == 0) { - g.data.stash_retrieve(); - for (var i = 0; i < g.bill_list_selection.length; i++) { - var robj = g.network.simple_request('FM_MB_VOID',[ses(),g.mb_list[g.bill_list_selection[i]].id()]); - if (! g.data.voided_billings ) g.data.voided_billings = []; - if (robj.ilsevent) { - switch(robj.ilsevent) { - case -1 : g.error.standard_network_error_alert('Void of Bill #' + g.mb_list[g.bill_list_selection[i]].id() + ' failed.'); break; - default: g.error.standard_unexpected_error_alert('Void of Bill #' + g.mb_list[g.bill_list_selection[i]].id() + ' failed.',robj); break; + try { + JSAN.use('util.functional'); + var msg = 'Are you sure you would like to void bill' + ( g.bill_list_selection.length > 1 ? 's ' : ' ') + util.functional.map_list( g.bill_list_selection, function(o) { return g.mb_list[o].id(); }) + '?'; + var r = g.error.yns_alert(msg,'Voiding Bills','Yes','No',null,'Check here to confirm this message'); + if (r == 0) { + g.data.stash_retrieve(); + for (var i = 0; i < g.bill_list_selection.length; i++) { + var robj = g.network.simple_request('FM_MB_VOID',[ses(),g.mb_list[g.bill_list_selection[i]].id()]); + if (! g.data.voided_billings ) g.data.voided_billings = []; + if (robj.ilsevent) { + switch(robj.ilsevent) { + case -1 : g.error.standard_network_error_alert('Void of Bill #' + g.mb_list[g.bill_list_selection[i]].id() + ' failed.'); break; + default: g.error.standard_unexpected_error_alert('Void of Bill #' + g.mb_list[g.bill_list_selection[i]].id() + ' failed.',robj); break; + } + } else { + g.data.voided_billings.push( g.mb_list[g.bill_list_selection[i]] ); + g.data.stash('voided_billings'); } - } else { - g.data.voided_billings.push( g.mb_list[g.bill_list_selection[i]] ); - g.data.stash('voided_billings'); } + retrieve_mbts(); + g.bill_list.clear(); + retrieve_mb(); + if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') { window.xulG.refresh(); } } - retrieve_mbts(); - g.bill_list.clear(); - retrieve_mb(); - g.data.temp = 'refresh'; g.data.stash('temp'); + } catch(E) { + try { g.error.standard_unexpected_error_alert('bill_details.xul, handle_void:',E); } catch(F) { alert(E); } } } diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.xul b/Open-ILS/xul/staff_client/server/patron/bill_history.xul index 4c24b1b3c2..5af9edade3 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.xul @@ -266,27 +266,24 @@ ); g.bill_list.clear(); retrieve_mbts_for_list(); - //g.data.temp = 'refresh'; g.data.stash('temp'); if (typeof window.refresh == 'function') window.refresh(); if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh(); } } function handle_details() { - JSAN.use('util.window'); var w = new util.window(); - w.open( + JSAN.use('util.window'); var win = new util.window(); + var w = win.open( urls.XUL_PATRON_BILL_DETAILS + '?patron_id=' + window.escape(g.patron_id) + '&mbts_id=' + window.escape( g.bill_list_selection[0] ), 'test_billdetails', - 'modal,chrome,resizable' + 'chrome,resizable' ); - //g.data.temp = 'refresh'; g.data.stash('temp'); - g.data.stash_retrieve(); - if (g.data.temp == 'refresh') { + w.xulG = { 'refresh' : function() { if (typeof window.refresh == 'function') window.refresh(); if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh(); - } + } }; } function print_bills() { diff --git a/Open-ILS/xul/staff_client/server/patron/bills.js b/Open-ILS/xul/staff_client/server/patron/bills.js index 51725d3df9..fb0e781ad9 100644 --- a/Open-ILS/xul/staff_client/server/patron/bills.js +++ b/Open-ILS/xul/staff_client/server/patron/bills.js @@ -180,8 +180,7 @@ patron.bills.prototype = { 'chrome,resizable' ); w.xulG = { 'refresh' : function() { obj.refresh(); } }; - //obj.OpenILS.data.init({'via':'stash'}); if (obj.OpenILS.data.temp == 'refresh') { obj.refresh(); } - w.refresh = function() { obj.refresh(); }; + //w.refresh = function() { obj.refresh(); }; } catch(E) { obj.error.standard_unexpected_error_alert('bills -> cmd_bill_history',E); } @@ -202,8 +201,7 @@ patron.bills.prototype = { 'chrome,resizable' ); w.xulG = { 'refresh' : function() { obj.refresh(); } }; - //obj.OpenILS.data.init({'via':'stash'}); if (obj.OpenILS.data.temp == 'refresh') { obj.refresh(); } - w.refresh = function() { obj.refresh(); }; + //w.refresh = function() { obj.refresh(); }; } catch(E) { obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E); } @@ -854,19 +852,15 @@ patron.bills.prototype = { btn.addEventListener( 'command', function(ev) { - JSAN.use('util.window'); var w = new util.window(); - w.open( + JSAN.use('util.window'); var win = new util.window(); + var w = win.open( urls.XUL_PATRON_BILL_DETAILS + '?patron_id=' + window.escape(obj.patron_id) + '&mbts_id=' + window.escape(my.mobts.id()), 'test' + my.mobts.id(), - 'modal,chrome,resizable' + 'chrome,resizable' ); - obj.OpenILS.data.init({'via':'stash'}); - if (obj.OpenILS.data.temp == 'refresh') { - obj.refresh(); - } - + w.xulG = { 'refresh' : function() { obj.refresh(); } }; }, false ); -- 2.43.2