You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2011/11/28 12:40:08 UTC

svn commit: r1207091 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java

Author: adrianc
Date: Mon Nov 28 11:40:07 2011
New Revision: 1207091

URL: http://svn.apache.org/viewvc?rev=1207091&view=rev
Log:
Fixed a bug where some SECA services were assuming an optional OrderHeader field was always non-null.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java?rev=1207091&r1=1207090&r2=1207091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java Mon Nov 28 11:40:07 2011
@@ -211,6 +211,10 @@ public class RequirementServices {
         try {
             GenericValue order = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
             GenericValue productStore = order.getRelatedOneCache("ProductStore");
+            if (productStore == null) {
+                Debug.logInfo("ProductStore for order ID " + orderId + " not found, requirements not created", module);
+                return ServiceUtil.returnSuccess();
+            }
             String facilityId = productStore.getString("inventoryFacilityId");
             List<GenericValue> orderItems = order.getRelated("OrderItem");
             for (Iterator<GenericValue> iter = orderItems.iterator(); iter.hasNext();) {
@@ -267,6 +271,10 @@ public class RequirementServices {
         try {
             GenericValue order = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
             GenericValue productStore = order.getRelatedOneCache("ProductStore");
+            if (productStore == null) {
+                Debug.logInfo("ProductStore for order ID " + orderId + " not found, ATP requirements not created", module);
+                return ServiceUtil.returnSuccess();
+            }
             String facilityId = productStore.getString("inventoryFacilityId");
             List<GenericValue> orderItems = order.getRelated("OrderItem");
             for (Iterator<GenericValue> iter = orderItems.iterator(); iter.hasNext();) {