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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Dec 30 13:46:19 EST 2009


Author: phasefx
Date: 2009-12-30 13:46:15 -0500 (Wed, 30 Dec 2009)
New Revision: 15250

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js
   trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul
Log:
Item Details action in billing interfaces, and some cleanup using attribute-forwarding on <command> elements

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-12-30 17:09:22 UTC (rev 15249)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2009-12-30 18:46:15 UTC (rev 15250)
@@ -96,6 +96,12 @@
             false
         );
 
+        $('copy_details').addEventListener(
+            'command',
+            handle_copy_details,
+            false
+        );
+
         $('payment').addEventListener(
             'change',
             function(ev) {
@@ -154,7 +160,8 @@
                     {},
                     {
                         'patron_id' : g.patron_id,
-                        'refresh' : function() { refresh(); }
+                        'refresh' : function() { refresh(); },
+                        'new_tab' : xulG.new_tab
                     }
                 );
             },
@@ -444,6 +451,7 @@
             $('add').setAttribute('disabled', g.bill_list_selection.length == 0);
             $('voidall').setAttribute('disabled', g.bill_list_selection.length == 0);
             $('opac').setAttribute('disabled', g.bill_list_selection.length == 0);
+            $('copy_details').setAttribute('disabled', g.bill_list_selection.length == 0);
         },
         'on_click' : function(ev) {
             netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead');
@@ -610,6 +618,22 @@
     }
 }
 
+function handle_copy_details() {
+    try {
+        var ids = [];
+        for (var i = 0; i < g.bill_list_selection.length; i++) {
+            var my_acp = g.bill_map[ g.bill_list_selection[i] ].copy;
+            if (typeof my_acp != 'undefined' && my_acp != null) {
+                ids.push( my_acp.barcode() );
+            }
+        }
+        JSAN.use('circ.util');
+        circ.util.item_details_new( ids );
+    } catch(E) {
+        alert('Error in bill2.js, handle_opac: ' + E);
+    }
+}
+
 function handle_details() {
     JSAN.use('util.window'); var win = new util.window();
     for (var i = 0; i < g.bill_list_selection.length; i++) {

Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul	2009-12-30 17:09:22 UTC (rev 15249)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.xul	2009-12-30 18:46:15 UTC (rev 15250)
@@ -36,20 +36,22 @@
     <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties"/>
 
     <commandset>
-        <command id="opac" disabled="true"/>
-        <command id="voidall" disabled="true"/>
-        <command id="refund" disabled="true"/>
-        <command id="add" disabled="true"/>
-        <command id="details" disabled="true"/>
+        <command id="opac" label="&staff.patron.bill_interface.show_in_catalog.label;" accesskey="&staff.patron.bill_interface.show_in_catalog.accesskey;" disabled="true"/>
+        <command id="copy_details" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" disabled="true"/>
+        <command id="voidall" label="&staff.patron.bill_interface.void_all_billings.label;" accesskey="&staff.patron.bill_interface.void_all_billings.accesskey;" disabled="true"/>
+        <command id="refund" label="&staff.patron.bill_interface.refund.label;" accesskey="&staff.patron.bill_interface.refund.accesskey;" disabled="true"/>
+        <command id="add" label="&staff.patron.bill_interface.add_billing.label;" accesskey="&staff.patron.bill_interface.add_billing.accesskey;" disabled="true"/>
+        <command id="details" label="&staff.patron.bill_interface.full_details.label;" accesskey="&staff.patron.bill_interface.full_details.accesskey;" disabled="true"/>
     </commandset>
 
     <popupset>
         <popup id="actions_popup">
-            <menuitem command="opac" label="&staff.patron.bill_interface.show_in_catalog.label;" accesskey="&staff.patron.bill_interface.show_in_catalog.accesskey;" oncommand="alert('Not Yet Implemented');"/>
-            <menuitem command="voidall" label="&staff.patron.bill_interface.void_all_billings.label;" accesskey="&staff.patron.bill_interface.void_all_billings.accesskey;" />
-            <menuitem command="refund" label="&staff.patron.bill_interface.refund.label;" accesskey="&staff.patron.bill_interface.refund.accesskey;" />
-            <menuitem command="add" label="&staff.patron.bill_interface.add_billing.label;" accesskey="&staff.patron.bill_interface.add_billing.accesskey;" />
-            <menuitem command="details" label="&staff.patron.bill_interface.full_details.label;" accesskey="&staff.patron.bill_interface.full_details.accesskey;"/>
+            <menuitem command="opac" />
+            <menuitem command="copy_details" />
+            <menuitem command="voidall" />
+            <menuitem command="refund" />
+            <menuitem command="add" />
+            <menuitem command="details" />
         </popup>
     </popupset>
 
@@ -126,11 +128,12 @@
                     <menubar>
                         <menu label="&staff.patron.bill_interface.actions.label;" accesskey="&staff.patron.bill_interface.actions.accesskey;">
                             <menupopup>
-                                <menuitem command="opac" label="&staff.patron.bill_interface.show_in_catalog.label;" accesskey="&staff.patron.bill_interface.show_in_catalog.accesskey;" oncommand="alert('Not Yet Implemented');"/>
-                                <menuitem command="voidall" label="&staff.patron.bill_interface.void_all_billings.label;" accesskey="&staff.patron.bill_interface.void_all_billings.accesskey;" />
-                                <menuitem command="refund" label="&staff.patron.bill_interface.refund.label;" accesskey="&staff.patron.bill_interface.refund.accesskey;" />
-                                <menuitem command="add" label="&staff.patron.bill_interface.add_billing.label;" accesskey="&staff.patron.bill_interface.add_billing.accesskey;" />
-                                <menuitem command="details" label="&staff.patron.bill_interface.full_details.label;" accesskey="&staff.patron.bill_interface.full_details.accesskey;"/>
+                                <menuitem command="opac" />
+                                <menuitem command="copy_details" />
+                                <menuitem command="voidall" />
+                                <menuitem command="refund" />
+                                <menuitem command="add" />
+                                <menuitem command="details" />
                             </menupopup>
                         </menu>
                     </menubar>

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-30 17:09:22 UTC (rev 15249)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.js	2009-12-30 18:46:15 UTC (rev 15250)
@@ -138,6 +138,7 @@
             );
             tally_selected();
             $('details').disabled = g.bill_list_selection.length == 0;
+            $('copy_details').disabled = g.bill_list_selection.length == 0;
             $('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;
@@ -201,6 +202,7 @@
             );
             payments_tally_selected();
             $('payments_details').disabled = g.payments_list_selection.length == 0;
+            $('copy_details_from_payments').disabled = g.payments_list_selection.length == 0;
         },
         'retrieve_row' : function(params) {
             var id = params.retrieve_id;
@@ -263,6 +265,18 @@
             false
         );
 
