You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/02/09 01:13:08 UTC

svn commit: r505094 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java

Author: sichen
Date: Thu Feb  8 16:13:08 2007
New Revision: 505094

URL: http://svn.apache.org/viewvc?view=rev&rev=505094
Log:
Excluding country code from North American phone and fax numbers in Fedex subscription request

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java?view=diff&rev=505094&r1=505093&r2=505094
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/thirdparty/fedex/FedexServices.java Thu Feb  8 16:13:08 2007
@@ -229,7 +229,10 @@
                 return ServiceUtil.returnError(errorMessage);
             }
             phoneNumber = phoneNumberValue.getString("areaCode") + phoneNumberValue.getString("contactNumber");
-            if (UtilValidate.isNotEmpty(phoneNumberValue.getString("countryCode"))) phoneNumber = phoneNumberValue.getString("countryCode") + phoneNumber;
+            // Fedex doesn't want the North American country code
+            if (UtilValidate.isNotEmpty(phoneNumberValue.getString("countryCode")) && !(countryCode.equals("CA") || countryCode.equals("US"))) {
+                phoneNumber = phoneNumberValue.getString("countryCode") + phoneNumber;
+            }
             phoneNumber = phoneNumber.replaceAll("[^+\\d]", "");
 
             // Get the first valid fax number
@@ -244,7 +247,10 @@
             GenericValue faxNumberValue = EntityUtil.getFirst(faxNumbers);
             if(! UtilValidate.isEmpty(faxNumberValue)) {
                 faxNumber = faxNumberValue.getString("areaCode") + faxNumberValue.getString("contactNumber");
-                if (UtilValidate.isNotEmpty(faxNumberValue.getString("countryCode"))) faxNumber = faxNumberValue.getString("countryCode") + faxNumber;
+                // Fedex doesn't want the North American country code
+                if (UtilValidate.isNotEmpty(faxNumberValue.getString("countryCode")) && !(countryCode.equals("CA") || countryCode.equals("US"))) {
+                    faxNumber = faxNumberValue.getString("countryCode") + faxNumber;
+                }
                 faxNumber = faxNumber.replaceAll("[^+\\d]", "");
             }