svn commit: r1042188 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

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

svn commit: r1042188 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

jleroux@apache.org
Author: jleroux
Date: Sat Dec  4 14:19:07 2010
New Revision: 1042188

URL: http://svn.apache.org/viewvc?rev=1042188&view=rev
Log:
A suggested change by Patrick Antivackis "Shopping Cart Item issue with BigDecimal " (https://issues.apache.org/jira/browse/OFBIZ-4038) - OFBIZ-4038

In applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
the setQuantity method should use this.quantity.compareTo(quantity) == 0 instead of this.quantity==quantity like depicted below

   protected void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup, boolean updateProductPrice, boolean skipInventoryChecks) throws CartItemModifyException {
       if (this.quantity == quantity) {            return;        }

The issue is really visible when the cart is fully loaded (lot of products) as the return will never occur and the store is configurerd in an autosavecart mode.

For example a cart with 48 products will take very long time to process for each additem or modifycart event.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1042188&r1=1042187&r2=1042188&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Sat Dec  4 14:19:07 2010
@@ -986,7 +986,7 @@ public class ShoppingCartItem implements
     }
 
     protected void setQuantity(BigDecimal quantity, LocalDispatcher dispatcher, ShoppingCart cart, boolean triggerExternalOps, boolean resetShipGroup, boolean updateProductPrice, boolean skipInventoryChecks) throws CartItemModifyException {
-        if (this.quantity == quantity) {
+        if (this.quantity.compareTo(quantity) == 0) {
             return;
         }