You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2008/05/08 18:48:07 UTC

svn commit: r654579 - in /ofbiz/trunk/applications/marketing: config/ script/org/ofbiz/sfa/contact/ servicedef/ webapp/sfa/WEB-INF/ webapp/sfa/WEB-INF/action/ webapp/sfa/contact/ widget/sfa/ widget/sfa/forms/

Author: mor
Date: Thu May  8 09:47:55 2008
New Revision: 654579

URL: http://svn.apache.org/viewvc?rev=654579&view=rev
Log:
Merge contacts tool, patch applied from OFBIZ-1650 (https://issues.apache.org/jira/browse/OFBIZ-1650) - still need improvements, Thanks Jyotsna for patch and also thanks to Mridul Pathak for reviewing this work 

Added:
    ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/
    ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh   (with props)
    ofbiz/trunk/applications/marketing/webapp/sfa/contact/
    ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl   (with props)
Modified:
    ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
    ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/contact/ContactServices.xml
    ofbiz/trunk/applications/marketing/servicedef/services.xml
    ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml
    ofbiz/trunk/applications/marketing/widget/sfa/ContactScreens.xml
    ofbiz/trunk/applications/marketing/widget/sfa/forms/ContactForms.xml

Modified: ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml?rev=654579&r1=654578&r2=654579&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml (original)
+++ ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml Thu May  8 09:47:55 2008
@@ -1134,6 +1134,9 @@
     <property key="SfaCompanyName">
         <value xml:lang="en">OFBiz: SFA Manager</value>
     </property>
+    <property key="SfaCanNotMergeSameContact">
+        <value xml:lang="en">Failed to merge contacts. You have selected same contact to merge.</value>
+    </property>  
     <property key="SfaCompetitors">
         <value xml:lang="en">Competitors &amp; Partners </value>
     </property>
@@ -1167,6 +1170,9 @@
     <property key="SfaFindResults">
         <value xml:lang="en">Find Results</value>
     </property>
+    <property key="SfaFirstContact">
+        <value xml:lang="en">First Contact</value>
+    </property>    
     <property key="SfaForecasts">
         <value xml:lang="en">Forecast</value>
     </property>
@@ -1191,6 +1197,12 @@
     <property key="SfaManagerWelcome">
         <value xml:lang="en">Welcome to the SFA Manager Application</value>
     </property>
+    <property key="SfaMergeContacts">
+        <value xml:lang="en">Merge Contacts</value>
+    </property>
+    <property key="SfaMergeParty">
+        <value xml:lang="en">Merge Party</value>
+    </property>  
     <property key="SfaNewOpportunity">
         <value xml:lang="en">Create New Opportunity</value>
     </property>
@@ -1221,6 +1233,9 @@
     <property key="SfaQuickAddContactForm">
         <value xml:lang="en">Quick Add Contact Form</value>
     </property>
+    <property key="SfaSecondContact">
+        <value xml:lang="en">Second Contact</value>
+    </property>   
     <property key="SfaType">
         <value xml:lang="en">Type</value>
     </property>

Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/contact/ContactServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/contact/ContactServices.xml?rev=654579&r1=654578&r2=654579&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/contact/ContactServices.xml (original)
+++ ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/contact/ContactServices.xml Thu May  8 09:47:55 2008
@@ -30,5 +30,154 @@
         <set field="partyRelationContext.roleTypeIdFrom" value="_NA_"/>
         <set field="partyRelationContext.partyRelationshipTypeId" value="CONTACT_REL"></set>
         <call-service service-name="createPartyRelationship" in-map-name="partyRelationContext"/>
+        <field-to-result field-name="partyId"/>
+    </simple-method>
+
+    <simple-method short-description="Merge two Contacts" method-name="mergeContacts">
+        <set field="partyIdTo" from-field="parameters.partyId_1"/>
+        <set field="contactMechIdGenLoc_1" from-field="parameters.contactMechIdGenLoc_1"/>
+        <set field="contactMechIdPrimPhone_1" from-field="parameters.contactMechIdPrimPhone_1"/>
+        <set field="contactMechIdEmail_1" from-field="parameters.contactMechIdEmail_1"/>
+        <set field="partyId" from-field="parameters.partyId_2"/>
+        <set field="contactMechIdGenLoc_2" from-field="parameters.contactMechIdGenLoc_2"/>
+        <set field="contactMechIdPrimPhone_2" from-field="parameters.contactMechIdPrimPhone_2"/>
+        <set field="contactMechIdEmail_2" from-field="parameters.contactMechIdEmail_2"/>
+        <if-compare-field field-name="partyIdTo" operator="not-equals" to-field-name="partyId">
+            <if-compare field-name="parameters.useAddress2" operator="equals"  value="Y" >
+                <if-not-empty field-name="contactMechIdGenLoc_2">
+                    <if-not-empty field-name="contactMechIdGenLoc_1">
+                        <set field="deletePartyContactMechPurposeCtx.partyId" from-field="partyIdTo"/>
+                        <set field="deletePartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdGenLoc_1"/>
+                        <set field="deletePartyContactMechPurposeCtx.contactMechPurposeTypeId" value="GENERAL_LOCATION"/>
+                        <set field="deletePartyContactMechPurposeCtx.fromDate" from-field="parameters.fromDateGenLoc_1"/>
+                        <call-service service-name="deletePartyContactMechPurpose" in-map-name="deletePartyContactMechPurposeCtx"/>
+
+                        <set field="deletePartyContactMechCtx.partyId" from-field="partyIdTo"/>
+                        <set field="deletePartyContactMechCtx.contactMechId" from-field="contactMechIdGenLoc_1"/>
+                        <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/>
+
+                        <clear-field field-name="deletePartyContactMechPurposeCtx"/>
+                        <clear-field field-name="deletePartyContactMechCtx"/>
+                    </if-not-empty>
+
+                    <set field="deletePartyContactMechPurposeCtx.partyId" from-field="partyId"/>
+                    <set field="deletePartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdGenLoc_2"/>
+                    <set field="deletePartyContactMechPurposeCtx.contactMechPurposeTypeId" value="GENERAL_LOCATION"/>
+                    <set field="deletePartyContactMechPurposeCtx.fromDate" from-field="parameters.fromDateGenLoc_2"/>
+                    <call-service service-name="deletePartyContactMechPurpose" in-map-name="deletePartyContactMechPurposeCtx"/>
+
+                    <set field="deletePartyContactMechCtx.partyId" from-field="partyId"/>
+                    <set field="deletePartyContactMechCtx.contactMechId" from-field="contactMechIdGenLoc_2"/>
+                    <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx_2"/>
+
+                    <clear-field field-name="deletePartyContactMechPurposeCtx"/>
+                    <clear-field field-name="deletePartyContactMechCtx"/>
+                    
+                    <set field="createPartyContactMechCtx.partyId" from-field="partyIdTo"/>
+                    <set field="createPartyContactMechCtx.contactMechId" from-field="contactMechIdGenLoc_2"/>
+                    <call-service service-name="createPartyContactMech" in-map-name="createPartyContactMechCtx">
+                        <result-to-field result-name="contactMechId" field-name="contactMechIdGenLoc"/>
+                    </call-service>
+                    
+                    <set field="createPartyContactMechPurposeCtx.partyId" from-field="partyIdTo"/>
+                    <set field="createPartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdGenLoc_2"/>
+                    <set field="createPartyContactMechPurposeCtx.contactMechPurposeTypeId" value="GENERAL_LOCATION"/>
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="createPartyContactMechPurposeCtx"/>
+                    
+                    <clear-field field-name="createPartyContactMechCtx"/>
+                    <clear-field field-name="createPartyContactMechPurposeCtx"/>
+                </if-not-empty>
+            </if-compare>
+            <if-compare field-name="parameters.useContactNum2" operator="equals"  value="Y" >
+                <if-not-empty field-name="contactMechIdPrimPhone_2">
+                    <if-not-empty field-name="contactMechIdPrimPhone_1">
+                        <set field="deletePartyContactMechPurposeCtx.partyId" from-field="partyIdTo"/>
+                        <set field="deletePartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdPrimPhone_1"/>
+                        <set field="deletePartyContactMechPurposeCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
+                        <set field="deletePartyContactMechPurposeCtx.fromDate" from-field="parameters.fromDateTelecom_1"/>
+                        <call-service service-name="deletePartyContactMechPurpose" in-map-name="deletePartyContactMechPurposeCtx"/>
+ 
+                        <set field="deletePartyContactMechCtx.partyId" from-field="partyIdTo"/>
+                        <set field="deletePartyContactMechCtx.contactMechId" from-field="contactMechIdPrimPhone_1"/>
+                        <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/>
+
+                        <clear-field field-name="deletePartyContactMechPurposeCtx"/>
+                        <clear-field field-name="deletePartyContactMechCtx"/>                 
+                    </if-not-empty>
+                    
+                    <set field="deletePartyContactMechPurposeCtx.partyId" from-field="partyId"/>
+                    <set field="deletePartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdPrimPhone_2"/>
+                    <set field="deletePartyContactMechPurposeCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
+                    <set field="deletePartyContactMechPurposeCtx.fromDate" from-field="parameters.fromDateTelecom_2"/>
+                    <call-service service-name="deletePartyContactMechPurpose" in-map-name="deletePartyContactMechPurposeCtx"/>
+
+                    <set field="deletePartyContactMechCtx.partyId" from-field="partyId"/>
+                    <set field="deletePartyContactMechCtx.contactMechId" from-field="contactMechIdPrimPhone_2"/>
+                    <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/>
+
+                    <clear-field field-name="deletePartyContactMechPurposeCtx"/>
+                    <clear-field field-name="deletePartyContactMechCtx"/>
+
+                    <set field="createPartyContactMechCtx.partyId" from-field="partyIdTo"/>
+                    <set field="createPartyContactMechCtx.contactMechId" from-field="contactMechIdPrimPhone_2"/>
+                    <call-service service-name="createPartyContactMech" in-map-name="createPartyContactMechCtx">
+                        <result-to-field result-name="contactMechId" field-name="contactMechIdPhone"/>
+                    </call-service>
+                    <set field="createPartyContactMechPurposeCtx.partyId" from-field="partyIdTo"/>
+                    <set field="createPartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdPrimPhone_2"/>
+                    <set field="createPartyContactMechPurposeCtx.contactMechPurposeTypeId" value="PRIMARY_PHONE"/>
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="createPartyContactMechPurposeCtx"/>
+
+                    <clear-field field-name="createPartyContactMechCtx"/>
+                    <clear-field field-name="createPartyContactMechPurposeCtx"/>
+                </if-not-empty>
+            </if-compare>
+            <if-compare field-name="parameters.useEmail2" operator="equals"  value="Y" >
+                <if-not-empty field-name="contactMechIdEmail_2">
+                    <if-not-empty field-name="contactMechIdEmail_1">
+                      
+                        <set field="deletePartyContactMechPurposeCtx.partyId" from-field="partyIdTo"/>
+                        <set field="deletePartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdEmail_1"/>
+                        <set field="deletePartyContactMechPurposeCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+                        <set field="deletePartyContactMechPurposeCtx.fromDate" from-field="parameters.fromDateEmail_1"/>
+                        <call-service service-name="deletePartyContactMechPurpose" in-map-name="deletePartyContactMechPurposeCtx"/>
+                        
+                        <set field="deletePartyContactMechCtx.partyId" from-field="partyIdTo"/>
+                        <set field="deletePartyContactMechCtx.contactMechId" from-field="contactMechIdEmail_1"/>
+                        <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/> 
+
+                        <clear-field field-name="deletePartyContactMechPurposeCtx"/>
+                        <clear-field field-name="deletePartyContactMechCtx"/>
+                    </if-not-empty>
+
+                    <set field="deletePartyContactMechPurposeCtx.partyId" from-field="partyId"/>
+                    <set field="deletePartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdEmail_2"/>
+                    <set field="deletePartyContactMechPurposeCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+                    <set field="deletePartyContactMechPurposeCtx.fromDate" from-field="parameters.fromDateEmail_2"/>
+                    <call-service service-name="deletePartyContactMechPurpose" in-map-name="deletePartyContactMechPurposeCtx"/>
+
+                    <set field="deletePartyContactMechCtx.partyId" from-field="partyId"/>
+                    <set field="deletePartyContactMechCtx.contactMechId" from-field="contactMechIdEmail_2"/>
+                    <call-service service-name="deletePartyContactMech" in-map-name="deletePartyContactMechCtx"/>
+
+                    <set field="createPartyContactMechCtx.partyId" from-field="partyIdTo"/>
+                    <set field="createPartyContactMechCtx.contactMechId" from-field="contactMechIdEmail_2"/>
+                    <call-service service-name="createPartyContactMech" in-map-name="createPartyContactMechCtx_3">
+                        <result-to-field result-name="contactMechId" field-name="contactMechIdEmail"/>
+                    </call-service>
+
+                    <set field="createPartyContactMechPurposeCtx.partyId" from-field="partyIdTo"/>
+                    <set field="createPartyContactMechPurposeCtx.contactMechId" from-field="contactMechIdEmail_2"/>
+                    <set field="createPartyContactMechPurposeCtx.contactMechPurposeTypeId" value="PRIMARY_EMAIL"/>
+                    <call-service service-name="createPartyContactMechPurpose" in-map-name="createPartyContactMechPurposeCtx"/>
+                </if-not-empty>
+            </if-compare>
+
+            <set field="updatePartyCtx.partyId" from-field="partyId"/>
+            <set field="updatePartyCtx.statusId" value="PARTY_DISABLED"/>
+            <call-service service-name="setPartyStatus" in-map-name="updatePartyCtx"/>
+            <field-to-result field-name="partyIdTo" result-name="partyId"/>
+            <field-to-request field-name="partyIdTo" request-name="partyId"/>
+       </if-compare-field>
     </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=654579&r1=654578&r2=654579&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/marketing/servicedef/services.xml Thu May  8 09:47:55 2008
@@ -418,7 +418,30 @@
         <auto-attributes entity-name="TelecomNumber" mode="IN" optional="true">
             <exclude field-name="contactMechId"/>
         </auto-attributes>
+        <attribute name="partyId" type="String" mode="OUT" />
         <attribute name="emailAddress" type="String" mode="IN" optional="true"/>
         <attribute name="partyIdFrom" type="String" mode="IN" optional="true"/>
     </service>
+    <service name="mergeContacts" engine="simple" 
+        location="org/ofbiz/sfa/contact/ContactServices.xml" invoke="mergeContacts">
+        <description>This service merges the contact details of two parties</description>
+        <attribute name="contactMechIdGenLoc_1" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechIdPrimPhone_1" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechIdEmail_1" type="String" mode="IN" optional="true"/>
+        <attribute name="fromDateGenLoc_1" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="fromDateTelecom_1" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="fromDateEmail_1" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="contactMechIdGenLoc_2" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechIdPrimPhone_2" type="String" mode="IN" optional="true"/>
+        <attribute name="contactMechIdEmail_2" type="String" mode="IN" optional="true"/>
+        <attribute name="fromDateGenLoc_2" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="fromDateTelecom_2" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="fromDateEmail_2" type="Timestamp" mode="IN" optional="true"/>
+        <attribute name="partyId_1" type="String" mode="IN" optional="false"/>
+        <attribute name="partyId_2" type="String" mode="IN" optional="false"/>
+        <attribute name="useAddress2" type="String" mode="IN" optional="true"/>
+        <attribute name="useContactNum2" type="String" mode="IN" optional="true"/>
+        <attribute name="useEmail2" type="String" mode="IN" optional="true"/>
+        <attribute name="partyId" type="String" mode="OUT" optional="false"/>
+    </service>
  </services>

Added: ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh?rev=654579&view=auto
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh (added)
+++ ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh Thu May  8 09:47:55 2008
@@ -0,0 +1,62 @@
+import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.UtilHttp;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.entity.util.EntityUtil;
+import javolution.util.FastList;
+
+FastList contactInfoList=FastList.newInstance();
+partyIdFrom = parameters.get("partyIdFrom");
+partyIdTo = parameters.get("partyIdTo");
+if(UtilValidate.isNotEmpty(partyIdFrom) && UtilValidate.isNotEmpty(partyIdTo)) {
+    partyList = UtilMisc.toList(partyIdTo, partyIdFrom);
+    partyListItr = partyList.iterator();
+    while (partyListItr.hasNext()) {
+        partyId = partyListItr.next();
+        party = delegator.findOne("Person", false, "partyId",partyId);
+        person =  delegator.findOne("Person", false, "partyId",partyId));
+        contactDetailMap = UtilMisc.toMap("partyId", partyId, "firstName", person.get("firstName"), "lastName", person.get("lastName"));
+
+        cntctMechGenLoc = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false));
+        contactDetailMap.put("contactMechIdGenLoc", cntctMechGenLoc.get("contactMechId"));
+        contactDetailMap.put("fromDateGenLoc", cntctMechGenLoc.get("fromDate"));
+        postalAddress = cntctMechGenLoc.getRelatedOne("PostalAddress");
+        if(UtilValidate.isNotEmpty(postalAddress)) {
+            contactDetailMap.put("address1", postalAddress.get("address1"));
+            contactDetailMap.put("city", postalAddress.get("city"));
+            address2 = postalAddress.get("address2");
+            if(UtilValidate.isNotEmpty(address2)) {
+                contactDetailMap.put("address2", address2);
+            }
+            geo = delegator.findOne("Geo", "geoId", postalAddress.get("stateProvinceGeoId"));
+            contactDetailMap.put("state", geo.get("geoName"));
+            
+            geo = delegator.findOne("Geo", false, "geoId", postalAddress.get("countryGeoId"));
+            contactDetailMap.put("country", geo.get("geoName"));
+        }
+        cntctMechPrimEmail = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false));
+        contactMech= cntctMechPrimEmail.getRelatedOne("ContactMech");
+        if(UtilValidate.isNotEmpty(contactMech)) {
+            contactDetailMap.put("primaryEmail", contactMech.get("infoString"));                    
+        }
+        cntctMechPrimEmail = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_PHONE", "TELECOM_NUMBER", false));        
+        contactDetailMap.put("contactMechIdPrimPhone", cntctMechPrimPhone.get("contactMechId"));
+        contactDetailMap.put("fromDateTelecom", cntctMechPrimPhone.get("fromDate"));
+        telecomNumber = cntctMechPrimPhone.getRelatedOne("TelecomNumber"); 
+        if(UtilValidate.isNotEmpty(telecomNumber)) {
+            countryCode = telecomNumber.get("countryCode");
+            if(UtilValidate.isNotEmpty(countryCode)) {
+                contactDetailMap.put("countryCode", countryCode);
+            }
+            areaCode = telecomNumber.get("areaCode");
+            if(UtilValidate.isNotEmpty(areaCode)) {
+                contactDetailMap.put("areaCode", areaCode);
+            }
+            contactNumber = telecomNumber.get("contactNumber");
+            if(UtilValidate.isNotEmpty(contactNumber)) {
+                contactDetailMap.put("contactNumber", contactNumber);
+            }                
+        }
+        contactInfoList.add(contactDetailMap);
+    }
+}
+context.put("contactInfoList", contactInfoList);
\ No newline at end of file

