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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Dec 9 09:29:52 EST 2009


Author: phasefx
Date: 2009-12-09 09:29:50 -0500 (Wed, 09 Dec 2009)
New Revision: 15116

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
Log:
Full Details button for payment history interface

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-12-09 14:01:25 UTC (rev 15115)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-12-09 14:29:50 UTC (rev 15116)
@@ -147,8 +147,9 @@
             JSAN.use('util.functional');
             g.payments_list_selection = util.functional.map_list(
                 g.payments_list.retrieve_selection(),
-                function(o) { return o.getAttribute('retrieve_id'); }
+                function(o) { return JSON2js( o.getAttribute('retrieve_id') ); }
             );
+            $('payments_details').disabled = g.payments_list_selection.length == 0;
         },
         'retrieve_row' : function(params) {
             var id = params.retrieve_id;
@@ -199,10 +200,16 @@
 
         $('details').addEventListener(
             'command',
-            handle_details,
+            gen_handle_details('bills'),
             false
         );
 
+        $('payments_details').addEventListener(
+            'command',
+            gen_handle_details('payments'),
+            false
+        );
+
         $('add').addEventListener(
             'command',
             handle_add,
@@ -248,23 +255,31 @@
     }
 }
 
-function handle_details() {
-    JSAN.use('util.window'); var win = new util.window();
-    for (var i = 0; i < g.bill_list_selection.length; i++) {
-        var my_xulG = win.open(
-            urls.XUL_PATRON_BILL_DETAILS,
-            'test_billdetails_' + g.bill_list_selection[i],
-            'chrome,resizable',
-            {
-                'patron_id' : g.patron_id,
-                'mbts_id' : g.bill_list_selection[i],
-                'refresh' : function() { 
-                    if (typeof window.refresh == 'function') window.refresh();
-                    if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
-                }, 
-            }
-        );
-    }
+function gen_handle_details(which_list) {
+    return function() {
+        JSAN.use('util.functional');
+        var selection;
+        switch(which_list) {
+            case 'payments': selection = util.functional.map_list( g.payments_list_selection, function(o) { return o.xact; } ); break;
+            default: selection = g.bill_list_selection; break;
+        }
+        JSAN.use('util.window'); var win = new util.window();
+        for (var i = 0; i < selection.length; i++) {
+            var my_xulG = win.open(
+                urls.XUL_PATRON_BILL_DETAILS,
+                'test_billdetails_' + selection[i],
+                'chrome,resizable',
+                {
+                    'patron_id' : g.patron_id,
+                    'mbts_id' : selection[i],
+                    '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() {
@@ -300,7 +315,7 @@
                         if (result && typeof result.ilsevent == 'undefined') {
                             g.payments_list.append( 
                                 { 
-                                    'retrieve_id' : result.id(), 
+                                    'retrieve_id' : js2JSON( { 'id' : result.id(), 'xact' : result.xact() } ),
                                     'row' : { 
                                         'my' : { 
                                             'mp' : result 

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-12-09 14:01:25 UTC (rev 15115)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-12-09 14:29:50 UTC (rev 15116)
@@ -70,6 +70,8 @@
                         <tree id="payments_tree" flex="1" enableColumnDrag="true" seltype="multiple"/>
                         <hbox>
                             <hbox id="payments_list_actions" />
+                            <spacer flex="1"/>
+                            <button id="payments_details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/>
                         </hbox>
                     </tabpanel>
                 </tabpanels>



More information about the open-ils-commits mailing list