svn commit: r927870 - /ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r927870 - /ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy

jleroux@apache.org
Author: jleroux
Date: Fri Mar 26 14:34:02 2010
New Revision: 927870

URL: http://svn.apache.org/viewvc?rev=927870&view=rev
Log:
Fix a NPE I got on actualCurrencyAmount while working with R9.04.
Since the files are identical I commit in trunk and will backport

Modified:
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy?rev=927870&r1=927869&r2=927870&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/actions/invoice/ListNotAppliedPayments.groovy Fri Mar 26 14:34:02 2010
@@ -68,13 +68,19 @@ List getPayments(List payments, boolean
             if (actual) {
                 paymentMap.amount = payment.actualCurrencyAmount;
                 paymentMap.currencyUomId = payment.actualCurrencyUomId;
-                paymentToApply = payment.getBigDecimal("actualCurrencyAmount").setScale(decimals,rounding).subtract(paymentApplied);
+                paymentToApply = payment.getBigDecimal("actualCurrencyAmount");
+                if (paymentToApply) {
+                    paymentToApply = paymentToApply.setScale(decimals,rounding).subtract(paymentApplied);
+                }
             } else {
                 paymentMap.amount = payment.amount;
                 paymentMap.currencyUomId = payment.currencyUomId;
-                paymentToApply = payment.getBigDecimal("amount").setScale(decimals,rounding).subtract(paymentApplied);
+                paymentToApply = payment.getBigDecimal("amount");
+                if (paymentToApply) {
+                    paymentToApply = paymentToApply.setScale(decimals,rounding).subtract(paymentApplied);
+                }
             }
-            if (paymentToApply.signum() == 1) {
+            if (paymentToApply && paymentToApply.signum() == 1) {
                 paymentMap.paymentId = payment.paymentId;
                 paymentMap.effectiveDate = payment.effectiveDate;
                 if (paymentToApply.compareTo(invoiceToApply) < 0 ) {