Hi Ashish, What will happen if I want to override the ProductStore setting using the Product setting? If the ProductStore is set to PRODRQM_AUTO and the product is set to something else then both requirements methods will be in effect.
It would be better to check something like this (pseudo-code): if (product.method != auto OR (product.method == null && productStore.method != auto)) continue; Regards Scott HotWax Media http://www.hotwaxmedia.com On 24/03/2010, at 11:47 PM, ash...@apache.org wrote: > Author: ashish > Date: Thu Mar 25 05:47:33 2010 > New Revision: 927276 > > URL: http://svn.apache.org/viewvc?rev=927276&view=rev > Log: > The code was not working if you set flag on ProductStore for Requirement enum > id. > I have put conditional check so that it will first check in product store and > then in product for the existence of requirementEnumId if found then it will > run the code in if block. Conditional if existed in past is transferred into > else block. > > 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=927276&r1=927275&r2=927276&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 05:47:33 2010 > @@ -215,21 +215,23 @@ public class RequirementServices { > GenericValue item = (GenericValue) iter.next(); > GenericValue product = item.getRelatedOne("Product"); > if (product == null) continue; > - if (! > "PRODRQM_AUTO".equals(product.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; > + 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; > + } > } > } catch (GenericEntityException e) { > Debug.logError(e, module); > >
smime.p7s
Description: S/MIME cryptographic signature