You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2011/03/17 17:36:58 UTC

svn commit: r1082582 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

Author: jaz
Date: Thu Mar 17 16:36:58 2011
New Revision: 1082582

URL: http://svn.apache.org/viewvc?rev=1082582&view=rev
Log:
changed return invoice mapping, now when the return type starts with CUSTOMER_ the custoemer return invoice type is used; allowing for custom return. If it does not start with CUSTOMER it falls back to PURCHASE return invoices as it has previously

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?rev=1082582&r1=1082581&r2=1082582&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Thu Mar 17 16:36:58 2011
@@ -1828,8 +1828,12 @@ public class InvoiceServices {
             String invoiceTypeId;
             String description;
             // get the return header
-            GenericValue returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId));
-            if ("CUSTOMER_RETURN".equals(returnHeader.getString("returnHeaderTypeId"))) {
+            GenericValue returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId));                                                  
+            if (returnHeader == null || returnHeader.get("returnHeaderTypeId") == null) {
+                return ServiceUtil.returnError("Return type cannot be null");                                                      
+            }
+            
+            if (returnHeader.getString("returnHeaderTypeId").startsWith("CUSTOMER_")) {
                 invoiceTypeId = "CUST_RTN_INVOICE";
                 description = "Return Invoice for Customer Return #" + returnId;
             } else {