convert Full Details to non-modal window (in order to workaround print bug)
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 29 Aug 2006 02:31:17 +0000 (02:31 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 29 Aug 2006 02:31:17 +0000 (02:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5750 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/bill_details.xul
Open-ILS/xul/staff_client/server/patron/bill_history.xul
Open-ILS/xul/staff_client/server/patron/bills.js

index 18e5ff8..2e8c234 100644 (file)
                                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');
 
                                );
 
                        } 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); }
                        }
                }
 
index 4c24b1b..5af9eda 100644 (file)
                                );
                                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() {
index 51725d3..fb0e781 100644 (file)
@@ -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
                                                                );