Author: akashjain
Date: Sat Jun 23 11:01:23 2018 New Revision: 1834190 URL: http://svn.apache.org/viewvc?rev=1834190&view=rev Log: Improved: Enable drop-ship PO feature at product store and product facility level as well, applied patch from jira issue with slightly changes. (OFBIZ-9987) Thanks, Ankit Joshi for your contribution. Modified: ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/product-entitymodel.xml ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Modified: ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/product-entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/product-entitymodel.xml?rev=1834190&r1=1834189&r2=1834190&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/product-entitymodel.xml (original) +++ ofbiz/ofbiz-framework/trunk/applications/datamodel/entitydef/product-entitymodel.xml Sat Jun 23 11:01:23 2018 @@ -1414,6 +1414,7 @@ under the License. <field name="reorderQuantity" type="fixed-point"></field> <field name="daysToShip" type="numeric"></field> <field name="lastInventoryCount" type="fixed-point"><description>This field represents availableToPromiseTotal of a product at a certain point of time and is being updated regularly by a schedule service every hour</description></field> + <field name="requirementMethodEnumId" type="id"></field> <prim-key field="productId"/> <prim-key field="facilityId"/> <relation type="one" fk-name="PROD_FAC_PROD" rel-entity-name="Product"> @@ -1422,6 +1423,9 @@ under the License. <relation type="one" fk-name="PROD_FAC_FAC" rel-entity-name="Facility"> <key-map field-name="facilityId"/> </relation> + <relation type="one" fk-name="PROD_FAC_ENUM" title="RequirementMethod" rel-entity-name="Enumeration"> + <key-map field-name="requirementMethodEnumId" rel-field-name="enumId"/> + </relation> </entity> <view-entity entity-name="ProductFacilityAndPostalAddress" package-name="org.apache.ofbiz.product.facility" Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1834190&r1=1834189&r2=1834190&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Sat Jun 23 11:01:23 2018 @@ -4205,10 +4205,12 @@ public class ShoppingCart implements Ite // Retrieve the facilityId from the cart's productStoreId because ShoppingCart.setFacilityId() doesn't seem to be used anywhere String facilityId = null; + String requirementMethodEnumId = null; if (UtilValidate.isNotEmpty(this.getProductStoreId())) { try { GenericValue productStore = this.getDelegator().findOne("ProductStore", UtilMisc.toMap("productStoreId", this.getProductStoreId()), true); facilityId = productStore.getString("inventoryFacilityId"); + requirementMethodEnumId = productStore.getString("requirementMethodEnumId"); } catch (GenericEntityException gee) { Debug.logError(UtilProperties.getMessage(resource_error,"OrderProblemGettingProductStoreRecords", locale) + gee.getMessage(), module); return; @@ -4248,7 +4250,22 @@ public class ShoppingCart implements Ite continue; } String productId = product.getString("productId"); - String requirementMethodEnumId = product.getString("requirementMethodEnumId"); + + GenericValue productFacility = null; + try { + productFacility = EntityQuery.use(delegator).from("ProductFacility").where("productId", productId, "facilityId", shipInfo.getFacilityId()).queryOne(); + } catch(GenericEntityException e) { + Debug.logError("Error :" +e.getMessage(), module); + e.printStackTrace(); + } + + if (productFacility != null && UtilValidate.isNotEmpty(productFacility.getString("requirementMethodEnumId"))){ + requirementMethodEnumId = productFacility.getString("requirementMethodEnumId"); + } + + if (UtilValidate.isNotEmpty(product.getString("requirementMethodEnumId"))) { + requirementMethodEnumId = product.getString("requirementMethodEnumId"); + } if ("PRODRQM_DS".equals(requirementMethodEnumId)) { |
Free forum by Nabble | Edit this page |