Author: sichen
Date: Fri Mar  2 18:23:48 2007
New Revision: 514056

URL: http://svn.apache.org/viewvc?view=rev&rev=514056
Log:
Avoid null return adjustment amounts when creating return invoices

Modified:
    
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

Modified: 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?view=diff&rev=514056&r1=514055&r2=514056
==============================================================================
--- 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
 (original)
+++ 
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
 Fri Mar  2 18:23:48 2007
@@ -1597,6 +1597,7 @@
             input.put("partyIdFrom", returnHeader.get("fromPartyId"));
             input.put("currencyUomId", returnHeader.get("currencyUomId"));
             input.put("invoiceDate", UtilDateTime.nowTimestamp());
+            input.put("description", "Return Invoice for Customer Return #" + 
returnId); 
             input.put("billingAccountId", 
returnHeader.get("billingAccountId"));
             input.put("userLogin", userLogin);
 
@@ -1675,6 +1676,11 @@
                 List adjustments = 
returnItem.getRelatedCache("ReturnAdjustment");
                 for (Iterator adjIter = adjustments.iterator(); 
adjIter.hasNext(); ) {
                     GenericValue adjustment = (GenericValue) adjIter.next();
+
+                    if (adjustment.get("amount") == null) {
+                         Debug.logWarning("Return adjustment [" + 
adjustment.get("returnAdjustmentId") + "] has null amount and will be skipped", 
module);
+                         continue;
+                    }
 
                     // determine invoice item type from the return item type
                     invoiceItemTypeId = getInvoiceItemType(delegator, 
adjustment.getString("returnAdjustmentTypeId"), null, "CUST_RTN_INVOICE", null);


Reply via email to