Propchange: ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml?rev=654579&r1=654578&r2=654579&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml Thu May  8 09:47:55 2008
@@ -114,9 +114,19 @@
     <request-map uri="createContact">
         <security https="true" auth="true"/>
         <event type="service" invoke="createContact"/>
-        <response name="success" type="view" value="FindContacts"/>
+        <response name="success" type="view" value="viewprofile"/>
         <response name="error" type="view" value="CreateContact"/>
     </request-map>
+    <request-map uri="MergeContacts">
+        <security https="true" auth="true"/>
+        <response name="success" type="view" value="MergeContacts"/>
+    </request-map>
+    <request-map uri="mergeContacts">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="mergeContacts"/>
+        <response name="success" type="view" value="viewprofile"/>
+        <response name="error" type="view" value="MergeContacts"/>
+    </request-map>
     <!-- end of request mappings -->
 
     <!-- View Mappings -->
@@ -132,5 +142,6 @@
     <view-map name="CreateLead" type="screen" page="component://marketing/widget/sfa/LeadScreens.xml#CreateLead"/>
     <view-map name="FindContacts" type="screen" page="component://marketing/widget/sfa/ContactScreens.xml#FindContacts"/>
     <view-map name="CreateContact" type="screen" page="component://marketing/widget/sfa/ContactScreens.xml#CreateContact"/>
