svn commit: r560640 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/cart/ order/src/org/ofbiz/order/shoppingcart/ order/webapp/ordermgr/entry/cart/ order/webapp/ordermgr/order/

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

svn commit: r560640 - in /ofbiz/trunk/applications: ecommerce/webapp/ecommerce/cart/ order/src/org/ofbiz/order/shoppingcart/ order/webapp/ordermgr/entry/cart/ order/webapp/ordermgr/order/

lektran
Author: lektran
Date: Sat Jul 28 15:50:52 2007
New Revision: 560640

URL: http://svn.apache.org/viewvc?view=rev&rev=560640
Log:
Replaced all remaining calls to ShoppingCart.calcOrderAdjustment with the BigDecimal version, OFBIZ-880

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderReportBody.fo.ftl
    ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl?view=diff&rev=560640&r1=560639&r2=560640
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/cart/showcart.ftl Sat Jul 28 15:50:52 2007
@@ -322,7 +322,7 @@
         <#if shoppingCart.getAdjustments()?has_content>
             <tr><td>&nbsp;</td><td colspan="6"><hr class="sepbar"/></td></tr>
               <tr>
-                <td colspan="5" nowrap align="right"><div class="tabletext">${uiLabelMap.CommonSubTotal}:</div></td>
+                <td colspan="6" nowrap align="right"><div class="tabletext">${uiLabelMap.CommonSubTotal}:</div></td>
                 <td nowrap align="right"><div class="tabletext"><@ofbizCurrency amount=shoppingCart.getSubTotal() isoCode=shoppingCart.getCurrency()/></div></td>
                 <td>&nbsp;</td>
               </tr>
@@ -330,13 +330,13 @@
               <#assign adjustmentType = cartAdjustment.getRelatedOneCache("OrderAdjustmentType")>
               <!-- adjustment info: ${cartAdjustment.toString()} -->
               <tr>
-                <td colspan="5" nowrap align="right">
+                <td colspan="6" nowrap align="right">
                     <div class="tabletext">
                         <i>${uiLabelMap.EcommerceAdjustment}</i> - ${adjustmentType.get("description",locale)?if_exists}
                         <#if cartAdjustment.productPromoId?has_content><a href="<@ofbizUrl>showPromotionDetails?productPromoId=${cartAdjustment.productPromoId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonDetails}</a></#if>:
                     </div>
                 </td>
