Author: lektran
Date: Mon Sep 17 01:36:08 2007 New Revision: 576302 URL: http://svn.apache.org/viewvc?rev=576302&view=rev Log: Removed the following deprecated double methods and renamed their BigDecimal equivalents: getAllOrderItemsAdjustmentsTotal calcItemAdjustments calcItemAdjustment getReturnAdjustmentTotal Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=576302&r1=576301&r2=576302&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Mon Sep 17 01:36:08 2007 @@ -1799,7 +1799,7 @@ returnedAmount = returnedAmount.add(returnedItem.getBigDecimal("returnPrice").multiply(returnedItem.getBigDecimal("returnQuantity"))).setScale(scale, rounding); } Map itemAdjustmentCondition = UtilMisc.toMap("returnId", returnedItem.get("returnId"), "returnItemSeqId", returnedItem.get("returnItemSeqId")); - returnedAmount = returnedAmount.add(getReturnAdjustmentTotalBd(orderHeader.getDelegator(), itemAdjustmentCondition)); + returnedAmount = returnedAmount.add(getReturnAdjustmentTotal(orderHeader.getDelegator(), itemAdjustmentCondition)); if(orderId.equals(returnedItem.getString("orderId")) && (!returnHeaderList.contains(returnedItem.getString("returnId")))) { returnHeaderList.add(returnedItem.getString("returnId")); } @@ -1809,7 +1809,7 @@ while(returnHeaderIterator.hasNext()) { String returnId = (String) returnHeaderIterator.next(); Map returnHeaderAdjFilter = UtilMisc.toMap("returnId", returnId, "returnItemSeqId", "_NA_"); - returnedAmount =returnedAmount.add(getReturnAdjustmentTotalBd(orderHeader.getDelegator(), returnHeaderAdjFilter)).setScale(scale, rounding); + returnedAmount =returnedAmount.add(getReturnAdjustmentTotal(orderHeader.getDelegator(), returnHeaderAdjFilter)).setScale(scale, rounding); } return returnedAmount.setScale(scale, rounding); } @@ -2145,7 +2145,7 @@ } public BigDecimal getOrderItemAdjustmentTotal(GenericValue orderItem, GenericValue adjustment) { - return calcItemAdjustmentBd(adjustment, orderItem); + return calcItemAdjustment(adjustment, orderItem); } public String getAdjustmentType(GenericValue adjustment) { @@ -2507,7 +2507,7 @@ return rentalAdjustment; // return total rental adjustment } - public static BigDecimal getAllOrderItemsAdjustmentsTotalBd(List orderItems, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) { + public static BigDecimal getAllOrderItemsAdjustmentsTotal(List orderItems, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) { BigDecimal result = ZERO; Iterator itemIter = UtilMisc.toIterator(orderItems); @@ -2517,11 +2517,6 @@ return result; } - /** @deprecated */ - public static double getAllOrderItemsAdjustmentsTotal(List orderItems, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) { - return getAllOrderItemsAdjustmentsTotalBd(orderItems, adjustments, includeOther, includeTax, includeShipping).doubleValue(); - } - /** The passed adjustments can be all adjustments for the order, ie for all line items */ public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping) { return getOrderItemAdjustmentsTotal(orderItem, adjustments, includeOther, includeTax, includeShipping, false, false); @@ -2529,7 +2524,7 @@ /** The passed adjustments can be all adjustments for the order, ie for all line items */ public static BigDecimal getOrderItemAdjustmentsTotal(GenericValue orderItem, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { - return calcItemAdjustmentsBd(getOrderItemQuantity(orderItem), orderItem.getBigDecimal("unitPrice"), + return calcItemAdjustments(getOrderItemQuantity(orderItem), orderItem.getBigDecimal("unitPrice"), getOrderItemAdjustmentList(orderItem, adjustments), includeOther, includeTax, includeShipping, forTax, forShipping); } @@ -2545,7 +2540,7 @@ // Order Item Adjs Utility Methods - public static BigDecimal calcItemAdjustmentsBd(BigDecimal quantity, BigDecimal unitPrice, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { + public static BigDecimal calcItemAdjustments(BigDecimal quantity, BigDecimal unitPrice, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { BigDecimal adjTotal = ZERO; if (adjustments != null && adjustments.size() > 0) { @@ -2555,7 +2550,7 @@ while (adjIt.hasNext()) { GenericValue orderAdjustment = (GenericValue) adjIt.next(); - adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustmentBd(orderAdjustment, quantity, unitPrice)); + adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustment(orderAdjustment, quantity, unitPrice)); } } return adjTotal; @@ -2577,21 +2572,11 @@ return adjTotal; } - /** @deprecated */ - public static double calcItemAdjustments(Double quantity, Double unitPrice, List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { - return calcItemAdjustmentsBd(new BigDecimal(quantity.doubleValue()), new BigDecimal(unitPrice.doubleValue()), adjustments, includeOther, includeTax, includeShipping, forTax, forShipping).doubleValue(); - } - - public static BigDecimal calcItemAdjustmentBd(GenericValue itemAdjustment, GenericValue item) { - return calcItemAdjustmentBd(itemAdjustment, getOrderItemQuantity(item), item.getBigDecimal("unitPrice")); - } - - /** @deprecated */ - public static double calcItemAdjustment(GenericValue itemAdjustment, GenericValue item) { - return calcItemAdjustmentBd(itemAdjustment, item).doubleValue(); + public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, GenericValue item) { + return calcItemAdjustment(itemAdjustment, getOrderItemQuantity(item), item.getBigDecimal("unitPrice")); } - public static BigDecimal calcItemAdjustmentBd(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice) { + public static BigDecimal calcItemAdjustment(GenericValue itemAdjustment, BigDecimal quantity, BigDecimal unitPrice) { BigDecimal adjustment = ZERO; if (itemAdjustment.get("amount") != null) { adjustment = adjustment.add(setScaleByType("SALES_TAX".equals(itemAdjustment.get("orderAdjustmentTypeId")), itemAdjustment.getBigDecimal("amount"))); @@ -2612,11 +2597,6 @@ return adjustmentRecurring.setScale(scale, rounding); } - /** @deprecated */ - public static double calcItemAdjustment(GenericValue itemAdjustment, Double quantity, Double unitPrice) { - return calcItemAdjustmentBd(itemAdjustment, new BigDecimal(quantity.doubleValue()), new BigDecimal(unitPrice.doubleValue())).doubleValue(); - } - public static List filterOrderAdjustments(List adjustments, boolean includeOther, boolean includeTax, boolean includeShipping, boolean forTax, boolean forShipping) { List newOrderAdjustmentsList = FastList.newInstance(); @@ -2751,7 +2731,7 @@ * @param condition * @return */ - public static BigDecimal getReturnAdjustmentTotalBd(GenericDelegator delegator, Map condition) { + public static BigDecimal getReturnAdjustmentTotal(GenericDelegator delegator, Map condition) { BigDecimal total = ZERO; List adjustments; try { @@ -2768,11 +2748,6 @@ Debug.logError(e, OrderReturnServices.module); } return total.setScale(scale, rounding); - } - - /** @deprecated */ - public static double getReturnAdjustmentTotal(GenericDelegator delegator, Map condition) { - return getReturnAdjustmentTotalBd(delegator, condition).doubleValue(); } // little helper method to set the scale according to tax type Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=576302&r1=576301&r2=576302&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Mon Sep 17 01:36:08 2007 @@ -1540,7 +1540,7 @@ Debug.log("New Shipping Total [" + orderId + " / " + shipGroupSeqId + "] : " + shippingTotal, module); } - BigDecimal currentShipping = OrderReadHelper.getAllOrderItemsAdjustmentsTotalBd(orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId), orh.getAdjustments(), false, false, true); + BigDecimal currentShipping = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId), orh.getAdjustments(), false, false, true); currentShipping = currentShipping.add(OrderReadHelper.calcOrderAdjustments(orh.getOrderHeaderAdjustments(shipGroupSeqId), orh.getOrderItemsSubTotal(), false, false, true)); if (Debug.infoOn()) { @@ -2486,7 +2486,7 @@ List orderHeaderAdjustments = orh.getOrderHeaderAdjustments(); BigDecimal orderSubTotal = orh.getOrderItemsSubTotal(); - BigDecimal shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotalBd(orderItems, orderAdjustments, false, false, true); + BigDecimal shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true); shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true)); result = ServiceUtil.returnSuccess(); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=576302&r1=576301&r2=576302&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Mon Sep 17 01:36:08 2007 @@ -3392,7 +3392,7 @@ /* if ((productPromoAction.get("productId") == null || productPromoAction.getString("productId").equals(item.getShipmentMethodTypeId())) && (productPromoAction.get("partyId") == null || productPromoAction.getString("partyId").equals(item.getCarrierPartyId()))) { - Double shippingAmount = new Double(OrderReadHelper.calcItemAdjustmentBd(orderAdjustment, new BigDecimal(item.getQuantity()), new BigDecimal(item.getItemSubTotal())).negate().doubleValue()); + Double shippingAmount = new Double(OrderReadHelper.calcItemAdjustment(orderAdjustment, new BigDecimal(item.getQuantity()), new BigDecimal(item.getItemSubTotal())).negate().doubleValue()); // always set orderAdjustmentTypeId to SHIPPING_CHARGES for free shipping adjustments GenericValue fsOrderAdjustment = getDelegator().makeValue("OrderAdjustment", UtilMisc.toMap("orderItemSeqId", orderAdjustment.get("orderItemSeqId"), "orderAdjustmentTypeId", "SHIPPING_CHARGES", "amount", shippingAmount, @@ -4287,7 +4287,7 @@ for (int i = 0; i < itemTaxAdj.size(); i++) { GenericValue v = (GenericValue) itemTaxAdj.get(i); - itemTax = itemTax.add(OrderReadHelper.calcItemAdjustmentBd(v, new BigDecimal(quantity), new BigDecimal(item.getBasePrice()))); + itemTax = itemTax.add(OrderReadHelper.calcItemAdjustment(v, new BigDecimal(quantity), new BigDecimal(item.getBasePrice()))); } return itemTax.setScale(taxCalcScale, taxRounding).doubleValue(); 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=576302&r1=576301&r2=576302&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 Mon Sep 17 01:36:08 2007 @@ -1811,7 +1811,7 @@ /** Returns the "other" adjustments. */ public double getOtherAdjustments() { - return OrderReadHelper.calcItemAdjustmentsBd(new BigDecimal(quantity), new BigDecimal(getBasePrice()), this.getAdjustments(), true, false, false, false, false).doubleValue(); + return OrderReadHelper.calcItemAdjustments(new BigDecimal(quantity), new BigDecimal(getBasePrice()), this.getAdjustments(), true, false, false, false, false).doubleValue(); } /** Returns the "other" adjustments. */ Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=576302&r1=576301&r2=576302&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl Mon Sep 17 01:36:08 2007 @@ -198,7 +198,7 @@ <td> </td> <td> </td> <td class="align-text"> - <@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcItemAdjustmentBd(orderItemAdjustment, orderItem) isoCode=currencyUomId/> + <@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcItemAdjustment(orderItemAdjustment, orderItem) isoCode=currencyUomId/> </td> <td colspan="3"> </td> </tr> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?rev=576302&r1=576301&r2=576302&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Mon Sep 17 01:36:08 2007 @@ -333,7 +333,7 @@ <td> </td> <td align="right"> <div class="tabletext" style="font-size: xx-small;"> - <@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcItemAdjustmentBd(orderItemAdjustment, orderItem) isoCode=currencyUomId/> + <@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcItemAdjustment(orderItemAdjustment, orderItem) isoCode=currencyUomId/> </div> </td> <td colspan="2"> </td> |
Free forum by Nabble | Edit this page |