Author: jleroux
Date: Sat Mar 27 08:11:35 2010
New Revision: 928166
URL:
http://svn.apache.org/viewvc?rev=928166&view=revLog:
Use safe navigation rather than if(value) to avoid confusion in case of value=0.
From Scott's advice on dev ML, after a 1st remark on style by Adam
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=928166&r1=928165&r2=928166&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 Sat Mar 27 08:11:35 2010
@@ -68,19 +68,13 @@ List getPayments(List payments, boolean
if (actual) {
paymentMap.amount = payment.actualCurrencyAmount;
paymentMap.currencyUomId = payment.actualCurrencyUomId;
- paymentToApply = payment.getBigDecimal("actualCurrencyAmount");
- if (paymentToApply) {
- paymentToApply = paymentToApply.setScale(decimals,rounding).subtract(paymentApplied);
- }
+ paymentToApply = payment.getBigDecimal("actualCurrencyAmount")?.setScale(decimals,rounding).subtract(paymentApplied);
} else {
paymentMap.amount = payment.amount;
paymentMap.currencyUomId = payment.currencyUomId;
- paymentToApply = payment.getBigDecimal("amount");
- if (paymentToApply) {
- paymentToApply = paymentToApply.setScale(decimals,rounding).subtract(paymentApplied);
- }
+ paymentToApply = payment.getBigDecimal("amount")?.setScale(decimals,rounding).subtract(paymentApplied);
}
- if (paymentToApply && paymentToApply.signum() == 1) {
+ if (paymentToApply.signum() == 1) {
paymentMap.paymentId = payment.paymentId;
paymentMap.effectiveDate = payment.effectiveDate;
if (paymentToApply.compareTo(invoiceToApply) < 0 ) {