Hello Scott, Thanks for your comment. I have reverted my changes in r882880.
Will try to avoid such issues in future. -- Ashish On Sat, Nov 21, 2009 at 2:26 PM, Scott Gray <scott.g...@hotwaxmedia.com>wrote: > Hi Ashish > > This commit breaks the build, please fix it and always at the absolute > minimum ensure that the release branch compiles before committing any > changes. Ideally everyone would also first confirm that a bug exists in the > branch and also that the changes fix it before committing. > > Thanks > Scott > > HotWax Media > http://www.hotwaxmedia.com > > > On 20/11/2009, at 10:04 PM, ash...@apache.org wrote: > > Author: ashish >> Date: Fri Nov 20 09:04:46 2009 >> New Revision: 882456 >> >> URL: http://svn.apache.org/viewvc?rev=882456&view=rev >> Log: >> Applied fix from trunk revision: 882454. >> Applied patch from jira issue OFBIZ-3208 - On order view page when >> clicking on "Create As New Order", the adjustments Shipping and Handling and >> Sales Tax are duplicated. >> >> Patch will resolve the following Issues >> >> 1) Shipping and Handling Charges are added twice in new order amount. >> 2) Sales Tax are added twice in new order amount. >> 3) Add extra tax on shipping and handling charges for new order. >> 4) When click on "Create as New Order" Link, it is Giving NPE on some >> Promotion (Happy Hour >> Promotion 9020). >> 5) Click on "Edit Items" Link and then "Update" Link it is it is Giving >> NPE on some Promotion (Happy >> Hour Promotion 9020). >> >> Thanks Arpit for the contribution. >> >> Modified: >> >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java >> >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java >> >> Modified: >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=882456&r1=882455&r2=882456&view=diff >> >> ============================================================================== >> --- >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java >> (original) >> +++ >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java >> Fri Nov 20 09:04:46 2009 >> @@ -826,6 +826,7 @@ >> return null; >> } >> return (ShoppingCartItem) cartLines.get(index); >> + >> } >> >> public ShoppingCartItem findCartItem(String orderItemSeqId) { >> @@ -2009,7 +2010,10 @@ >> } >> >> public void setItemShipGroupQty(int itemIndex, BigDecimal quantity, int >> idx) { >> - this.setItemShipGroupQty(this.findCartItem(itemIndex), itemIndex, >> quantity, idx); >> + ShoppingCartItem itemIdx = this.findCartItem(itemIndex); >> + if(itemIdx != null) { >> + this.setItemShipGroupQty(itemIdx, itemIndex, quantity, idx); >> + } >> } >> >> public void setItemShipGroupQty(ShoppingCartItem item, BigDecimal >> quantity, int idx) { >> @@ -2026,16 +2030,19 @@ >> } >> >> // never set more than quantity ordered >> - if (quantity.compareTo(item.getQuantity()) > 0) { >> - quantity = item.getQuantity(); >> - } >> - >> - // re-set the ship group's before and after dates based on >> the item's >> - csi.resetShipBeforeDateIfAfter(item.getShipBeforeDate()); >> - csi.resetShipAfterDateIfBefore(item.getShipAfterDate()); >> - >> - CartShipInfo.CartShipItemInfo csii = csi.setItemInfo(item, >> quantity); >> - this.checkShipItemInfo(csi, csii); >> + if (item != null) { >> + if (quantity.compareTo(item.getQuantity()) > 0) { >> + quantity = item.getQuantity(); >> + } >> + >> + >> + // re-set the ship group's before and after dates based >> on the item's >> + csi.resetShipBeforeDateIfAfter(item.getShipBeforeDate()); >> + csi.resetShipAfterDateIfBefore(item.getShipAfterDate()); >> + >> + CartShipInfo.CartShipItemInfo csii = >> csi.setItemInfo(item, quantity); >> + this.checkShipItemInfo(csi, csii); >> + } >> } >> } >> >> >> Modified: >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java >> URL: >> http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=882456&r1=882455&r2=882456&view=diff >> >> ============================================================================== >> --- >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java >> (original) >> +++ >> ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java >> Fri Nov 20 09:04:46 2009 >> @@ -20,20 +20,21 @@ >> >> import java.math.BigDecimal; >> import java.math.MathContext; >> +import java.sql.Timestamp; >> import java.text.NumberFormat; >> +import java.util.ArrayList; >> import java.util.Iterator; >> import java.util.LinkedList; >> import java.util.List; >> import java.util.Locale; >> import java.util.Map; >> -import javolution.util.FastMap; >> -import java.sql.Timestamp; >> >> import javax.servlet.http.HttpServletRequest; >> import javax.servlet.http.HttpServletResponse; >> import javax.servlet.http.HttpSession; >> >> import javolution.util.FastList; >> +import javolution.util.FastMap; >> >> import org.ofbiz.base.util.Debug; >> import org.ofbiz.base.util.UtilDateTime; >> @@ -1288,6 +1289,7 @@ >> LocalDispatcher dispatcher = (LocalDispatcher) >> request.getAttribute("dispatcher"); >> HttpSession session = request.getSession(); >> GenericValue userLogin = >> (GenericValue)session.getAttribute("userLogin"); >> + Delegator delegator = (Delegator) >> request.getAttribute("delegator"); >> >> String quoteId = request.getParameter("orderId"); >> >> @@ -1303,7 +1305,49 @@ >> } >> >> cart = (ShoppingCart) outMap.get("shoppingCart"); >> - >> + >> + cart.removeAdjustmentByType("SALES_TAX"); >> + cart.removeAdjustmentByType("PROMOTION_ADJUSTMENT"); >> + String shipGroupSeqId = null; >> + long groupIndex = cart.getShipInfoSize(); >> + List orderAdjustmentList = new ArrayList(); >> + List orderAdjustments = new ArrayList(); >> + orderAdjustments = cart.getAdjustments(); >> + try { >> + orderAdjustmentList = >> delegator.findList("OrderAdjustment", >> EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId), >> null, null, null, false); >> + } catch (Exception e) { >> + Debug.logError(e, module); >> + } >> + for (long itr = 1; itr <= groupIndex; itr++) { >> + shipGroupSeqId = UtilFormatOut.formatPaddedNumber(1, 5); >> + List<GenericValue> duplicateAdjustmentList = new >> ArrayList<GenericValue>(); >> + for (GenericValue adjustment: >> (List<GenericValue>)orderAdjustmentList) { >> + if >> ("PROMOTION_ADJUSTMENT".equals(adjustment.get("orderAdjustmentTypeId"))) { >> + cart.addAdjustment(adjustment); >> + } >> + if >> ("SALES_TAX".equals(adjustment.get("orderAdjustmentTypeId"))) { >> + if (adjustment.get("description") != null >> + && >> ((String)adjustment.get("description")).startsWith("Tax adjustment due")) { >> + cart.addAdjustment(adjustment); >> + } >> + if ( adjustment.get("comments") != null >> + && >> ((String)adjustment.get("comments")).startsWith("Added manually by")) { >> + cart.addAdjustment(adjustment); >> + } >> + } >> + } >> + for (GenericValue orderAdjustment: >> (List<GenericValue>)orderAdjustments) { >> + if >> ("OrderAdjustment".equals(orderAdjustment.getEntityName())) { >> + if >> (("SHIPPING_CHARGES".equals(orderAdjustment.get("orderAdjustmentTypeId"))) >> && >> + >> orderAdjustment.get("orderId").equals(orderId) && >> + >> orderAdjustment.get("shipGroupSeqId").equals(shipGroupSeqId) && >> orderAdjustment.get("comments") == null) { >> + // Removing objects from list for old >> Shipping and Handling Charges Adjustment and Sales Tax Adjustment. >> + duplicateAdjustmentList.add(orderAdjustment); >> + } >> + } >> + } >> + orderAdjustments.removeAll(duplicateAdjustmentList); >> + } >> } catch (GenericServiceException exc) { >> request.setAttribute("_ERROR_MESSAGE_", exc.getMessage()); >> return "error"; >> >> >> >