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/06/16 12:19:10 UTC
svn commit: r785145 -
/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
Author: ashish
Date: Tue Jun 16 10:19:09 2009
New Revision: 785145
URL: http://svn.apache.org/viewvc?rev=785145&view=rev
Log:
Applied patch from jira issue OFBIZ-2609 (Cannot upload vCard to SFA contacts)
Thanks Awdesh for your contribution.
Modified:
ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=785145&r1=785144&r2=785145&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original)
+++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Tue Jun 16 10:19:09 2009
@@ -27,6 +27,7 @@
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import org.ofbiz.base.util.Debug;
@@ -102,17 +103,26 @@
serviceCtx.put("address1", workAddress.getStreet());
serviceCtx.put("city", workAddress.getCity());
serviceCtx.put("postalCode", workAddress.getPostalCode());
+
+ List<GenericValue> countryGeoList = null;
+ List<GenericValue> stateGeoList = null;
EntityCondition cond = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("geoTypeId", EntityOperator.EQUALS, "COUNTRY"),
EntityCondition.makeCondition("geoName", EntityOperator.LIKE, workAddress.getCountry())), EntityOperator.AND);
- GenericValue countryGeo = EntityUtil.getFirst(delegator.findList("Geo", cond, null, null, null, true));
- serviceCtx.put("countryGeoId", countryGeo.get("geoId"));
+ countryGeoList = delegator.findList("Geo", cond, null, null, null, true);
+ if (!countryGeoList.isEmpty()) {
+ GenericValue countryGeo = EntityUtil.getFirst(countryGeoList);
+ serviceCtx.put("countryGeoId", countryGeo.get("geoId"));
+ }
EntityCondition condition = EntityCondition.makeCondition(UtilMisc.toList(
EntityCondition.makeCondition("geoTypeId", EntityOperator.EQUALS, "STATE"),
EntityCondition.makeCondition("geoName", EntityOperator.LIKE, workAddress.getRegion())), EntityOperator.AND);
- GenericValue stateGeo = EntityUtil.getFirst(delegator.findList("Geo", condition, null, null, null, true));
- serviceCtx.put("stateProvinceGeoId", stateGeo.get("geoId"));
+ stateGeoList = delegator.findList("Geo", condition, null, null, null, true);
+ if (!stateGeoList.isEmpty()) {
+ GenericValue stateGeo = EntityUtil.getFirst(stateGeoList);
+ serviceCtx.put("stateProvinceGeoId", stateGeo.get("geoId"));
+ }
Communications communications = contact.getCommunications();
for (Iterator iter = communications.getEmailAddresses(); iter.hasNext();) {