From: dbwells Date: Wed, 9 Mar 2011 17:10:47 +0000 (+0000) Subject: Fix LP bug #727432, "overpaying with patron credit can generate a double credit" X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9ef807b5debe920eb59fb2beebd0b66865eaa727;p=evergreen%2Ftadl.git Fix LP bug #727432, "overpaying with patron credit can generate a double credit" git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_2_1@19650 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 0be012d87c..67252b11e7 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;