From d905fd597b424cf0d53cc7e2a82775570281b09c Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 11 Nov 2013 09:16:03 -0500 Subject: [PATCH] LP#1479107 adjust to zero UI New "Adjust to Zero" option in patron billing UI. Selected transactions are updated to have a zero balance by rebilling and/or adding adjustments as required. Signed-off-by: Dan Wells Signed-off-by: Kathy Lussier Signed-off-by: Jason Stephenson --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../staff_client/chrome/content/main/constants.js | 3 +- .../server/locale/en-US/patron.properties | 9 +++- Open-ILS/xul/staff_client/server/patron/bill2.js | 49 ++++++++++++++++++++++ Open-ILS/xul/staff_client/server/patron/bill2.xul | 2 + 5 files changed, 63 insertions(+), 2 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 92f0ec5fcc..a820074568 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -3323,6 +3323,8 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index d435afb51b..e17a89742f 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -370,7 +370,8 @@ var api = { 'USER_ORG_UNIT_OPT_IN_FEATURE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.enabled' }, 'USER_ORG_UNIT_OPT_IN_CHECK' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.check' }, 'USER_ORG_UNIT_OPT_IN_CREATE' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.user.org_unit_opt_in.create' }, - 'GET_BARCODES' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.get_barcodes' } + 'GET_BARCODES' : { 'app' : 'open-ils.actor', 'method' : 'open-ils.actor.get_barcodes' }, + 'ADJUST_BILLS_TO_ZERO' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.money.billable_xact.adjust_to_zero' } } var urls = { 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 f7d7d5fb9b..401f19df23 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 @@ -48,7 +48,14 @@ staff.patron.bills.handle_refund.message_singular=Are you sure you would like to 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.bills.handle_adjust_to_zero.confirm_message=Check here to confirm this message +staff.patron.bills.handle_adjust_to_zero.message_plural=Are you sure you would like to adjust to zero the balance on bills %1$s? +staff.patron.bills.handle_adjust_to_zero.message_singular=Are you sure you would like to adjust to zero the balance on bill %1$s? +staff.patron.bills.handle_adjust_to_zero.title=Adjust to Zero +staff.patron.bills.handle_adjust_to_zero.btn_yes=Yes +staff.patron.bills.handle_adjust_to_zero.btn_no=No + 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 8a248f3c90..3db87f9ae5 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -108,6 +108,12 @@ function event_listeners() { false ); + window.bill_event_listeners.add($('adjust_to_zero'), + 'command', + handle_adjust_to_zero, + false + ); + window.bill_event_listeners.add($('opac'), 'command', handle_opac, @@ -382,6 +388,48 @@ function handle_refund() { distribute_payment(); } +/** + * Calls open-ils.circ.money.billable_xact.adjust_to_zero on selected + * transactions to produce a zero-balance transaction. + * Successfully cleared transactions will disappear from the billing list. + */ +function handle_adjust_to_zero() { + + var msgkey = g.bill_list_selection.length > 1 ? + 'staff.patron.bills.handle_adjust_to_zero.message_plural' : + 'staff.patron.bills.handle_adjust_to_zero.message_singular'; + + var msg = $("patronStrings").getFormattedString( + msgkey, [g.bill_list_selection]); + + var r = g.error.yns_alert(msg, + $("patronStrings").getString( + 'staff.patron.bills.handle_adjust_to_zero.title'), + $("patronStrings").getString( + 'staff.patron.bills.handle_adjust_to_zero.btn_yes'), + $("patronStrings").getString( + 'staff.patron.bills.handle_adjust_to_zero.btn_no'),null, + $("patronStrings").getString( + 'staff.patron.bills.handle_adjust_to_zero.confirm_message')); + + if (r == 0) { + var xact_ids = []; + for (var i = 0; i < g.bill_list_selection.length; i++) { + var bill_id = g.bill_list_selection[i]; + xact_ids.push(bill_id); + } + + var mod_ids = g.network.simple_request( + 'ADJUST_BILLS_TO_ZERO', [ses(), xact_ids]); + + g.error.sdump('D_DEBUG', 'adjusted to zero transactions ' + mod_ids); + + refresh(); + tally_all(); + distribute_payment(); + } +} + function check_all() { try { @@ -524,6 +572,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); + $('adjust_to_zero').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); diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.xul b/Open-ILS/xul/staff_client/server/patron/bill2.xul index 2889b7b353..6fbd90d507 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.xul +++ b/Open-ILS/xul/staff_client/server/patron/bill2.xul @@ -41,6 +41,7 @@ + @@ -51,6 +52,7 @@ + -- 2.11.0