[open-ils-commits] r19649 - trunk/Open-ILS/xul/staff_client/server/patron (dbwells)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 9 12:10:34 EST 2011


Author: dbwells
Date: 2011-03-09 12:10:31 -0500 (Wed, 09 Mar 2011)
New Revision: 19649

Modified:
   trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
Log:
Fix LP bug #727432, "overpaying with patron credit can generate a double credit"


Modified: trunk/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2011-03-08 22:01:37 UTC (rev 19648)
+++ trunk/Open-ILS/xul/staff_client/server/patron/bill2.js	2011-03-09 17:10:31 UTC (rev 19649)
@@ -769,7 +769,21 @@
         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;



More information about the open-ils-commits mailing list