Author: hansbak
Date: Wed Jun 4 01:40:00 2008 New Revision: 663034 URL: http://svn.apache.org/viewvc?rev=663034&view=rev Log: fixed the lead to contact convert Modified: ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml ofbiz/trunk/applications/marketing/servicedef/services.xml ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/setRoleVars.groovy 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=663034&r1=663033&r2=663034&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 Wed Jun 4 01:40:00 2008 @@ -119,50 +119,54 @@ </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.partyId" from-field="parameters.partyId"/> <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"/> + <field-map field-name="partyIdTo" env-name="parameters.partyId"/> + <field-map field-name="roleTypeIdTo" value="LEAD"/> + <field-map field-name="roleTypeIdFrom" value="ACCOUNT_LEAD"/> <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="partyRelationship.partyIdFrom"/> + <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"/> + <set-service-fields service-name="updatePartyRelationship" map-name="partyRelationship" to-map-name="deletePartyRelationship"/> + <call-service service-name="deletePartyRelationship" in-map-name="deletePartyRelationship"/> + <set field="partyGroupId" from-field="partyRelationship.partyIdFrom"/> <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> + <set field="partyGroupId" from-field="parameters.partyGroupId"/> + </else> </if-not-empty> - <clear-field field-name="partyRelationshipCtx"/> - <if-empty field-name="accountId"> - <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"/> + + <if-empty field-name="partyGroupId"> + <add-error><fail-message message="Party Group ID not found in realtionship AND not supplied"/></add-error> </if-empty> - <set field="updatePartyCtx.partyId" from-field="leadPartyId"/> + <check-errors/> + + <set field="partyRoleCtx.partyId" from-field="partyGroupId"/> + <set field="partyRoleCtx.roleTypeId" value="ACCOUNT"/> + <call-service service-name="createPartyRole" in-map-name="partyRoleCtx"/> + <set field="partyRoleCtx.roleTypeId" value="ACCOUNT_LEAD"/> + <call-service service-name="deletePartyRole" in-map-name="partyRoleCtx"/> + <set field="partyRoleCtx.partyId" from-field="parameters.partyId"/> + <!--set field="partyRoleCtx.roleTypeId" value="LEAD"/> + <call-service service-name="deletePartyRole" in-map-name="partyRoleCtx"/--> + + <!-- create new relationship --> + <set field="partyRelationshipCtx.partyIdFrom" from-field="partyGroupId"/> + <set field="partyRelationshipCtx.roleTypeIdFrom" from-field="ACCOUNT"/> + <set field="partyRelationshipCtx.partyIdTo" from-field="parameters.partyId"/> + <set field="partyRelationshipCtx.roleTypeIdTo" from-field="CONTACT"/> + <set field="partyRelationshipCtx.partyRelationshipTypeId" from-field="EMPLOYMENT"/> + <call-service service-name="createPartyRelationship" in-map-name="partyRelationshipCtx"/> + + <set field="updatePartyCtx.partyId" from-field="parameters.partyId"/> <set field="updatePartyCtx.statusId" value="LEAD_CONVERTED"/> - <call-service service-name="setPartyStatus" in-map-name="updatePartyCtx"/> + <call-service service-name="setPartyStatus" in-map-name="updatePartyCtx"/> + <field-to-result field-name="parameters.partyId" result-name="partyId"/> + <field-to-result field-name="partyGroupId"/> + <set field="successMessage" value="Lead ${parameters.partyId} succesfully converted to contact"/> </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=663034&r1=663033&r2=663034&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/servicedef/services.xml (original) +++ ofbiz/trunk/applications/marketing/servicedef/services.xml Wed Jun 4 01:40:00 2008 @@ -456,8 +456,9 @@ <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"/> + <attribute name="partyId" type="String" mode="INOUT" optional="false"/> + <attribute name="partyGroupId" type="String" mode="IN" optional="true"/> + <attribute name="partyGroupId" type="String" mode="OUT" optional="false"/> </service> <!-- VCard services --> Modified: ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml?rev=663034&r1=663033&r2=663034&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml (original) +++ ofbiz/trunk/applications/marketing/widget/sfa/CommonScreens.xml Wed Jun 4 01:40:00 2008 @@ -222,6 +222,8 @@ <script location="component://party/webapp/partymgr/WEB-INF/actions/party/viewprofile.groovy"/> <script location="component://party/webapp/partymgr/WEB-INF/actions/party/getUserLoginPrimaryEmail.groovy"/> <script location="component://party/webapp/partymgr/WEB-INF/actions/party/setRoleVars.groovy"/> + <set field="parameters.partyId" from-field="partyId"/> + <set field="parameters.partyGroupId" from-field="partyGroupId"/> </actions> <widgets> <section> @@ -303,7 +305,14 @@ </condition> <widgets> <container style="profile-left"> - <include-screen name="Party" location="component://party/widget/partymgr/ProfileScreens.xml"/> + <section> + <actions> + <set field="parameters.partyId" from-field="partyId"/> + </actions> + <widgets> + <include-screen name="Party" location="component://party/widget/partymgr/ProfileScreens.xml"/> + </widgets> + </section> <section> <actions> <set field="parameters.partyId" from-field="partyGroupId"/> @@ -325,7 +334,6 @@ <not><if-empty field-name="contactDescription"/></not> </condition> <widgets> - <label style="h1" text="Party ${party.partyId} in the Role of ${contactDescription}"/> <container style="profile-left"> <include-screen name="Party" location="component://party/widget/partymgr/ProfileScreens.xml"/> <include-screen name="Contact" location="component://party/widget/partymgr/ProfileScreens.xml"/> Modified: ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml?rev=663034&r1=663033&r2=663034&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml (original) +++ ofbiz/trunk/applications/marketing/widget/sfa/SfaMenus.xml Wed Jun 4 01:40:00 2008 @@ -61,16 +61,16 @@ <menu name="LeadTabBar" menu-container-style="button-bar tab-bar no-clear" default-selected-style="selected" type="simple" selected-menuitem-context-field-name="tabButtonItem"> <menu-item name="profile" title="${uiLabelMap.PartyProfile}"> - <link target="viewprofile?partyId=${parameters.partyId}"/> + <link target="viewprofile?partyId=${parameters.partyId}&partyGroupId=${parameters.partyGroupId}"/> </menu-item> <menu-item name="ConvertLead" title="${uiLabelMap.SfaConvertLead}"> - <link target="ConvertLead?partyId=${parameters.partyId}"/> + <link target="ConvertLead?partyId=${parameters.partyId}&partyGroupId=${parameters.partyGroupId}"/> </menu-item> <menu-item name="CloneLead" title="${uiLabelMap.SfaCloneLead}"> - <link target="CloneLead?partyId=${parameters.partyId}"/> + <link target="CloneLead?partyId=${parameters.partyId}&partyGroupId=${parameters.partyGroupId}"/> </menu-item> <menu-item name="MergeLeads" title="${uiLabelMap.SfaMergeLeads}"> - <link target="MergeLeads"/> + <link target="MergeLeads?partyId=${parameters.partyId}&partyGroupId=${parameters.partyGroupId}"/> </menu-item> </menu> 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=663034&r1=663033&r2=663034&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml (original) +++ ofbiz/trunk/applications/marketing/widget/sfa/forms/LeadForms.xml Wed Jun 4 01:40:00 2008 @@ -80,12 +80,15 @@ <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.PartyId"></set> - </actions> - <field name="leadPartyId" title="${uiLabelMap.SfaCreateContactForLead}"><display description="${bsh:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, "${leadPartyId}", false)} : [${leadPartyId}]"/></field> - <field name="partyId" title="${uiLabelMap.SfaAccountName}" tooltip="${uiLabelMap.SfaSelectExistingAccountOrLeaveBlankToCreateNew}"> + <form name="ConvertLead" type="single" target="convertLead"> + <field name="partyId"><hidden value="${parameters.partyId}"/></field> + <field name="leadId" entry-name="partyId" title="${uiLabelMap.SfaCreateContactForLead}"> + <display-entity also-hidden="false" entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${firstName} ${lastName} [${parameters.partyId}]"/> + </field> + <field name="partyGroupId" title="${uiLabelMap.SfaCreateAccountForLead}" use-when="parameters.get("partyGroupId")!="""> + <display-entity also-hidden="false" entity-name="PartyNameView" key-field-name="partyId" description="${groupName}${firstName} ${lastName} [${parameters.partyGroupId}]"/> + </field> + <field name="partyGroupId" title="${uiLabelMap.SfaAccountName}" tooltip="${uiLabelMap.SfaSelectExistingAccountOrLeaveBlankToCreateNew}" use-when="parameters.get("partyGroupId")=="""> <drop-down allow-empty="true" current-description=""> <entity-options entity-name="PartyRole" description="${bsh:org.ofbiz.party.party.PartyHelper.getPartyName(delegator, "${partyId}", false)} : [${partyId}]" key-field-name="partyId"> <entity-constraint name="roleTypeId" operator="equals" value="ACCOUNT"/> Modified: ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/setRoleVars.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/setRoleVars.groovy?rev=663034&r1=663033&r2=663034&view=diff ============================================================================== --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/setRoleVars.groovy (original) +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/setRoleVars.groovy Wed Jun 4 01:40:00 2008 @@ -39,7 +39,7 @@ } roleTypeAndParty = delegator.findByAnd("RoleTypeAndParty", ['partyId': parameters.partyId, 'roleTypeId': 'ACCOUNT_LEAD']); if (roleTypeAndParty) { - context.leadDescription = ROleTypeAndParty.get(0).description; + context.leadDescription = roleTypeAndParty.get(0).description; partyRelationships = EntityUtil.filterByDate(delegator.findByAnd("PartyRelationship", ["partyIdFrom": parameters.partyId, "roleTypeIdFrom": "ACCOUNT_LEAD", "roleTypeIdTo": "LEAD", "partyRelationshipTypeId": "EMPLOYMENT"])); if (partyRelationships) { context.partyGroupId = parameters.partyId; |
Free forum by Nabble | Edit this page |