+    <view-map name="MergeContacts" type="screen" page="component://marketing/widget/sfa/ContactScreens.xml#MergeContacts"/>
     <!-- end of view mappings -->
 </site-conf>
\ No newline at end of file

Added: ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl?rev=654579&view=auto
==============================================================================
--- ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl (added)
+++ ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl Thu May  8 09:47:55 2008
@@ -0,0 +1,139 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<form  method="post" action="<@o...@ofbizUrl>" class="basic-form">
+  <table border="0" width="100%" >
+    <tr>
+      <td>
+        <#if contactInfoList?has_content >
+          <#assign contactInfo1 = contactInfoList[0]/>
+          <#assign contactInfo2 = contactInfoList[1]/>
+          <input type="hidden" name="partyId_1" value="${contactInfo1.partyId?if_exists}">
+          <input type="hidden" name="partyId_2" value="${contactInfo2.partyId?if_exists}">
+          
+          <input type="hidden" name="contactMechIdGenLoc_1" value="${contactInfo1.contactMechIdGenLoc?if_exists}">
+          <input type="hidden" name="contactMechIdPrimPhone_1" value="${contactInfo1.contactMechIdPrimPhone?if_exists}">
+          <input type="hidden" name="contactMechIdEmail_1" value="${contactInfo1.contactMechIdEmail?if_exists}">
+          <input type="hidden" name="fromDateGenLoc_1" value="${contactInfo1.fromDateGenLoc?if_exists}">
+          <input type="hidden" name="fromDateEmail_1" value="${contactInfo1.fromDateEmail?if_exists}">
+          <input type="hidden" name="fromDateTelecom_1" value="${contactInfo1.fromDateTelecom?if_exists}">
+          
+          <input type="hidden" name="contactMechIdGenLoc_2" value="${contactInfo2.contactMechIdGenLoc?if_exists}">
+          <input type="hidden" name="contactMechIdPrimPhone_2" value="${contactInfo2.contactMechIdPrimPhone?if_exists}">
+          <input type="hidden" name="contactMechIdEmail_2" value="${contactInfo2.contactMechIdEmail?if_exists}">
+          <input type="hidden" name="fromDateGenLoc_2" value="${contactInfo2.fromDateGenLoc?if_exists}">
+          <input type="hidden" name="fromDateEmail_2" value="${contactInfo2.fromDateEmail?if_exists}">
+          <input type="hidden" name="fromDateTelecom_2" value="${contactInfo2.fromDateTelecom?if_exists}">
+          
+          <table  align="left" >
+            <tr width="100%">
+              <td width="20%" ></td>
+              <td width="30%"><h2>${uiLabelMap.SfaFirstContact}</h2><br/></b></td>
+              <td width="30%"><h2>${uiLabelMap.SfaSecondContact}</h2><br/></b></td>
+              <td width="20%"><h2>${uiLabelMap.CommonSelect}</h2></td>
+              <br/><br/>
+            </tr>
+            <tr width="100%">
+              <td width="20%">${uiLabelMap.CommonFirstName?if_exists}</td>
+              <td width="30%"><h3>${contactInfo1.firstName?if_exists}</h3></td>
+              <td width="30%"><h3>${contactInfo2.firstName?if_exists}</h3></td>
+              <td width="20%"></td>
+            </tr>
+            <tr width="100%">
+              <td width="20%">${uiLabelMap.CommonLastName?if_exists}</td>
+              <td width="30%"><h3>${contactInfo1.lastName?if_exists}</h3></td>
+              <td width="30%"><h3>${contactInfo2.lastName?if_exists}</h3></td>
+              <td width="20%"></td>
+            </tr><br/>
+            <tr>
+              <td width="30"><br/><h3>${uiLabelMap.PartyGeneralCorrespondenceAddress?if_exists}</h3></td>
+              <td width="30"></td>
+            <tr>
+              <td width="20%" >${uiLabelMap.CommonAddress1?if_exists}</td>
+              <td width="30%">${contactInfo1.address1?if_exists}</td>
+              <td width="30%">${contactInfo2.address1?if_exists}</td>
+              <td width="20%"><input type="checkbox" name="useAddress2" value="Y"/></td>
+            </tr>
+
+            <tr>
+              <td width="20%" >${uiLabelMap.CommonAddress2?if_exists}</td>
+              <td width="30%">${contactInfo1.address2?if_exists}</td>
+              <td width="30%">${contactInfo2.address2?if_exists}</td>
+              <td width="20%"></td>
+            </tr>
+
+            <tr>
+              <td width="20%" >${uiLabelMap.CommonCity?if_exists}</td>
+              <td width="30%">${contactInfo1.city?if_exists}</td>
+              <td width="30%">${contactInfo2.city?if_exists}</td>
+              <td width="20%"></td>
+            </tr>
+            <tr>
+              <td width="20%">${uiLabelMap.CommonState?if_exists}</td>
+              <td width="30%">${contactInfo1.state?if_exists}</td>
+              <td width="30%">${contactInfo2.state?if_exists}</td>
+              <td width="20%"></td>
+            </tr>
+            <tr>
+              <td width="20%">${uiLabelMap.CommonZipPostalCode?if_exists}</td>
+              <td width="30%">${contactInfo1.postalCode?if_exists}</td>
+              <td width="30%">${contactInfo2.postalCode?if_exists}</td>
+              <td width="20%"></td>
+            </tr>
+            <tr>
+              <td width="20%" >${uiLabelMap.CommonCountry?if_exists}</td>
+              <td width="30%">${contactInfo1.country?if_exists}</td>
+              <td width="30%">${contactInfo2.country?if_exists}</td>
+              <td width="20%"></td>
+            </tr><br/>
+            <tr><td><br/><h3>${uiLabelMap.PartyPrimaryPhone?if_exists}</h3></td></tr>
+            <tr>
+              <td width="20%">${uiLabelMap.PartyCountryCode?if_exists}</td>
+              <td width="30%">${contactInfo1.countryCode?if_exists}</td>
+              <td width="30%">${contactInfo2.countryCode?if_exists}</td>
+              <td width="10%"><input type="checkbox" name="useContactNum2" value="Y"/></td>
+            </tr>
+            <tr>
+              <td width="20%" >${uiLabelMap.PartyAreaCode?if_exists}</td>
+              <td width="30%">${contactInfo1.areaCode?if_exists}</td>
+              <td width="30%">${contactInfo2.areaCode?if_exists}</td>
+              <td width="20%"></td>
+            </tr>
+            <tr>
+              <td width="20%" >${uiLabelMap.PartyPhoneNumber?if_exists}</td>
+              <td width="30%">${contactInfo1.contactNumber?if_exists}</td>
+              <td width="30%">${contactInfo2.contactNumber?if_exists}</td>
+              <td width="20%"></td>
+            </tr> 
+            <tr>
+              <td width="20%" >${uiLabelMap.CommonEmail?if_exists}</td>
+              <td width="30%">${contactInfo1.primaryEmail?if_exists}</td>
+              <td width="30%">${contactInfo2.primaryEmail?if_exists}</td>
+              <td width="10%"><input type="checkbox" name="useEmail2" value="Y"/></td>
+            </tr>     
+            <tr>
+              <td colspan="4" align="center"><br/>
+                <input type="submit" value="submit"/>
+              </td>
+            </tr>
+          </table>
+        </#if>
+      </td>
+    </tr>
+  </table>
+</form>
\ No newline at end of file

