[open-ils-commits] r14201 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Sep 29 09:25:15 EDT 2009


Author: phasefx
Date: 2009-09-29 09:25:14 -0400 (Tue, 29 Sep 2009)
New Revision: 14201

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
   trunk/Open-ILS/xul/staff_client/server/patron/bills.js
   trunk/Open-ILS/xul/staff_client/server/patron/display.js
Log:
Revamp the bill history interface and alternate view for current bills.  Embedded now instead of a dialog, with title columns, etc. instead of detail panes.  Needs some performance testing with lots of bills; may move to 
streaming methods if that's an issue.



Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-09-29 13:08:07 UTC (rev 14200)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2009-09-29 13:25:14 UTC (rev 14201)
@@ -2433,8 +2433,6 @@
 <!ENTITY staff.patron.bill_history.show_in_catalog.accesskey "S">
 <!ENTITY staff.patron.bill_history.print.label "Print">
 <!ENTITY staff.patron.bill_history.print.accesskey "P">
-<!ENTITY staff.patron.bill_history.close_window.label "Close Window">
-<!ENTITY staff.patron.bill_history.close_window.accesskey "c">
 <!ENTITY staff.patron.bills_overlay.still_checked_out.label "Red Items are still Checked Out">
 <!ENTITY staff.patron.bills_overlay.uncheck_all.label "Uncheck All">
 <!ENTITY staff.patron.bills_overlay.check_all.label "Check All">

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-09-29 13:08:07 UTC (rev 14200)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-09-29 13:25:14 UTC (rev 14201)
@@ -1,24 +1,5 @@
 function $(id) { return document.getElementById(id); }
 
