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

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

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

ashish-18
Author: ashish
Date: Thu Mar 25 08:45:47 2010
New Revision: 927306

URL: http://svn.apache.org/viewvc?rev=927306&view=rev
Log:
Based on Scott's comment reverting my previous commit done at r927276 also improving condition in this commit.

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=927306&r1=927305&r2=927306&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 Thu Mar 25 08:45:47 2010
@@ -215,23 +215,23 @@ public class RequirementServices {
                 GenericValue item = (GenericValue) iter.next();
                 GenericValue product = item.getRelatedOne("Product");
                 if (product == null) continue;
-                if ("PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId")) || "PRODRQM_AUTO".equals(product.get("requirementMethodEnumId"))) {
-                    BigDecimal quantity = item.getBigDecimal("quantity");
-                    BigDecimal cancelQuantity = item.getBigDecimal("cancelQuantity");
-                    BigDecimal required = quantity.subtract(cancelQuantity == null ? BigDecimal.ZERO : cancelQuantity);
-                    if (required.compareTo(BigDecimal.ZERO) <= 0) continue;
-    
-                    Map input = UtilMisc.toMap("userLogin", userLogin, "facilityId", facilityId, "productId", product.get("productId"), "quantity", required, "requirementTypeId", "PRODUCT_REQUIREMENT");
-                    Map results = dispatcher.runSync("createRequirement", input);
-                    if (ServiceUtil.isError(results)) return results;
-                    String requirementId = (String) results.get("requirementId");
-    
-                    input = UtilMisc.toMap("userLogin", userLogin, "orderId", order.get("orderId"), "orderItemSeqId", item.get("orderItemSeqId"), "requirementId", requirementId, "quantity", required);
-                    results = dispatcher.runSync("createOrderRequirementCommitment", input);
-                    if (ServiceUtil.isError(results)) return results;
-                } else if (! "PRODRQM_AUTO".equals(product.get("requirementMethodEnumId"))) {
-                    continue;
-                }
+                if ((!"PRODRQM_AUTO".equals(product.get("requirementMethodEnumId")) &&
+                        !"PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId"))) ||
+                        (product.get("requirementMethodEnumId") == null &&
+                           !"PRODRQM_AUTO".equals(productStore.get("requirementMethodEnumId")))) continue;                
+                BigDecimal quantity = item.getBigDecimal("quantity");
+                BigDecimal cancelQuantity = item.getBigDecimal("cancelQuantity");
+                BigDecimal required = quantity.subtract(cancelQuantity == null ? BigDecimal.ZERO : cancelQuantity);
+                if (required.compareTo(BigDecimal.ZERO) <= 0) continue;
+
+                Map input = UtilMisc.toMap("userLogin", userLogin, "facilityId", facilityId, "productId", product.get("productId"), "quantity", required, "requirementTypeId", "PRODUCT_REQUIREMENT");
+                Map results = dispatcher.runSync("createRequirement", input);
+                if (ServiceUtil.isError(results)) return results;
+                String requirementId = (String) results.get("requirementId");
+
+                input = UtilMisc.toMap("userLogin", userLogin, "orderId", order.get("orderId"), "orderItemSeqId", item.get("orderItemSeqId"), "requirementId", requirementId, "quantity", required);
+                results = dispatcher.runSync("createOrderRequirementCommitment", input);
+                if (ServiceUtil.isError(results)) return results;
             }
         } catch (GenericEntityException e) {
             Debug.logError(e, module);