+        $('copy_details').addEventListener(
+            'command',
+            gen_handle_copy_details('bills'),
+            false
+        );
+
+        $('copy_details_from_payments').addEventListener(
+            'command',
+            gen_handle_copy_details('payments'),
+            false
+        );
+
         $('add').addEventListener(
             'command',
             handle_add,
@@ -335,6 +349,28 @@
     };
 }
 
+function gen_handle_copy_details(which_list) {
+    return function() {
+        try {
+            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;
+            }
+            var ids = [];
+            for (var i = 0; i < selection.length; i++) {
+                var blob = g.network.simple_request('BLOB_MBTS_DETAILS_RETRIEVE',[ses(),selection[i]]);
+                if (blob.copy) { ids.push( blob.copy.barcode() ) }
+            }
+            JSAN.use('circ.util');
+            circ.util.item_details_new(ids);
+        } catch(E) {
+            alert('Error in bill_history.js, handle_copy_details(): ' + E);
+        }
+    };
+}
+
 function print_bills() {
     try {
         var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current';

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-30 17:09:22 UTC (rev 15249)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill_history.xul	2009-12-30 18:46:15 UTC (rev 15250)
@@ -89,6 +89,7 @@
                             <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();"/>
                             <button id="add" label="&staff.patron.bill_history.add_billing.label;" disabled="true"/>
+                            <button id="copy_details" disabled="true" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
                             <button id="details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/>
                         </hbox>
                     </tabpanel>
@@ -132,6 +133,7 @@
                         <hbox>
                             <hbox id="payments_list_actions" />
                             <spacer flex="1"/>
+                            <button id="copy_details_from_payments" disabled="true" label="&staff.patron.items_overlay.sel_copy_details.label;" accesskey="&staff.patron.items_overlay.sel_copy_details.accesskey;" />
                             <button id="payments_details" label="&staff.patron.bill_history.full_details.label;" disabled="true" accesskey="&staff.patron.bill_history.full_details.accesskey;"/>
                         </hbox>
                     </tabpanel>



More information about the open-ils-commits mailing list