[open-ils-commits] r14500 - trunk/Open-ILS/xul/staff_client/server/patron (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Oct 19 14:00:43 EDT 2009


Author: phasefx
Date: 2009-10-19 14:00:39 -0400 (Mon, 19 Oct 2009)
New Revision: 14500

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul
Log:
intermediate work, toward refund handling.  bug with row refresh

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-10-19 17:16:25 UTC (rev 14499)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-10-19 18:00:39 UTC (rev 14500)
@@ -87,6 +87,20 @@
     }
 }
 
+function check_all_refunds() {
+    try {
+        for (var i in g.bill_map) {
+            if ( Number( g.bill_map[i].transaction.balance_owed() ) < 0 ) {
+                var row_params = g.row_map[i];
+                //row_params.row.my.checked = true;
+                g.bill_list.refresh_row(row_params);
+            }
+        }
+    } catch(E) {
+        alert('Error in bill2.js, check_all_refunds(): ' + E);
+    }
+}
+
 function retrieve_mbts_for_list() {
     var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE.authoritative';
     g.mbts_ids = g.network.simple_request(method,[ses(),g.patron_id]);
@@ -184,32 +198,36 @@
             }
         },
         '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' ) {
-                    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') {
-                            if ( Number( row.my.mbts.balance_owed() ) < 0 ) {
-                                params.row_node.firstChild.setAttribute('properties','refundable');
-                                row.my.checked = false;
-                            }
-                            params.on_retrieve(row);
-                        };
-                        g.bill_map[ id ] = blob;
-                        g.check_map[ id ] = row.my.checked;
-                        tally_selected();
-                        tally_all();
-                    } );
+            try {
+                var id = params.retrieve_id;
+                var row = params.row;
+                if (id) {
+                    if (typeof row.my == 'undefined') row.my = {};
+                    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') {
+                                if ( Number( row.my.mbts.balance_owed() ) < 0 ) {
+                                    params.row_node.firstChild.setAttribute('properties','refundable');
+                                    row.my.checked = false;
+                                }
+                                params.on_retrieve(row);
+                            };
+                            g.bill_map[ id ] = blob;
+                            g.check_map[ id ] = row.my.checked;
+                            tally_selected();
+                            tally_all();
+                        } );
+                    }
                 }
+                return row;
+            } catch(E) {
+                alert('Error in bill2.js, retrieve_row(): ' + E);
             }
-            return row;
         }
     } );
 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul	2009-10-19 17:16:25 UTC (rev 14499)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul	2009-10-19 18:00:39 UTC (rev 14500)
@@ -136,6 +136,7 @@
                 <hbox id="bill_list_actions" />
                 <button label="Check All" oncommand="g.bill_list._toggle_checkbox_column({'id':'select'},'on');"/>
                 <button label="Uncheck All" oncommand="g.bill_list._toggle_checkbox_column({'id':'select'},'off');"/>
+                <button label="Check All Refunds" oncommand="check_all_refunds();"/>
                 <button id="print" label="Print Bills" oncommand="print_bills();"/>
                 <spacer flex="1"/>
                 <button label="Receipt Options" type="menu">



More information about the open-ils-commits mailing list