-                <td nowrap align="right"><div class="tabletext"><@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(cartAdjustment, shoppingCart.getSubTotal()) isoCode=shoppingCart.getCurrency()/></div></td>
+                <td nowrap align="right"><div class="tabletext"><@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustmentBd(cartAdjustment, shoppingCart.getSubTotal()) isoCode=shoppingCart.getCurrency()/></div></td>
                 <td>&nbsp;</td>
               </tr>
             </#list>

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?view=diff&rev=560640&r1=560639&r2=560640
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sat Jul 28 15:50:52 2007
@@ -3295,7 +3295,7 @@
                     /*
                     if ((productPromoAction.get("productId") == null || productPromoAction.getString("productId").equals(this.getShipmentMethodTypeId())) &&
                         (productPromoAction.get("partyId") == null || productPromoAction.getString("partyId").equals(this.getCarrierPartyId()))) {
-                        Double shippingAmount = new Double(-OrderReadHelper.calcOrderAdjustment(orderAdjustment, getSubTotal()));
+                        Double shippingAmount = new Double(OrderReadHelper.calcOrderAdjustmentBd(orderAdjustment, new BigDecimal(getSubTotal())).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,
@@ -4206,19 +4206,19 @@
         }
         
         public double getTotalTax(ShoppingCart cart) {
-            double taxTotal = 0.00;
+            BigDecimal taxTotal = ZERO;
             for (int i = 0; i < shipTaxAdj.size(); i++) {
                 GenericValue v = (GenericValue) shipTaxAdj.get(i);
-                taxTotal += OrderReadHelper.calcOrderAdjustment(v, cart.getSubTotal());
+                taxTotal = taxTotal.add(OrderReadHelper.calcOrderAdjustmentBd(v, new BigDecimal(cart.getSubTotal())));
             }
 
             Iterator iter = shipItemInfo.values().iterator();
             while (iter.hasNext()) {
                 CartShipItemInfo info = (CartShipItemInfo) iter.next();
-                taxTotal += info.getItemTax(cart);
+                taxTotal = taxTotal.add(new BigDecimal(info.getItemTax(cart)));
             }
 
-            return taxTotal;
+            return taxTotal.doubleValue();
         }
 
         public static class CartShipItemInfo implements Serializable {

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl?view=diff&rev=560640&r1=560639&r2=560640
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/cart/showcartitems.ftl Sat Jul 28 15:50:52 2007
@@ -268,7 +268,7 @@
                     <#if cartAdjustment.productPromoId?has_content><a href="<@ofbizUrl>showPromotionDetails?productPromoId=${cartAdjustment.productPromoId}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonDetails}</a></#if>:
                   </div>
                 </td>
-                <td nowrap align="right"><div class="tabletext"><@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(cartAdjustment, shoppingCart.getSubTotal()) isoCode=currencyUomId/></div></td>
+                <td nowrap align="right"><div class="tabletext"><@ofbizCurrency amount=Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustmentBd(cartAdjustment, shoppingCart.getSubTotal()) isoCode=currencyUomId/></div></td>
                 <td>&nbsp;</td>
               </tr>
             </#list>

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?view=diff&rev=560640&r1=560639&r2=560640
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl Sat Jul 28 15:50:52 2007
@@ -235,7 +235,7 @@
             </#if>
           <#list orderHeaderAdjustments as orderHeaderAdjustment>
             <#assign adjustmentType = orderHeaderAdjustment.getRelatedOne("OrderAdjustmentType")>
-            <#assign adjustmentAmount = Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(orderHeaderAdjustment, orderSubTotal)>
+            <#assign adjustmentAmount = Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustmentBd(orderHeaderAdjustment, orderSubTotal)>
             <#assign orderAdjustmentId = orderHeaderAdjustment.get("orderAdjustmentId")>
             <#if adjustmentAmount != 0>
               <form name="updateOrderAdjustmentForm${orderAdjustmentId}" method="post" action="<@ofbizUrl>updateOrderAdjustment?orderAdjustmentId=${orderAdjustmentId?if_exists}&amp;orderId=${orderId?if_exists}</@ofbizUrl>">

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderReportBody.fo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderReportBody.fo.ftl?view=diff&rev=560640&r1=560639&r2=560640
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderReportBody.fo.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderReportBody.fo.ftl Sat Jul 28 15:50:52 2007
@@ -69,7 +69,7 @@
            </#list>
           <#list orderHeaderAdjustments as orderHeaderAdjustment>
             <#assign adjustmentType = orderHeaderAdjustment.getRelatedOne("OrderAdjustmentType")>
-            <#assign adjustmentAmount = Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(orderHeaderAdjustment, orderSubTotal)>
+            <#assign adjustmentAmount = Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustmentBd(orderHeaderAdjustment, orderSubTotal)>
             <#if adjustmentAmount != 0>
             <fo:table-row>
                <fo:table-cell></fo:table-cell>

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?view=diff&rev=560640&r1=560639&r2=560640
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Sat Jul 28 15:50:52 2007
@@ -526,7 +526,7 @@
           <tr><td colspan="8"><hr class="sepbar"/></td></tr>
           <#list orderHeaderAdjustments as orderHeaderAdjustment>
             <#assign adjustmentType = orderHeaderAdjustment.getRelatedOne("OrderAdjustmentType")>
-            <#assign adjustmentAmount = Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustment(orderHeaderAdjustment, orderSubTotal)>
+            <#assign adjustmentAmount = Static["org.ofbiz.order.order.OrderReadHelper"].calcOrderAdjustmentBd(orderHeaderAdjustment, orderSubTotal)>
             <#if adjustmentAmount != 0>
               <tr>
                 <td align="right" colspan="5">