From aea64166101a7684365e3e63d0e363037981a0ee Mon Sep 17 00:00:00 2001 From: phasefx Date: Fri, 10 Sep 2010 20:12:49 +0000 Subject: [PATCH] enable the Refund action in the new billing interface git-svn-id: svn://svn.open-ils.org/ILS/trunk@17592 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../server/locale/en-US/patron.properties | 6 ++++ Open-ILS/xul/staff_client/server/patron/bill2.js | 34 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties index 5c970e256..ba789c859 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/patron.properties @@ -42,6 +42,12 @@ staff.patron.bill_history.handle_void.title=Void All Billings staff.patron.bill_history.handle_void.btn_yes=Yes staff.patron.bill_history.handle_void.btn_no=No staff.patron.bill_history.handle_void.confirm_message=Check here to confirm this message +staff.patron.bills.handle_refund.message_plural=Are you sure you would like to refund excess payment on bills %1$s? This action will simply put the amount in the Payment Pending column as a negative value. You must still select Apply Payment! Certain types of payments may not be refunded. The refund may be applied to checked transactions that follow the refunded transaction. +staff.patron.bills.handle_refund.message_singular=Are you sure you would like to refund excess payment on bill %1$s? This action will simply put the amount in the Payment Pending column as a negative value. You must still select Apply Payment! Certain types of payments may not be refunded. The refund may be applied to checked transactions that follow the refunded transaction. +staff.patron.bills.handle_refund.title=Refund Excess Payment +staff.patron.bills.handle_refund.btn_yes=Yes +staff.patron.bills.handle_refund.btn_no=No +staff.patron.bills.handle_refund.confirm_message=Check here to confirm this message staff.patron.bill_history.print_bills.print_error=printing bills staff.patron.bill_history.column.xact_type.label=Transaction Type staff.patron.bill_history.column.last_billing_type.label=Last Billing Type diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index c91e5cc0d..0805014a1 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -78,6 +78,12 @@ function event_listeners() { false ); + $('refund').addEventListener( + 'command', + handle_refund, + false + ); + $('opac').addEventListener( 'command', handle_opac, @@ -319,6 +325,33 @@ function tally_all() { } } +function handle_refund() { + if(g.bill_list_selection.length > 1) { + var msg = $("patronStrings").getFormattedString('staff.patron.bills.handle_refund.message_plural', [g.bill_list_selection]); + } else { + var msg = $("patronStrings").getFormattedString('staff.patron.bills.handle_refund.message_singular', [g.bill_list_selection]); + } + + var r = g.error.yns_alert(msg, + $("patronStrings").getString('staff.patron.bills.handle_refund.title'), + $("patronStrings").getString('staff.patron.bills.handle_refund.btn_yes'), + $("patronStrings").getString('staff.patron.bills.handle_refund.btn_no'),null, + $("patronStrings").getString('staff.patron.bills.handle_refund.confirm_message')); + if (r == 0) { + for (var i = 0; i < g.bill_list_selection.length; i++) { + var bill_id = g.bill_list_selection[i]; + //alert('g.check_map['+bill_id+'] = '+g.check_map[bill_id]+' bill_map['+bill_id+'] = ' + js2JSON(g.bill_map[bill_id])); + g.check_map[bill_id] = true; + var row_params = g.row_map[bill_id]; + row_params.row.my.checked = true; + g.bill_list.refresh_row(row_params); + } + } + tally_all(); + distribute_payment(); +} + + function check_all() { try { for (var i in g.bill_map) { @@ -438,6 +471,7 @@ function init_lists() { $('details').setAttribute('disabled', g.bill_list_selection.length == 0); $('add').setAttribute('disabled', g.bill_list_selection.length == 0); $('voidall').setAttribute('disabled', g.bill_list_selection.length == 0); + $('refund').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); }, -- 2.11.0