Propchange: ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/applications/marketing/webapp/sfa/contact/mergeContacts.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/marketing/widget/sfa/ContactScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/ContactScreens.xml?rev=654579&r1=654578&r2=654579&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/ContactScreens.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/ContactScreens.xml Thu May  8 09:47:55 2008
@@ -56,6 +56,11 @@
                                                    </condition>
                                                    <widgets>
                                                        <include-form name="ListContacts" location="component://marketing/widget/sfa/forms/ContactForms.xml"/>
+                                                        <label text="&amp;nbsp;&lt;br/&gt;&lt;br/&gt;"/> 
+                                                        <container style="h3">
+                                                            <label text="${uiLabelMap.SfaMergeContacts}"/>
+                                                        </container>
+                                                        <include-form name="MergeContacts" location="component://marketing/widget/sfa/forms/ContactForms.xml"/>                                                       
                                                    </widgets>
                                                    <fail-widgets>
                                                        <container style="h3">
@@ -83,27 +88,69 @@
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
-                          <container style="screenlet">
-                                <container style="screenlet-title-bar">
-                                    <container style="h3">
-                                        <section>
-                                            <widgets>
-                                                <label text="${uiLabelMap.CommonCreate} ${uiLabelMap.SfaContact}"/>
-                                            </widgets>
-                                        </section>
-                                    </container>
-                                </container>
-                                <container style="screenlet-body">
+                        <container style="screenlet">
+                            <container style="screenlet-title-bar">
+                                <container style="h3">
                                     <section>
                                         <widgets>
