patch from Jyotsna Rathore for Converting Lead to Contact/Accont in SFA for Jira Issue OFBIZ-1792 (https://issues.apache.org/jira/browse/OFBIZ-1792)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@656583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vikas Mayur
2008-05-15 10:55:12 +00:00
parent 46fcf2a813
commit ad66f1bedd
8 changed files with 133 additions and 8 deletions
@@ -1125,6 +1125,9 @@
<property key="SfaAcccounts">
<value xml:lang="en">Accounts</value>
</property>
<property key="SfaAccountName">
<value xml:lang="en">Account Name</value>
</property>
<property key="SfaCampaigns">
<value xml:lang="en">Campaigns</value>
</property>
@@ -1146,6 +1149,12 @@
<property key="SfaContacts">
<value xml:lang="en">Contacts</value>
</property>
<property key="SfaConvertLead">
<value xml:lang="en">Convert Lead</value>
</property>
<property key="SfaCreateContactForLead">
<value xml:lang="en">Create contact for lead</value>
</property>
<property key="SfaDocuments">
<value xml:lang="en">Documents</value>
</property>
@@ -1236,6 +1245,10 @@
<property key="SfaSecondContact">
<value xml:lang="en">Second Contact</value>
</property>
<property key="SfaSelectExistingAccountOrLeaveBlankToCreateNew">
<value xml:lang="en">Either select existing account or leave blank to create new account"</value>
</property>
<property key="SfaType">
<value xml:lang="en">Type</value>
</property>
@@ -81,4 +81,47 @@
</if-not-empty>
<field-to-result field-name="partyId"/>
</simple-method>
<simple-method method-name="convertLeadToContact" short-description="Convert a lead person into a contact and associated lead group to an account">
<set field="leadPartyId" from-field="parameters.leadPartyId"/>
<set field="createPartyRoleCtx.partyId" from-field="leadPartyId"/>
<set field="createPartyRoleCtx.roleTypeId" value="CONTACT"/>
<call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
<clear-field field-name="createPartyRoleCtx"/>
<entity-and entity-name="PartyRelationship" list-name="partyRelationships">
<field-map field-name="partyIdTo" env-name="leadPartyId"/>
<field-map field-name="roleTypeIdFrom" value="LEAD"/>
<field-map field-name="roleTypeIdTo" value="EMPLOYEE"/>
<order-by field-name="-fromDate"/>
</entity-and>
<filter-list-by-date list-name="partyRelationships" to-list-name="partyRelationships"/>
<first-from-list list-name="partyRelationships" entry-name="partyRelationship"/>
<set field="accountId" from-field="parameters.partyId"/>
<if-not-empty field-name="partyRelationship">
<if-empty field-name="accountId">
<set field="accountId" from-field="partyRelationship.partyIdFrom"/>
<set field="createPartyRoleCtx.roleTypeId" value="ACCOUNT"/>
<call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
<else>
<now-timestamp-to-env env-name="thruDate"/>
<set field="partyRelationshipCtx.partyIdFrom" from-field="partyRelationship.partyIdFrom"/>
<set field="partyRelationshipCtx.roleTypeIdFrom" from-field="partyRelationship.roleTypeIdFrom"/>
<set field="partyRelationshipCtx.partyIdTo" from-field="partyRelationship.partyIdTo"/>
<set field="partyRelationshipCtx.roleTypeIdTo" from-field="partyRelationship.roleTypeIdTo"/>
<set field="partyRelationshipCtx.fromDate" from-field="partyRelationship.fromDate"/>
<set field="partyRelationshipCtx.thruDate" from-field="thruDate"/>
<call-service service-name="updatePartyRelationship" in-map-name="partyRelationshipCtx"/>
</else>
</if-empty>
</if-not-empty>
<clear-field field-name="partyRelationshipCtx"/>
<set field="partyRelationshipCtx.partyIdFrom" from-field="accountId"/>
<set field="partyRelationshipCtx.partyIdTo" from-field="leadPartyId"/>
<set field="partyRelationshipCtx.roleTypeIdFrom" value="ACCOUNT"/>
<set field="partyRelationshipCtx.roleTypeIdTo" value="CONTACT"/>
<set field="partyRelationshipCtx.partyRelationshipTypeId" value="CONTACT_REL"/>
<call-service service-name="createPartyRelationship" in-map-name="partyRelationshipCtx"/>
</simple-method>
</simple-methods>
@@ -452,4 +452,8 @@ under the License.
</auto-attributes>
<attribute name="emailAddress" type="String" mode="IN" optional="true"/>
</service>
<service name="convertLeadToContact" engine="simple" location="org/ofbiz/sfa/lead/LeadServices.xml" invoke="convertLeadToContact">
<attribute name="leadPartyId" type="String" mode="IN" optional="false"/>
<attribute name="partyId" type="String" mode="IN" optional="true"/>
</service>
</services>
@@ -94,6 +94,16 @@ under the License.
<response name="success" type="view" value="viewprofile"/>
<response name="error" type="view" value="CreateLead"/>
</request-map>
<request-map uri="ConvertLead">
<security https="true" auth="true"/>
<response name="success" type="view" value="ConvertLead"/>
</request-map>
<request-map uri="convertLead">
<security https="true" auth="true"/>
<event type="service" invoke="convertLeadToContact"/>
<response name="success" type="view" value="viewprofile"/>
<response name="error" type="view" value="ConvertLead"/>
</request-map>
<request-map uri="viewLead">
<security https="true" auth="true"/>
<response name="success" type="view" value="viewLead"/>
@@ -138,5 +148,6 @@ under the License.
<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"/>
<view-map name="ConvertLead" type="screen" page="component://marketing/widget/sfa/LeadScreens.xml#ConvertLead"/>
<!-- end of view mappings -->
</site-conf>
@@ -124,6 +124,7 @@ under the License.
<section>
<actions>
<set field="partyId" from-field="parameters.partyId"/>
<set field="partyTypeId" from-field="parameters.partyTypeId"/>
<entity-one entity-name="Party" value-name="party"/>
<entity-one entity-name="Person" value-name="lookupPerson"/>
<entity-one entity-name="PartyGroup" value-name="lookupGroup"/>
@@ -131,6 +132,17 @@ under the License.
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
<condition>
<and>
<if-compare field-name="partyTypeId" operator="equals" value="PERSON"/>
<if-compare field-name="parameters.roleTypeId" operator="equals" value="LEAD"/>
</and>
</condition>
<widgets>
<include-menu name="LeadTabBar" location="component://marketing/widget/sfa/SfaMenus.xml"/>
</widgets>
</section>
<section>
<!-- do check for PARTYMGR, _VIEW permission -->
<condition>
@@ -24,16 +24,14 @@ under the License.
<section>
<actions>
<set field="roleTypeId" value="LEAD"/>
<set field="partyTypeId" value="PERSON"/>
<set field="tabButtonItem" value="Leads"/>
<service service-name="findParty" auto-field-map="true"/>
</actions>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<section>
<actions>
<service service-name="findParty" auto-field-map="true"/>
<set field="tabButtonItem" value=""/>
</actions>
<widgets>
<container><link target="CreateLead" text="${uiLabelMap.CommonCreate} ${uiLabelMap.SfaLead}" style="buttontext"/></container>
<section>
@@ -78,7 +76,6 @@ under the License.
<section>
<actions>
<set field="titleProperty" value="PageTitleCreateLead"/>
<set field="leadType" from-field="parameters.leadType"/>
<set field="tabButtonItem" value="Leads"/>
</actions>
<widgets>
@@ -105,4 +102,30 @@ under the License.
</widgets>
</section>
</screen>
<screen name="ConvertLead">
<section>
<widgets>
<decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
<decorator-section name="body">
<container style="screenlet">
<container style="screenlet-title-bar boxhead">
<section>
<widgets>
<label text="${uiLabelMap.SfaConvertLead}"/>
</widgets>
</section>
</container>
<container style="screenlet-body">
<section>
<widgets>
<include-form name="ConvertLead" location="component://marketing/widget/sfa/forms/LeadForms.xml"/>
</widgets>
</section>
</container>
</container>
</decorator-section>
</decorator-screen>
</widgets>
</section>
</screen>
</screens>
@@ -46,4 +46,9 @@ under the License.
<link target="EditOpportunity?salesOpportunityId=${parameters.salesOpportunityId}"/>
</menu-item>
</menu>
<menu name="LeadTabBar" type="simple" menu-container-style="button-bar tab-bar" default-selected-style="selected">
<menu-item name="convertLead" title="${uiLabelMap.SfaConvertLead}">
<link target="ConvertLead?leadPartyId=${parameters.partyId}"/>
</menu-item>
</menu>
</menus>
@@ -34,7 +34,7 @@ under the License.
</entity-one>
</row-actions>
<field name="partyId" title="${uiLabelMap.PartyPartyId}">
<hyperlink target="viewprofile?partyId=${partyRow.partyId}" description="${partyRow.partyId}" target-type="inter-app"/>
<hyperlink target="viewprofile?partyId=${partyRow.partyId}&amp;partyTypeId=${partyRow.partyTypeId}&amp;roleTypeId=LEAD" description="${partyRow.partyId}" target-type="inter-app"/>
</field>
<field name="partyName" title="${uiLabelMap.PartyName}" use-when="partyGroup != null"><display description="${partyGroup.groupName}"/></field>
<field name="partyName" title="${uiLabelMap.PartyName}" use-when="person != null"><display description="${person.lastName}, ${person.firstName}"/></field>
@@ -53,7 +53,7 @@ under the License.
<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"/>
@@ -62,7 +62,7 @@ under the License.
</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"/>
@@ -81,4 +81,18 @@ under the License.
<field name="leadSource" title="${uiLabelMap.SfaLeadSource}"><text size="50" maxlength="60"/></field>
<field name="submitButton" title="${uiLabelMap.CommonSave}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
<form name="ConvertLead" type="single" target="convertLead" id="ConvertLead" >
<actions>
<set field="leadPartyId" from-field="parameters.leadPartyId"></set>
</actions>
<field name="leadPartyId" title="${uiLabelMap.SfaCreateContactForLead}"><display description="${bsh:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, &quot;${leadPartyId}&quot;, false)} : [${leadPartyId}]"/></field>
<field name="partyId" title="${uiLabelMap.SfaAccountName}" tooltip="${uiLabelMap.SfaSelectExistingAccountOrLeaveBlankToCreateNew}">
<drop-down allow-empty="true" current-description="">
<entity-options entity-name="PartyRole" description="${bsh:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, &quot;${partyId}&quot;, false)} : [${partyId}]" key-field-name="partyId">
<entity-constraint name="roleTypeId" operator="equals" value="ACCOUNT"/>
</entity-options>
</drop-down>
</field>
<field name="submitButton"><submit button-type="button"/></field>
</form>
</forms>