-function retrieve_patron() {
-    g.patron_id = xul_param('patron_id');
-
-    if (g.patron_id) {
-        JSAN.use('patron.util'); 
-        g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id );
-        
-        $('patron_name').setAttribute('value', 
-            ( g.au_obj.prefix() ? g.au_obj.prefix() + ' ' : '') + 
-            g.au_obj.family_name() + ', ' + 
-            g.au_obj.first_given_name() + ' ' +
-            ( g.au_obj.second_given_name() ? g.au_obj.second_given_name() + ' ' : '' ) +
-            ( g.au_obj.suffix() ? g.au_obj.suffix() : '')
-            + ' : ' + g.au_obj.card().barcode() 
-        );
-    }
-
-}
-
 function retrieve_mbts_for_list() {
     //var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE';
     var method = 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY.authoritative';
@@ -33,7 +14,6 @@
         g.error.standard_unexpected_error_alert($("patronStrings").getString('staff.patron.bill_history.retrieve_mbts_for_list.close_win_try_again'),null);
     } else {
         //g.mbts_ids.reverse();
-        var funcs = [];
     
                 function gen_func(r) {
                     return function() {
@@ -63,103 +43,24 @@
     
         for (var i = 0; i < g.mbts_ids.length; i++) {
             dump('i = ' + i + ' g.mbts_ids[i] = ' + g.mbts_ids[i] + '\n');
-            funcs.push( gen_func(g.mbts_ids[i]) );
+            g.funcs.push( gen_func(g.mbts_ids[i]) );
         }
-        JSAN.use('util.exec'); var exec = new util.exec(4);
-        exec.on_error = function(E) { alert(E); return true; }
-        exec.chain(funcs);
     }
 }
 
-function retrieve_specific_mbts() {
-    if (g.mbts_id) g.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),g.mbts_id],
-        function(req) {
-            try {
-                g.mbts = req.getResultObject();
-                if (g.mbts.ilsevent) {
-                    switch(Number(g.mbts.ilsevent)) {
-                        case -1: g.error.standard_network_error_alert('mbts_id = ' + g.mbts_id); break;
-                        default: g.error.standard_unexpected_error_alert('mbts_id = ' + g.mbts_id,g.mbts); break;
-                    }
-                } else {
-                    $('mbts_id').value = g.mbts_id;
-                    $('mbts_xact_type').value = g.mbts.xact_type();
-                    $('mbts_xact_start').value = g.mbts.xact_start().toString().substr(0,19);
-                    $('mbts_xact_finish').value = g.mbts.xact_finish() ? g.mbts.xact_finish().toString().substr(0,19) : '';
-                    $('mbts_total_owed').value = g.mbts.total_owed() ? util.money.sanitize( g.mbts.total_owed() ) : '';
-                    $('mbts_total_paid').value = g.mbts.total_paid() ? util.money.sanitize( g.mbts.total_paid() ) : '';
-                    $('mbts_balance_owed').value = g.mbts.balance_owed() ? util.money.sanitize( g.mbts.balance_owed() ) : '';
-                }
-            } catch(E) {
-                g.error.sdump('D_ERROR',E);
-            }
-        }
-    );
-}
-
-function retrieve_circ() {
-    JSAN.use('util.widgets');
-    util.widgets.remove_children('title');
-    $('title_label').hidden = true;
-    $('checked_out_label').hidden = true;
-    $('due_label').hidden = true;
-    $('checked_in_label').hidden = true;
-    $('checked_out').value = '';
-    $('checked_in').value = '';
-    $('due').value = '';
-    $('copy_summary').hidden=true;
-
-    g.network.simple_request('FM_CIRC_RETRIEVE_VIA_ID', [ ses(), g.mbts_id ],
-        function (req) {
-            var r_circ = req.getResultObject();
-            if (instanceOf(r_circ,circ)) {
-
-                $('title_label').hidden = false;
-                $('checked_out_label').hidden = false;
-                $('due_label').hidden = false;
-                $('checked_in_label').hidden = false;
-                $('checked_out').value = r_circ.xact_start() ? r_circ.xact_start().toString().substr(0,10) : '';
-                $('checked_in').value = r_circ.checkin_time() ? r_circ.checkin_time().toString().substr(0,10) : '';
-                $('due').value = r_circ.due_date() ? r_circ.due_date().toString().substr(0,10) : '';
-
-                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
-                //get_contentWindow($('copy_summary')).xulG = { 'copy_id' : r_circ.target_copy() };
-                $('copy_summary').hidden=false;
-
-                g.network.simple_request(
-                    'MODS_SLIM_RECORD_RETRIEVE_VIA_COPY.authoritative',
-                    [ r_circ.target_copy() ],
-                    function (rreq) {
-                        var r_mvr = rreq.getResultObject();
-                        if (instanceOf(r_mvr,mvr)) {
-                            $('title').appendChild( document.createTextNode( String(r_mvr.title()).substr(0,50) ) );
-                        } else {
-                            g.network.simple_request(
-                                'FM_ACP_RETRIEVE',
-                                [ r_circ.target_copy() ],
-                                function (rrreq) {
-                                    var r_acp = rrreq.getResultObject();
-                                    if (instanceOf(r_acp,acp)) {
-                                        $('title').appendChild( document.createTextNode( r_acp.dummy_title() ) );
-                                    }
-                                }
-                            );
-                        }
-                    }
-                );
-
-            }
-        }
-    );
-}
-
 function init_lists() {
-    JSAN.use('util.list'); 
+    JSAN.use('util.list'); JSAN.use('circ.util'); 
     g.bill_list = new util.list('bill_tree');
 
     g.bill_list.init( {
-        'columns' : patron.util.mbts_columns({}),
+        'columns' : 
+            patron.util.mbts_columns({
+                'xact_finish' : { 'hidden' : xul_param('current') ? true : false }
+            }).concat( 
+            circ.util.columns({ 
+                'title' : { 'hidden' : false, 'flex' : '3' }
+            }) 
+        ),
         'map_row_to_columns' : patron.util.std_map_row_to_columns(' '),
         'on_select' : function(ev) {
             JSAN.use('util.functional');
@@ -171,27 +72,31 @@
             $('add').disabled = g.bill_list_selection.length == 0;
             $('summary').hidden = g.bill_list_selection.length == 0;
             $('copy_summary').hidden = g.bill_list_selection.length == 0;
-            g.mbts_id = g.bill_list_selection[0];
-            retrieve_specific_mbts();
-            retrieve_circ();
         },
         'retrieve_row' : function(params) {
             var id = params.retrieve_id;
             var row = params.row;
             if (id) {
                 if (typeof row.my == 'undefined') row.my = {};
-                if ( typeof row.my.mbts == 'undefined' ) {
-                    var mbts_obj = g.network.simple_request('FM_MBTS_RETRIEVE.authoritative',[ses(),id]);
-                    row.my.mbts = mbts_obj;
+                if (typeof row.my.mbts == 'undefined' ) {
+                    g.network.simple_request('BLOB_MBTS_DETAILS_RETRIEVE',[ses(),id], function(req) {
+                        var blob = req.getResultObject();
+                        row.my.mbts = blob.transaction;
+                        row.my.circ = blob.circ;
+                        row.my.acp = blob.copy;
+                        row.my.mvr = blob.record;
+                        if (typeof params.on_retrieve == 'function') {
+                            params.on_retrieve(row);
+                        }
+                    } );
                 }
             }
-            if (typeof params.on_retrieve == 'function') {
-                params.on_retrieve(row);
-            }
             return row;
         },
     } );
 
+    $('bill_list_actions').appendChild( g.bill_list.render_list_actions() );
+    g.bill_list.set_list_actions();
 }
 
 function my_init() {
@@ -211,8 +116,18 @@
 
         g.error.sdump('D_TRACE','my_init() for bill_history.xul');
 
-        retrieve_patron();
+        if (xul_param('current')) {
+            $('caption').setAttribute('label',$("patronStrings").getString('staff.patron.bill_history.my_init.current_bills'));
+            document.title = $("patronStrings").getString('staff.patron.bill_history.my_init.current_bills');
+        } else {
+            $('caption').setAttribute('label',$("patronStrings").getString('staff.patron.bill_history.my_init.bill_history'));
+            document.title = $("patronStrings").getString('staff.patron.bill_history.my_init.bill_history');
+        }
 
+        g.funcs = [];
+
+        g.patron_id = xul_param('patron_id');
+
         init_lists();
 
         retrieve_mbts_for_list();
@@ -229,14 +144,9 @@
             false
         );
 
-        if (xul_param('current')) {
-            $('caption').setAttribute('label',$("patronStrings").getString('staff.patron.bill_history.my_init.current_bills'));
-            document.title = $("patronStrings").getString('staff.patron.bill_history.my_init.current_bills');
-        } else {
-            $('caption').setAttribute('label',$("patronStrings").getString('staff.patron.bill_history.my_init.bill_history'));
-            document.title = $("patronStrings").getString('staff.patron.bill_history.my_init.bill_history');
-        }
-
+        JSAN.use('util.exec'); var exec = new util.exec(20); 
+        exec.on_error = function(E) { alert(E); return true; }
+        exec.timer(g.funcs,100);
     } catch(E) {
         var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/bill_history.xul', E]);
         try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-09-29 13:08:07 UTC (rev 14200)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-09-29 13:25:14 UTC (rev 14201)
@@ -18,7 +18,7 @@
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- OVERLAYS -->
 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
-<?xul-overlay href="/xul/server/patron/bill_summary_overlay.xul"?>
+<!--<?xul-overlay href="/xul/server/patron/bill_summary_overlay.xul"?>-->
 
 <window id="bill_history_win" width="700" height="550" oils_persist="sizemode width height"
 	onload="try{ my_init(); font_helper(); persist_helper(); } catch(E) { alert(E); }"
@@ -33,41 +33,22 @@
 	<script type="text/javascript" src="bill_history.js"/>
 
 	<messagecatalog id="patronStrings" src="/xul/server/locale/<!--#echo var='locale'-->/patron.properties"/>
+	<messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties"/>
 
 	<vbox flex="1" class="my_overflow">
-        <vbox id="v1" oils_persist="height" flex="1">
-    		<label id="patron_name" class="patronNameLarge"/>
-    		<groupbox orient="vertical" id="summary" hidden="true" flex="1"/>
-        </vbox>
-
-	    <splitter><grippy/></splitter>
-
-        <vbox id="v2" oils_persist="height" flex="1">
-       		<iframe id="copy_summary" hidden="true"/>
-        </vbox>
-
-		<splitter><grippy/></splitter>
-
-        <vbox id="v3" oils_persist="height" flex="3">
-            <groupbox orient="vertical" flex="1">
-                <caption id="caption" label="&staff.patron.bill_history.caption.label;"/>
-                <tree id="bill_tree" flex="1" enableColumnDrag="true" seltype="single"/>
-                <hbox>
-                    <spacer flex="1"/>
-                    <button id="add" label="&staff.patron.bill_history.add_billing.label;" disabled="true"/>
-                    <button id="details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/>
-                </hbox>
-            </groupbox>
-
-            <hbox flex="0">
+        <groupbox orient="vertical" flex="1">
+            <caption id="caption" label="&staff.patron.bill_history.caption.label;"/>
+            <tree id="bill_tree" flex="1" enableColumnDrag="true" seltype="single"/>
+            <hbox>
+                <hbox id="bill_list_actions" />
+                <spacer flex="1"/>
                 <button id="opac" label="&staff.patron.bill_history.show_in_catalog.label;" accesskey="&staff.patron.bill_history.show_in_catalog.accesskey;" hidden="true" oncommand="alert('Not Yet Implemented');"/>
                 <button id="print" label="&staff.patron.bill_history.print.label;" accesskey="&staff.patron.bill_history.print.accesskey;" hidden="false" oncommand="print_bills();"/>
-                <spacer flex="1"/>
-                <button label="&staff.patron.bill_history.close_window.label;" oncommand="window.close()" accesskey="&staff.patron.bill_history.close_window.accesskey;"/>
+                <button id="add" label="&staff.patron.bill_history.add_billing.label;" disabled="true"/>
+                <button id="details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/>
             </hbox>
-        </vbox>
+        </groupbox>
 	</vbox>
 
-
 </window>
 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bills.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bills.js	2009-09-29 13:08:07 UTC (rev 14200)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bills.js	2009-09-29 13:25:14 UTC (rev 14201)
@@ -183,15 +183,9 @@
 								['command'],
 								function() { 
 									try {
-										JSAN.use('util.window');
-										var win = new util.window();
-										//obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
-										var my_xulG = win.open(
+                                        xulG.display_window.g.patron.right_deck.reset_iframe( 
 											urls.XUL_PATRON_BILL_HISTORY,
-												//+ '?patron_id=' + window.escape(obj.patron_id),
-											'billhistory',
-											//'chrome,resizable,modal'
-											'chrome,resizable',
+											{},
 											{
 												'patron_id' : obj.patron_id,
 												'refresh' : function() { obj.refresh(); }
@@ -206,15 +200,9 @@
 								['command'],
 								function() { 
 									try {
-										JSAN.use('util.window');
-										var win = new util.window();
-										//obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
-										var my_xulG = win.open(
+                                        xulG.display_window.g.patron.right_deck.reset_iframe( 
 											urls.XUL_PATRON_BILL_HISTORY,
-												//+ '?current=1&patron_id=' + window.escape(obj.patron_id),
-											'billhistory',
-											//'chrome,resizable,modal'
-											'chrome,resizable',
+                                            {},
 											{
 												'current' : 1,
 												'patron_id' : obj.patron_id,

Modified: trunk/Open-ILS/xul/staff_client/server/patron/display.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/display.js	2009-09-29 13:08:07 UTC (rev 14200)
+++ trunk/Open-ILS/xul/staff_client/server/patron/display.js	2009-09-29 13:25:14 UTC (rev 14201)
@@ -435,13 +435,11 @@
 								//+ '?patron_id=' + window.escape( obj.patron.id() ),
 								{},
 								{
+                                    'display_window' : window,
 									'patron_id' : obj.patron.id(),
 									'url_prefix' : xulG.url_prefix,
 									'on_money_change' : function(b) {
-										//alert('test');
 										netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-										//obj.summary_window.g.summary.retrieve(true);
-										//obj.items_window.g.items.retrieve(true);
 										obj.refresh_all();
 									}
 								}



More information about the open-ils-commits mailing list