-                                            <include-form name="CreateContact" location="component://marketing/widget/sfa/forms/ContactForms.xml"/>
+                                            <label text="${uiLabelMap.CommonCreate} ${uiLabelMap.SfaContact}"/>
                                         </widgets>
                                     </section>
-                                </container> 
+                                </container>
                             </container>
+                            <container style="screenlet-body">
+                                <section>
+                                    <widgets>
+                                        <include-form name="CreateContact" location="component://marketing/widget/sfa/forms/ContactForms.xml"/>
+                                    </widgets>
+                                </section>
+                            </container> 
+                        </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>
     </screen>
+    <screen name="MergeContacts">
+        <section>
+            <actions>
+                <set field="titleProperty" value="PageTitleCreateContact"/>
+                <set field="tabButtonItem" value="Contacts"/>
+                <set field="contactmechId1" ></set>
+                <script location="component://marketing/webapp/sfa/WEB-INF/action/mergeContacts.bsh"/>
+            </actions>
+            <widgets>
+                <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
+                    <decorator-section name="body">
+                        <container style="screenlet">
+                            <container style="screenlet-title-bar">
+                                <container style="h3">
+                                    <section>
+                                        <widgets>
+                                            <label text="${uiLabelMap.SfaMergeContacts}"/>
+                                        </widgets>
+                                    </section>
+                                </container> 
+                            </container>
+                            <container style="screenlet-body">
+                                <section>
+                                    <condition>
+                                      <if-compare-field field-name="parameters.partyIdFrom" operator="not-equals" to-field-name="parameters.partyIdTo"/>
+                                    </condition>
+                                    <widgets>
+                                        <platform-specific>
+                                            <html><html-template location="component://marketing/webapp/sfa/contact/mergeContacts.ftl"/></html>
+                                        </platform-specific>
+                                    </widgets>
+                                    <fail-widgets>
+                                      <label text="${uiLabelMap.SfaCanNotMergeSameContact}" style="h3"></label>
+                                    </fail-widgets>
+                                </section>
+                            </container> 
+                        </container>
+                     </decorator-section>
+                 </decorator-screen>
+             </widgets>
+         </section>
+    </screen>          
 </screens>

