Author: surajk
Date: Sat May 25 06:12:37 2019
New Revision: 1859909

URL: http://svn.apache.org/viewvc?rev=1859909&view=rev
Log:
Fixed: Drop-ship process behaves incorrectly when a combination of drop-ship 
and non-drop-ship products are added into the cart.
(OFBIZ-11021)
RequirementMethodEnumId should be decided in the order of property set at 
ProductStore -> Facility -> Product for each order item which was not working 
if the non-drop shippable product(s) is added after the drop shippable 
product(s).

Original Flow: requirementMethodEnumId was initialized outside the loop and 
once it is initialized with Product level information it never gets 
re-initialized if Product is non-drop shippable.
We have updated the code to use the storeRequirementMethodEnumId variable for 
store level information which is defined outside the loop and this will be used 
to initialize requirementMethodEnumId for each order item and then product 
level information can override it. That means for each product ProductStore -> 
Facility -> Product this rule will work properly.

Thanks Pawan Verma for reporting the issue and providing the patch and Jacques 
Le Roux for review.

Modified:
    
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java

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=1859909&r1=1859908&r2=1859909&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 May 25 06:12:37 2019
@@ -4235,12 +4235,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;
+        String storeRequirementMethodEnumId = 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");
+                storeRequirementMethodEnumId = 
productStore.getString("requirementMethodEnumId");
             } catch (GenericEntityException gee) {
                 
Debug.logError(UtilProperties.getMessage(resource_error,"OrderProblemGettingProductStoreRecords",
 locale) + gee.getMessage(), module);
                 return;
@@ -4288,7 +4288,9 @@ public class ShoppingCart implements Ite
                     Debug.logError("Error :" +e.getMessage(), module);
                     e.printStackTrace();
                 }
-                
+
+                String requirementMethodEnumId = storeRequirementMethodEnumId;
+
                 if (productFacility != null && 
UtilValidate.isNotEmpty(productFacility.getString("requirementMethodEnumId"))){
                     requirementMethodEnumId = 
productFacility.getString("requirementMethodEnumId");
                 }


Reply via email to