svn commit: r629004 - in /ofbiz/trunk/applications: order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java product/servicedef/services_shipment.xml

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

svn commit: r629004 - in /ofbiz/trunk/applications: order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java product/servicedef/services_shipment.xml

mor-2
Author: mor
Date: Mon Feb 18 22:39:32 2008
New Revision: 629004

URL: http://svn.apache.org/viewvc?rev=629004&view=rev
Log:
Applied patch from jira issue OFBiz-1625 (https://issues.apache.org/jira/browse/OFBIZ-1625)
Thanks Ratnesh Upadhyay for the patch.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
    ofbiz/trunk/applications/product/servicedef/services_shipment.xml

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java?rev=629004&r1=629003&r2=629004&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java Mon Feb 18 22:39:32 2008
@@ -49,6 +49,7 @@
     protected double shippableQuantity = 0;
     protected double shippableWeight = 0;
     protected double shippableTotal = 0;
+    protected String partyId = null;
 
     public static ShippingEstimateWrapper getWrapper(LocalDispatcher dispatcher, ShoppingCart cart, int shipGroup) {
         return new ShippingEstimateWrapper(dispatcher, cart, shipGroup);
@@ -66,6 +67,7 @@
         this.shippableTotal = cart.getShippableTotal(shipGroup);
         this.shippingAddress = cart.getShippingAddress(shipGroup);
         this.productStoreId = cart.getProductStoreId();
+        this.partyId = cart.getPartyId();
 
         this.loadShippingMethods();
         this.loadEstimates();
@@ -93,7 +95,7 @@
 
                 Map estimateMap = ShippingEvents.getShipGroupEstimate(dispatcher, delegator, "SALES_ORDER",
                         shippingMethodTypeId, carrierPartyId, carrierRoleTypeId, shippingCmId, productStoreId,
-                        shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal);
+                        shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal, partyId);
 
                 if (!ServiceUtil.isError(estimateMap)) {
                     Double shippingTotal = (Double) estimateMap.get("shippingTotal");

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=629004&r1=629003&r2=629004&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Mon Feb 18 22:39:32 2008
@@ -88,7 +88,7 @@
 
         return getShipGroupEstimate(dispatcher, delegator, cart.getOrderType(), shipmentMethodTypeId, carrierPartyId, null,
                 cart.getShippingContactMechId(groupNo), cart.getProductStoreId(), cart.getShippableItemInfo(groupNo),
-                cart.getShippableWeight(groupNo), cart.getShippableQuantity(groupNo), cart.getShippableTotal(groupNo));
+                cart.getShippableWeight(groupNo), cart.getShippableQuantity(groupNo), cart.getShippableTotal(groupNo), cart.getPartyId());
     }
 
     public static Map getShipEstimate(LocalDispatcher dispatcher, GenericDelegator delegator, OrderReadHelper orh, String shipGroupSeqId) {
@@ -108,17 +108,22 @@
         if (shipAddr == null) {
             return UtilMisc.toMap("shippingTotal", new Double(0));
         }
-
+        
         String contactMechId = shipAddr.getString("contactMechId");
+        String partyId = null;
+        GenericValue partyObject = orh.getPlacingParty();
+        if (UtilValidate.isNotEmpty(partyObject)) {
+             partyId = partyObject.getString("partyId");
+        }
         return getShipGroupEstimate(dispatcher, delegator, orh.getOrderTypeId(), shipmentMethodTypeId, carrierPartyId, carrierRoleTypeId,
                 contactMechId, orh.getProductStoreId(), orh.getShippableItemInfo(shipGroupSeqId), orh.getShippableWeight(shipGroupSeqId).doubleValue(),
-                orh.getShippableQuantity(shipGroupSeqId).doubleValue(), orh.getShippableTotal(shipGroupSeqId).doubleValue());
+                orh.getShippableQuantity(shipGroupSeqId).doubleValue(), orh.getShippableTotal(shipGroupSeqId).doubleValue(), partyId);
     }
 
     public static Map getShipGroupEstimate(LocalDispatcher dispatcher, GenericDelegator delegator, String orderTypeId,
             String shipmentMethodTypeId, String carrierPartyId, String carrierRoleTypeId, String shippingContactMechId,
             String productStoreId, List itemInfo, double shippableWeight, double shippableQuantity,
-            double shippableTotal) {
+            double shippableTotal, String partyId) {
         String standardMessage = "A problem occurred calculating shipping. Fees will be calculated offline.";
         List errorMessageList = new ArrayList();
 
@@ -173,6 +178,7 @@
         serviceFields.put("carrierPartyId", carrierPartyId);
         serviceFields.put("shipmentMethodTypeId", shipmentMethodTypeId);
         serviceFields.put("shippingContactMechId", shippingContactMechId);
+        serviceFields.put("partyId", partyId);
 
         // call the external shipping service
         try {

Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=629004&r1=629003&r2=629004&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Mon Feb 18 22:39:32 2008
@@ -642,6 +642,7 @@
         <attribute name="shippableWeight" type="Double" mode="IN" optional="false"/>
         <attribute name="shippableQuantity" type="Double" mode="IN" optional="false"/>
         <attribute name="shippableTotal" type="Double" mode="IN" optional="false"/>
+        <attribute name="partyId" type="String" mode="IN" optional="true"/>
         <attribute name="shippingEstimateAmount" type="Double" mode="OUT" optional="false"/>
     </service>