Author: sichen
Date: Tue Jan 23 14:25:57 2007
New Revision: 499161
URL:
http://svn.apache.org/viewvc?view=rev&rev=499161Log:
Fix bugs with dhl shipIT which does not support ZIP+4
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java?view=diff&rev=499161&r1=499160&r2=499161==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/dhl/DhlServices.java Tue Jan 23 14:25:57 2007
@@ -240,7 +240,12 @@
inContext.put("dhlShipmentDetailCode", dhlShipmentDetailCode);
inContext.put("weight", weight);
inContext.put("state", shipToAddress.getString("stateProvinceGeoId"));
- inContext.put("postalCode", shipToAddress.getString("postalCode"));
+ // DHL ShipIT API does not accept ZIP+4
+ if ((shipToAddress.getString("postalCode") != null) && (shipToAddress.getString("postalCode").length() > 5)) {
+ inContext.put("postalCode", shipToAddress.getString("postalCode").substring(0,5));
+ } else {
+ inContext.put("postalCode", shipToAddress.getString("postalCode"));
+ }
try {
Map tmpResult = ContentWorker.renderContentAsText(delegator, templateName, outWriter, inContext, null, locale, "text/plain");
} catch (Exception e) {
@@ -709,7 +714,12 @@
inContext.put("streetLine2", destPostalAddress.getString("address2"));
inContext.put("city", destPostalAddress.getString("city"));
inContext.put("state", destPostalAddress.getString("stateProvinceGeoId"));
- inContext.put("postalCode", destPostalAddress.getString("postalCode"));
+ // DHL ShipIT API does not accept ZIP+4
+ if ((destPostalAddress.getString("postalCode") != null) && (destPostalAddress.getString("postalCode").length() > 5)) {
+ inContext.put("postalCode", destPostalAddress.getString("postalCode").substring(0,5));
+ } else {
+ inContext.put("postalCode", destPostalAddress.getString("postalCode"));
+ }
inContext.put("phoneNbr", destPhoneNumber);
inContext.put("labelImageType", labelImagePreference);
inContext.put("shipperReference", shipment.getString("primaryOrderId") + "-" + shipment.getString("primaryShipGroupSeqId"));
@@ -737,7 +747,7 @@
Debug.logError(e, uceErrMsg, module);
return ServiceUtil.returnError(uceErrMsg);
}
- // pass to handler method
+ // pass to handler method
return handleDhlShipmentConfirmResponse(responseString, shipmentRouteSegment, shipmentPackageRouteSegs);
} catch (GenericEntityException e) {