svn commit: r589081 - in /ofbiz/trunk/applications: order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java product/config/shipment.properties

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

svn commit: r589081 - in /ofbiz/trunk/applications: order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java product/config/shipment.properties

jleroux@apache.org
Author: jleroux
Date: Sat Oct 27 04:51:05 2007
New Revision: 589081

URL: http://svn.apache.org/viewvc?rev=589081&view=rev
Log:
A patch from Skip Dever "Property file addition to inhibit shipping estimate rate checks globally or for selected carriers" (https://issues.apache.org/jira/browse/OFBIZ-1362) - OFBIZ-1362

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
    ofbiz/trunk/applications/product/config/shipment.properties

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=589081&r1=589080&r2=589081&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 Sat Oct 27 04:51:05 2007
@@ -225,9 +225,21 @@
 
     public static Double getExternalShipEstimate(LocalDispatcher dispatcher, GenericValue storeShipMeth, Map context) throws GeneralException {
         // invoke the external shipping estimate service
+        String serviceName = (String)storeShipMeth.get("serviceName");
         Double externalShipAmt = null;
-        if (storeShipMeth.get("serviceName") != null) {
-            String serviceName = storeShipMeth.getString("serviceName");
+        if(serviceName != null){
+            String doEstimates = UtilProperties.getPropertyValue("shipment.properties", "shipment.doratecheck", "true");
+            //If all estimates are not turned off, check for the individual one
+            if("true".equals(doEstimates)){
+                String dothisEstimate = UtilProperties.getPropertyValue("shipment.properties", "shipment.doratecheck." + serviceName, "true");
+                if("false".equals(dothisEstimate))
+                 serviceName = null;
+            } else {
+                //Rate checks inhibited
+                serviceName = null;
+            }
+        }
+        if (( serviceName != null)) {
             String configProps = storeShipMeth.getString("configProps");
             if (UtilValidate.isNotEmpty(serviceName)) {
                 // prepare the external service context
@@ -255,5 +267,6 @@
         return externalShipAmt;
     }
 }
+
 
 

Modified: ofbiz/trunk/applications/product/config/shipment.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/shipment.properties?rev=589081&r1=589080&r2=589081&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/shipment.properties (original)
+++ ofbiz/trunk/applications/product/config/shipment.properties Sat Oct 27 04:51:05 2007
@@ -17,6 +17,16 @@
 # under the License.
 ###############################################################################
 
+########################################
+#Uncomment the following line to inhibit all external rate checks
+#shipment.doratecheck=false
+########################################
+#Uncomment the following line to inhibit rate external rate checks for usps
+#shipment.doratecheck.uspsRateInquire=false
+#You can inhibit any of the external rate checks by substituting uspsRateInquire
+#with the serviceName
+########################################
+
 ############################################
 # General Configuration
 ############################################