svn commit: r981699 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

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

svn commit: r981699 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

doogie-3
Author: doogie
Date: Mon Aug  2 22:33:00 2010
New Revision: 981699

URL: http://svn.apache.org/viewvc?rev=981699&view=rev
Log:
When loading an order into a cart, handle per-item tax adjustments
correctly, by storing them in CartShipItemInfo, instead of the
ShoppingCartItem.

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

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=981699&r1=981698&r2=981699&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java Mon Aug  2 22:33:00 2010
@@ -539,6 +539,9 @@ public class ShoppingCartServices {
                 List<GenericValue> itemAdjustments = orh.getOrderItemAdjustments(item);
                 if (itemAdjustments != null) {
                     for(GenericValue itemAdjustment : itemAdjustments) {
+                        if ("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId"))) {
+                            continue;
+                        }
                         cartItem.addAdjustment(itemAdjustment);
                     }
                 }
@@ -549,6 +552,7 @@ public class ShoppingCartServices {
                 int itemIndex = 0;
                 for (GenericValue item : orderItems) {
 
+                    List<GenericValue> orderItemAdjustments = orh.getOrderItemAdjustments(item);
                     // set the item's ship group info
                     List<GenericValue> shipGroupAssocs = orh.getOrderItemShipGroupAssocs(item);
                     for (int g = 0; g < shipGroupAssocs.size(); g++) {
@@ -567,6 +571,16 @@ public class ShoppingCartServices {
                         }
 
                         cart.setItemShipGroupQty(itemIndex, shipGroupQty, cartShipGroupIndex);
+
+                        List<GenericValue> shipGroupItemAdjustments = EntityUtil.filterByAnd(orderItemAdjustments, UtilMisc.toMap("shipGroupSeqId", cartShipGroupIndexStr));
+                        ShoppingCart.CartShipInfo csi = cart.getShipInfo(cartShipGroupIndex);
+                        List itemTaxAdj = csi.getShipItemInfo(cart.findCartItem(itemIndex)).itemTaxAdj;
+                        for(GenericValue shipGroupItemAdjustment : shipGroupItemAdjustments) {
+                            if ("SALES_TAX".equals(shipGroupItemAdjustment.get("orderAdjustmentTypeId"))) {
+                                itemTaxAdj.add(shipGroupItemAdjustment);
+                                continue;
+                            }
+                        }
                     }
                     itemIndex ++;
                 }