[open-ils-commits] r19651 - branches/rel_2_0/Open-ILS/xul/staff_client/server/patron (dbwells)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 9 12:11:00 EST 2011


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

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


Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/bill2.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/bill2.js	2011-03-09 17:10:47 UTC (rev 19650)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/patron/bill2.js	2011-03-09 17:10:57 UTC (rev 19651)
@@ -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