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

svn commit: r815155 - /ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java

Author: ashish
Date: Tue Sep 15 06:01:56 2009
New Revision: 815155

URL: http://svn.apache.org/viewvc?rev=815155&view=rev
Log:
On testing I observed that GetOrders request was creating duplicate party records if the party with the same name already exists in OFBiz. Fixed the problem in this patch.

Modified:
    ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java

Modified: ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java?rev=815155&r1=815154&r2=815155&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java (original)
+++ ofbiz/trunk/specialpurpose/ebay/src/org/ofbiz/ebay/EbayHelper.java Tue Sep 15 06:01:56 2009
@@ -357,21 +357,26 @@
     public static void correctCityStateCountry(LocalDispatcher dispatcher, Map map, String city, String state,
             String country) {
         try {
+            String geoCode = null;
             Debug.logInfo("correctCityStateCountry params: " + city + ", " + state + ", " + country, module);
             if (UtilValidate.isEmpty(country)) {
-                country = "US";
+                geoCode = "US";
             }
             country = country.toUpperCase();
             if (country.indexOf("UNITED STATES") > -1 || country.indexOf("USA") > -1) {
-                country = "US";
+                geoCode = "US";
             }
-            Debug.logInfo("GeoCode: " + country, module);
-            Map outMap = getCountryGeoId(dispatcher.getDelegator(), country);
+            if (UtilValidate.isEmpty(geoCode)) {
+                geoCode = country;
+            }
+            Debug.logInfo("GeoCode: " + geoCode, module);
+            Map outMap = getCountryGeoId(dispatcher.getDelegator(), geoCode);
             String geoId = (String) outMap.get("geoId");
             if (UtilValidate.isEmpty(geoId)) {
                 geoId = "USA";
             }
             map.put("countryGeoId", geoId);
+            country = geoId;
             Debug.logInfo("Country geoid: " + geoId, module);
             if (geoId.equals("USA") || geoId.equals("CAN")) {
                 if (UtilValidate.isNotEmpty(state)) {
@@ -524,7 +529,6 @@
                 // now compare values. If all fields match, that's our shipping
                 // address. Return the related contact mech id.
                 if (context.get("shippingAddressStreet1").toString().equals((postalAddress.get("address1").toString()))
-                        && context.get("shippingAddressStreet2").toString().equals((postalAddress.get("address2").toString()))
                         && context.get("city").toString().equals((postalAddress.get("city").toString()))
                         && context.get("stateProvinceGeoId").toString().equals((postalAddress.get("stateProvinceGeoId").toString()))
                         && context.get("countryGeoId").toString().equals((postalAddress.get("countryGeoId").toString()))