svn commit: r786472 - in /ofbiz/trunk/applications/product: src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy

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

svn commit: r786472 - in /ofbiz/trunk/applications/product: src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy

mor-2
Author: mor
Date: Fri Jun 19 12:13:34 2009
New Revision: 786472

URL: http://svn.apache.org/viewvc?rev=786472&view=rev
Log:
Restricting the online shipping estimates only to UPS when packing is completed from Weight Package Only screen, otherwise this results in an error if the order was placed
with a different carrier.
Applied patch from Pranay Pandey, part of OFBIZ-2634 (https://issues.apache.org/jira/browse/OFBIZ-2634)

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java?rev=786472&r1=786471&r2=786472&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/weightPackage/WeightPackageSession.java Fri Jun 19 12:13:34 2009
@@ -53,6 +53,7 @@
     protected String shipmentId = null;
     protected String invoiceId = null;
     protected String facilityId = null;
+    protected String carrierPartyId = null;
     protected String dimensionUomId = null;
     protected String weightUomId = null;
     protected BigDecimal estimatedShipCost = null;
@@ -189,6 +190,10 @@
     public String getDimensionUomId() {
         return dimensionUomId;
     }
+    
+    public void setCarrierPartyId(String carrierPartyId) {
+        this.carrierPartyId = carrierPartyId;
+    }
 
     public void setDimensionUomId(String dimensionUomId) {
         this.dimensionUomId = dimensionUomId;
@@ -292,13 +297,12 @@
     }
 
     public String complete(String orderId, Locale locale, String calculateOnlineShippingRateFromUps) throws GeneralException {
-
         //create the package(s)
         this.createPackages(orderId);
         // calculate the actual shipping charges according to package(s) weight and dimensions
         BigDecimal actualShippingCost = ZERO;
         // Check if UPS integration is done
-        if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+        if ("UPS".equals(this.carrierPartyId) && "Y".equals(calculateOnlineShippingRateFromUps)) {
             // call upsShipmentConfirm service, it will calculate the online shipping rate from UPS and save in ShipmentRouteSegment entity in actualCost field
             actualShippingCost = this.upsShipmentConfirm();
         } else {
@@ -308,7 +312,7 @@
         // calculate the difference between estimated shipping charges and actual shipping charges
         if (diffInShipCost(actualShippingCost)) {
             return "showWarningForm";
-        } else if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+        } else if ("UPS".equals(this.carrierPartyId) && "Y".equals(calculateOnlineShippingRateFromUps)) {
             // call upsShipmentAccept service, it will made record(s) in ShipmentPackageRouteSeg entity
             this.upsShipmentAccept();
         }
@@ -326,7 +330,7 @@
 
     public boolean completeShipment(String orderId, String calculateOnlineShippingRateFromUps) throws GeneralException {
         // Check if UPS integration is done
-        if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+        if ("UPS".equals(this.carrierPartyId) && "Y".equals(calculateOnlineShippingRateFromUps)) {
             // call upsShipmentAccept service, it will made record(s) in ShipmentPackageRouteSeg entity
             this.upsShipmentAccept();
         }
@@ -517,7 +521,7 @@
         //create the package(s)
         this.createPackages(orderId);
         // Check if UPS integration is done
-        if ("Y".equals(calculateOnlineShippingRateFromUps)) {
+        if ("UPS".equals(this.carrierPartyId) && "Y".equals(calculateOnlineShippingRateFromUps)) {
             // call upsShipmentConfirm service, it will calculate the online shipping rate from UPS and save in ShipmentRouteSegment entity in actualCost field
             this.upsShipmentConfirm();
         }

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy?rev=786472&r1=786471&r2=786472&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/WeightPackage.groovy Fri Jun 19 12:13:34 2009
@@ -155,7 +155,7 @@
         orderId = null;
     }
 }
-
+weightPackageSession.setCarrierPartyId(carrierPartyId);
 context.orderId = orderId;
 context.shipGroupSeqId = shipGroupSeqId;
 context.picklistBinId = picklistBinId;