svn commit: r571504 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r571504 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

hansbak-2
Author: hansbak
Date: Fri Aug 31 09:02:24 2007
New Revision: 571504

URL: http://svn.apache.org/viewvc?rev=571504&view=rev
Log:
correction for an error when editing a orderitem, reported by sumit and tested by sumit and Bilgin

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

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=571504&r1=571503&r2=571504&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Fri Aug 31 09:02:24 2007
@@ -1638,19 +1638,25 @@
     }
 
     public String getCurrentOrderItemWorkEffort(GenericValue orderItem)    {
-        String orderItemSeqId = orderItem.getString("orderItemSeqId");
-        String orderId = orderItem.getString("orderId");
-        GenericDelegator delegator = orderItem.getDelegator();
-        GenericValue workOrderItemFulFillment;
-        GenericValue workEffort;
-        try {
-            List workOrderItemFulFillments = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId));
-            workOrderItemFulFillment = EntityUtil.getFirst(workOrderItemFulFillments);
-            workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort");
-        } catch (GenericEntityException e) {
-            return null;
-        }
-        return workEffort.getString("workEffortId");
+     String orderItemSeqId = orderItem.getString("orderItemSeqId");
+     String orderId = orderItem.getString("orderId");
+     GenericDelegator delegator = orderItem.getDelegator();
+     GenericValue workOrderItemFulFillment = null;
+     GenericValue workEffort = null;
+     try {
+     List workOrderItemFulFillments = delegator.findByAndCache("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId));
+     if (!UtilValidate.isEmpty(workOrderItemFulFillments)) {
+     workOrderItemFulFillment = EntityUtil.getFirst(workOrderItemFulFillments);
+     workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort");
+     }
+     } catch (GenericEntityException e) {
+     return null;
+     }
+     if (workEffort != null) {
+     return workEffort.getString("workEffortId");
+     } else {
+     return null;
+     }
     }
 
     public String getCurrentItemStatus(GenericValue orderItem) {