From: phasefx Date: Fri, 10 Sep 2010 20:15:41 +0000 (+0000) Subject: merge r17588-r17592 from trunk for patron refunds and misc tweaks X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=737d4b7ab4cb103ab584a1099db64f333a561021;p=contrib%2FConifer.git merge r17588-r17592 from trunk for patron refunds and misc tweaks git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_0@17594 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- 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 5c970e2560..ba789c859d 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 d31f882a91..0805014a17 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, @@ -95,7 +101,7 @@ function event_listeners() { function(ev) { if ($('payment_type').value == 'credit_payment') { JSAN.use('util.money'); - JSAN.use('patron.util'); g.patron = patron.util.retrieve_au_via_id(ses(),g.patron_id); + JSAN.use('patron.util'); g.patron = patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id,null); var proposed = util.money.dollars_float_to_cents_integer(ev.target.value); var available = util.money.dollars_float_to_cents_integer(g.patron.credit_forward_balance()); if (proposed > available) { @@ -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); }, @@ -647,8 +681,9 @@ function print_bills() { try { var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current'; JSAN.use('patron.util'); + g.patron = patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id,null); var params = { - 'patron' : patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id,null), + 'patron' : g.patron, 'printer_context' : 'receipt', 'template' : template }; @@ -899,7 +934,7 @@ function void_all_billings(mobts_id) { function refresh_patron() { JSAN.use('patron.util'); JSAN.use('util.money'); - patron.util.retrieve_au_via_id(ses(),g.patron_id, function(req) { + patron.util.retrieve_fleshed_au_via_id(ses(),g.patron_id,null,function(req) { var au_obj = req.getResultObject(); if (typeof au_obj.ilsevent == 'undefined') { g.patron = au_obj; diff --git a/Open-ILS/xul/staff_client/server/patron/bill_details.js b/Open-ILS/xul/staff_client/server/patron/bill_details.js index 05c2c6e295..8ad14be4b9 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill_details.js +++ b/Open-ILS/xul/staff_client/server/patron/bill_details.js @@ -5,7 +5,7 @@ function retrieve_patron() { if (g.patron_id) { JSAN.use('patron.util'); - g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id ); + g.au_obj = patron.util.retrieve_fleshed_au_via_id( ses(), g.patron_id, null ); $('patron_name').setAttribute('value', patron.util.format_name( g.au_obj ) + ' : ' + g.au_obj.card().barcode() diff --git a/Open-ILS/xul/staff_client/server/patron/util.js b/Open-ILS/xul/staff_client/server/patron/util.js index 638e384396..0f235efb45 100644 --- a/Open-ILS/xul/staff_client/server/patron/util.js +++ b/Open-ILS/xul/staff_client/server/patron/util.js @@ -599,7 +599,7 @@ patron.util.retrieve_fleshed_au_via_id = function(session, id, fields, func) { typeof func == 'function' ? func : null ); if (typeof func != 'function') { - patron.util.set_penalty_css(patron_obj); + if (!fields) { patron.util.set_penalty_css(patron_obj); } return patron_obj; } } @@ -619,34 +619,34 @@ var TIME = { minute : 60, hour : 60*60, day : 60*60*24, year : 60*60*24*365 }; patron.util.set_penalty_css = function(patron) { try { - removeCSSClass(document.documentElement,'PATRON_HAS_BILLS'); - removeCSSClass(document.documentElement,'PATRON_HAS_OVERDUES'); - removeCSSClass(document.documentElement,'PATRON_HAS_NOTES'); - removeCSSClass(document.documentElement,'PATRON_EXCEEDS_CHECKOUT_COUNT'); - removeCSSClass(document.documentElement,'PATRON_EXCEEDS_OVERDUE_COUNT'); - removeCSSClass(document.documentElement,'PATRON_EXCEEDS_FINES'); - removeCSSClass(document.documentElement,'NO_PENALTIES'); - removeCSSClass(document.documentElement,'ONE_PENALTY'); - removeCSSClass(document.documentElement,'MULTIPLE_PENALTIES'); - removeCSSClass(document.documentElement,'PATRON_HAS_ALERT'); - removeCSSClass(document.documentElement,'PATRON_BARRED'); - removeCSSClass(document.documentElement,'PATRON_INACTIVE'); - removeCSSClass(document.documentElement,'PATRON_EXPIRED'); - removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB'); - removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS'); - removeCSSClass(document.documentElement,'PATRON_AGE_GE_65'); - removeCSSClass(document.documentElement,'PATRON_AGE_LT_65'); - removeCSSClass(document.documentElement,'PATRON_AGE_GE_24'); - removeCSSClass(document.documentElement,'PATRON_AGE_LT_24'); - removeCSSClass(document.documentElement,'PATRON_AGE_GE_21'); - removeCSSClass(document.documentElement,'PATRON_AGE_LT_21'); - removeCSSClass(document.documentElement,'PATRON_AGE_GE_18'); - removeCSSClass(document.documentElement,'PATRON_AGE_LT_18'); - removeCSSClass(document.documentElement,'PATRON_AGE_GE_13'); - removeCSSClass(document.documentElement,'PATRON_AGE_LT_13'); - removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_1'); - removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_2'); - removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3'); + removeCSSClass(document.documentElement,'PATRON_HAS_BILLS'); + removeCSSClass(document.documentElement,'PATRON_HAS_OVERDUES'); + removeCSSClass(document.documentElement,'PATRON_HAS_NOTES'); + removeCSSClass(document.documentElement,'PATRON_EXCEEDS_CHECKOUT_COUNT'); + removeCSSClass(document.documentElement,'PATRON_EXCEEDS_OVERDUE_COUNT'); + removeCSSClass(document.documentElement,'PATRON_EXCEEDS_FINES'); + removeCSSClass(document.documentElement,'NO_PENALTIES'); + removeCSSClass(document.documentElement,'ONE_PENALTY'); + removeCSSClass(document.documentElement,'MULTIPLE_PENALTIES'); + removeCSSClass(document.documentElement,'PATRON_HAS_ALERT'); + removeCSSClass(document.documentElement,'PATRON_BARRED'); + removeCSSClass(document.documentElement,'PATRON_INACTIVE'); + removeCSSClass(document.documentElement,'PATRON_EXPIRED'); + removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_DOB'); + removeCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS'); + removeCSSClass(document.documentElement,'PATRON_AGE_GE_65'); + removeCSSClass(document.documentElement,'PATRON_AGE_LT_65'); + removeCSSClass(document.documentElement,'PATRON_AGE_GE_24'); + removeCSSClass(document.documentElement,'PATRON_AGE_LT_24'); + removeCSSClass(document.documentElement,'PATRON_AGE_GE_21'); + removeCSSClass(document.documentElement,'PATRON_AGE_LT_21'); + removeCSSClass(document.documentElement,'PATRON_AGE_GE_18'); + removeCSSClass(document.documentElement,'PATRON_AGE_LT_18'); + removeCSSClass(document.documentElement,'PATRON_AGE_GE_13'); + removeCSSClass(document.documentElement,'PATRON_AGE_LT_13'); + removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_1'); + removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_2'); + removeCSSClass(document.documentElement,'PATRON_NET_ACCESS_3'); JSAN.use('util.network'); var net = new util.network(); net.simple_request('FM_MOUS_RETRIEVE.authoritative',[ ses(), patron.id() ], function(req) { @@ -672,6 +672,7 @@ patron.util.set_penalty_css = function(patron) { */ var penalties = patron.standing_penalties(); + if (!penalties) { penalties = []; } for (var i = 0; i < penalties.length; i++) { /* this comes from /opac/common/js/utils.js */ addCSSClass(document.documentElement,penalties[i].standing_penalty().name()); @@ -743,12 +744,12 @@ patron.util.set_penalty_css = function(patron) { if ( get_bool( patron.juvenile() ) ) addCSSClass(document.documentElement,'PATRON_JUVENILE'); else removeCSSClass(document.documentElement,'PATRON_JUVENILE'); - if (patron.mailing_address()) { + if (patron.mailing_address() && typeof patron.mailing_address() == 'object') { if (!get_bool(patron.mailing_address().valid())) { addCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS'); } } - if (patron.billing_address()) { + if (patron.billing_address() && typeof patron.billing_address() == 'object') { if (!get_bool(patron.billing_address().valid())) { addCSSClass(document.documentElement,'PATRON_HAS_INVALID_ADDRESS'); }