From a554ceb96221336aefaf78f7335d50380f971920 Mon Sep 17 00:00:00 2001 From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Wed, 30 Dec 2009 18:46:15 +0000 Subject: [PATCH] Item Details action in billing interfaces, and some cleanup using attribute-forwarding on <command> elements git-svn-id: svn://svn.open-ils.org/ILS/trunk@15250 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/server/patron/bill2.js | 26 +++++++++++++++- Open-ILS/xul/staff_client/server/patron/bill2.xul | 33 +++++++++++--------- .../xul/staff_client/server/patron/bill_history.js | 36 ++++++++++++++++++++++ .../staff_client/server/patron/bill_history.xul | 2 ++ 4 files changed, 81 insertions(+), 16 deletions(-) diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index 77659e4f1c..7ef3f58f35 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -96,6 +96,12 @@ function event_listeners() { false ); + $('copy_details').addEventListener( + 'command', + handle_copy_details, + false + ); + $('payment').addEventListener( 'change', function(ev) { @@ -154,7 +160,8 @@ function event_listeners() { {}, { 'patron_id' : g.patron_id, - 'refresh' : function() { refresh(); } + 'refresh' : function() { refresh(); }, + 'new_tab' : xulG.new_tab } ); }, @@ -444,6 +451,7 @@ function init_lists() { $('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_opac() { } } +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++) { diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.xul b/Open-ILS/xul/staff_client/server/patron/bill2.xul index d8667c69c1..d7b4e86d9d 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill2.xul @@ -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> diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.js b/Open-ILS/xul/staff_client/server/patron/bill_history.js index 3f4837a246..da351ae59d 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.js +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.js @@ -138,6 +138,7 @@ function init_main_list() { ); 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 @@ function init_payments_list() { ); 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 @@ function my_init() { 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_details(which_list) { }; } +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'; diff --git a/Open-ILS/xul/staff_client/server/patron/bill_history.xul b/Open-ILS/xul/staff_client/server/patron/bill_history.xul index 9ab7d9a29f..128ce1d27d 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_history.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill_history.xul @@ -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> -- 2.11.0