Author: ashish
Date: Fri Dec  4 06:27:07 2009
New Revision: 887083

URL: http://svn.apache.org/viewvc?rev=887083&view=rev
Log:
Applied patch from jira issue OFBIZ-3293 - Receiving Return for Manual Return 
Adjustment gives Service invocation error.

When you receive return for Manual Return Adjustment gives following error: 
org.ofbiz.webapp.event.EventHandlerException: Service invocation error (null)

Steps to regenerate error:
1. Create Return from Ordermgr > Return > New
2. Fill following information in the create Return form:

    * From Party Id : Customer's party Id
    * To Party Id : Company's PartyId

3. Click submit button.
4. Go to Return Item tab & select the order id from the dropdown and click on 
Load Order Item for Return.
5. Now in the Manual Return Adjustment section: Enter the details/reason for 
return, the amount & Select the return type "Store Credit"
6. Check the check box against Manual Return Adjustment fields and click 
"Return Selected Item" button.
7. Accept Return from Return Header screen or Return Item screen.
8. From The Return Header screen receive return.

Receive Return works fine if there is a product returned with the Manual Return 
Adjustment.

Thanks Akash for the contribution.

Modified:
    
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=887083&r1=887082&r2=887083&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
 (original)
+++ 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
 Fri Dec  4 06:27:07 2009
@@ -716,12 +716,17 @@
             // Fetch the ProductStore
             GenericValue productStore = null;
             GenericValue orderHeader = null;
-            GenericValue returnItem = EntityUtil.getFirst(returnItems);
+            GenericValue returnItem = null;
+            if (UtilValidate.isNotEmpty(returnItems)) {
+                returnItem = EntityUtil.getFirst(returnItems);
+            }
+            if (UtilValidate.isNotEmpty(returnItem)) {
             try {
                 orderHeader = returnItem.getRelatedOne("OrderHeader");
             } catch (GenericEntityException e) {
                 return ServiceUtil.returnError(e.getMessage());
             }
+            }
             if (orderHeader != null) {
                 OrderReadHelper orderReadHelper = new 
OrderReadHelper(orderHeader);
                 productStore = orderReadHelper.getProductStore();


Reply via email to