Modified: ofbiz/trunk/applications/marketing/widget/sfa/forms/ContactForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/forms/ContactForms.xml?rev=654579&r1=654578&r2=654579&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/forms/ContactForms.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/forms/ContactForms.xml Thu May  8 09:47:55 2008
@@ -24,9 +24,6 @@
     <form name="ListContacts" type="list" list-name="partyList" list-entry-name="partyRow" paginate-target="FindContact"
         odd-row-style="alternate-row" default-table-style="basic-table hover-bar" separate-columns="true">
         <row-actions>
-            <entity-one entity-name="PartyGroup" value-name="partyGroup">
-                <field-map field-name="partyId" env-name="partyRow.partyId"/>
-            </entity-one>
             <entity-one entity-name="Person" value-name="person">
                 <field-map field-name="partyId" env-name="partyRow.partyId"/>
             </entity-one>
@@ -47,7 +44,7 @@
         <field name="address1" title="${uiLabelMap.CommonAddress1}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="50" maxlength="60"/></field>
         <field name="address2" title="${uiLabelMap.CommonAddress2}"><text size="50" maxlength="60"/></field>
         <field name="city" title="${uiLabelMap.CommonCity}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="30" maxlength="60"/></field>
-        <field name="state" title="${uiLabelMap.CommonState}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required">
+        <field name="stateProvinceGeoId" title="${uiLabelMap.CommonState}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required">
             <drop-down allow-empty="true">
                 <entity-options entity-name="Geo" key-field-name="geoId" description="${geoId} - ${geoName}">
                     <entity-constraint name="geoTypeId" operator="in" value="STATE,PROVINCE"/>
