From: dbwells Date: Wed, 9 Mar 2011 17:10:31 +0000 (+0000) Subject: Fix LP bug #727432, "overpaying with patron credit can generate a double credit" X-Git-Tag: kcls-grey-screen-prod1~2^2~13 X-Git-Url: http://git.equinoxoli.org/?p=evergreen-equinox.git;a=commitdiff_plain;h=32734af187cbd11b3b8b2520c766ff8de02cb173 Fix LP bug #727432, "overpaying with patron credit can generate a double credit" git-svn-id: svn://svn.open-ils.org/ILS/trunk@19649 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/patron/bill2.js b/Open-ILS/xul/staff_client/server/patron/bill2.js index 0be012d..67252b1 100644 --- a/Open-ILS/xul/staff_client/server/patron/bill2.js +++ b/Open-ILS/xul/staff_client/server/patron/bill2.js @@ -769,7 +769,21 @@ function apply_payment() { payment_blob.payment_type = $('payment_type').value; var tally_blob = tally_pending(); payment_blob.payments = tally_blob.payments; - payment_blob.patron_credit = $('convert_change_to_credit').checked ? tally_blob.change : '0.00'; + // Handle patron credit + if ( payment_blob.payment_type == 'credit_payment' ) { // paying with patron credit + if ( $('convert_change_to_credit').checked ) { + // No need to convert credit into credit, handled automatically + payment_blob.patron_credit = '0.00'; + } else { + // Cashing out extra credit as change + payment_blob.patron_credit = 0 - tally_blob.change; + } + } else if ( $('convert_change_to_credit').checked ) { + // Saving change from a non-credit payment as patron credit on server + payment_blob.patron_credit = tally_blob.change; + } else { + payment_blob.patron_credit = '0.00'; + } if ( payment_blob.payments.length == 0 && payment_blob.patron_credit == '0.00' ) { alert($("patronStrings").getString('staff.patron.bills.apply_payment.nothing_applied')); return;