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/15 12:55:13 UTC

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

Author: mor
Date: Thu May 15 03:55:12 2008
New Revision: 656583

URL: http://svn.apache.org/viewvc?rev=656583&view=rev
Log:
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)

Modified:
    ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
    ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml
    ofbiz/trunk/applications/marketing/servicedef/services.xml
    ofbiz/trunk/applications/marketing/webapp/sfa/WEB-INF/controller.xml
    ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml
    ofbiz/trunk/applications/marketing/widget/sfa/LeadScreens.xml
    ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml
    ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml

Modified: ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml (original)
+++ ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml Thu May 15 03:55:12 2008
@@ -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>

Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml (original)
+++ ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml Thu May 15 03:55:12 2008
@@ -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>

Modified: ofbiz/trunk/applications/marketing/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/servicedef/services.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/marketing/servicedef/services.xml Thu May 15 03:55:12 2008
@@ -452,4 +452,8 @@
         </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>
\ No newline at end of file

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=656583&r1=656582&r2=656583&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 15 03:55:12 2008
@@ -94,6 +94,16 @@
         <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 @@
     <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>
\ No newline at end of file

Modified: ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml Thu May 15 03:55:12 2008
@@ -124,6 +124,7 @@
         <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"/>
@@ -132,6 +133,17 @@
                 <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>
                                 <if-has-permission permission="PARTYMGR" action="_VIEW"/>

Modified: ofbiz/trunk/applications/marketing/widget/sfa/LeadScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/LeadScreens.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/LeadScreens.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/LeadScreens.xml Thu May 15 03:55:12 2008
@@ -24,16 +24,14 @@
         <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 @@
         <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 @@
             </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>

Modified: ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml Thu May 15 03:55:12 2008
@@ -46,4 +46,9 @@
             <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>

Modified: ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml?rev=656583&r1=656582&r2=656583&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml (original)
+++ ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml Thu May 15 03:55:12 2008
@@ -34,7 +34,7 @@
             </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 @@
         <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 @@
             </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 @@
         <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>