@@ -56,7 +53,7 @@
             </drop-down>
         </field>
         <field name="postalCode" title="${uiLabelMap.CommonZipPostalCode}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required"><text size="10" maxlength="30"/></field>
-        <field name="country" title="${uiLabelMap.CommonCountry}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required">
+        <field name="countryGeoId" title="${uiLabelMap.CommonCountry}" tooltip="${uiLabelMap.CommonRequired}" widget-style="required">
             <drop-down allow-empty="false" no-current-selected-key="${defaultCountryGeoId}">
                 <entity-options entity-name="Geo" key-field-name="geoId" description="${geoId}: ${geoName}">
                     <entity-constraint name="geoTypeId" value="COUNTRY"/>
@@ -73,4 +70,17 @@
         <field name="emailAddress" title="${uiLabelMap.CommonEmail}"><text size="50" maxlength="60"/></field>
         <field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="smallSubmit"><submit button-type="button"/></field>
     </form>
+    <form name="MergeContacts" type="single"  target="MergeContacts">
+        <field name="partyIdFrom" title="${uiLabelMap.SfaMergeParty}" position="1">
+            <drop-down allow-empty="false">
+               <list-options list-name="partyList" key-name="contact.partyId"  list-entry-name="contact" description="${contact.partyId}"/>
+            </drop-down>
+        </field>
+        <field name="partyIdTo" title="${uiLabelMap.AccountingToParty}" position="2">
+            <drop-down allow-empty="false">
+                <list-options list-name="partyList" key-name="contact.partyId"  list-entry-name="contact" description="${contact.partyId}"/>
+            </drop-down>
+        </field>
+        <field name="submitButton" position="3" title="${uiLabelMap.SfaMergeContacts}" widget-style="buttontext" tooltip-style="button-text"><submit button-type="text-link"/></field>
+    </form>
 </forms>