[OFBiz] SVN: r6908 - trunk/applications/accounting/src/org/ofbiz/accounting/invoice
sichen@svn.ofbiz.org
sichen at svn.ofbiz.org
Fri Mar 3 12:32:54 CST 2006
Author: sichen
Date: 2006-03-03 12:32:51 -0600 (Fri, 03 Mar 2006)
New Revision: 6908
Modified:
trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
Log:
Fixed divide by zero bug: a weird case where a return could have zero value, say if the customer returned a promotional item with amount bash after adjustments.
Modified: trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
===================================================================
--- trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java 2006-03-03 18:05:23 UTC (rev 6907)
+++ trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java 2006-03-03 18:32:51 UTC (rev 6908)
@@ -1005,8 +1005,11 @@
}
}
- // ratio of the invoice total to the promised total so far
- BigDecimal actualToPromisedRatio = invoiceTotal.divide(promisedTotal, decimals, rounding);
+ // ratio of the invoice total to the promised total so far or zero if the amounts were zero
+ BigDecimal actualToPromisedRatio = ZERO;
+ if (invoiceTotal.signum() != 0) {
+ invoiceTotal = invoiceTotal.divide(promisedTotal, decimals, rounding);
+ }
// loop through return-wide adjustments and create invoice items for each
List adjustments = returnHeader.getRelatedByAndCache("ReturnAdjustment", UtilMisc.toMap("returnItemSeqId", "_NA_"));
More information about the Svn
mailing list