svn commit: r1750091 - in /ofbiz/branches/release14.12/applications: marketing/widget/sfa/forms/AccountForms.xml party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1750091 - in /ofbiz/branches/release14.12/applications: marketing/widget/sfa/forms/AccountForms.xml party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy

ashish-18
Author: ashish
Date: Fri Jun 24 13:24:38 2016
New Revision: 1750091

URL: http://svn.apache.org/viewvc?rev=1750091&view=rev
Log:
Applied patch from trunk r1750089.
=========================================================================
Applied patch from jira issue - OFBIZ-6293 - If a party is both a contact and a lead, then SFA profile renders screens for both.
Thanks Pierre for creating the issue and Thanks Ravi for providing the patch.

Modified:
    ofbiz/branches/release14.12/applications/marketing/widget/sfa/forms/AccountForms.xml
    ofbiz/branches/release14.12/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy

Modified: ofbiz/branches/release14.12/applications/marketing/widget/sfa/forms/AccountForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/marketing/widget/sfa/forms/AccountForms.xml?rev=1750091&r1=1750090&r2=1750091&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/marketing/widget/sfa/forms/AccountForms.xml (original)
+++ ofbiz/branches/release14.12/applications/marketing/widget/sfa/forms/AccountForms.xml Fri Jun 24 13:24:38 2016
@@ -138,8 +138,9 @@ under the License.
             <set field="existRelationship" from-field="existRelationships[0]"/>
         </row-actions>
         <field name="partyId" title="${uiLabelMap.PartyPartyId}">
-            <hyperlink target="viewprofile" description="${partyName} [${partyId}]">
+            <hyperlink target="viewprofile" description="${partyName} [${partyId}]" >
                 <parameter param-name="partyId"/>
+                <parameter param-name="roleTypeId"/>
             </hyperlink>
         </field>
         <field name="emailAddress"><display description="${emailAddresses[0].infoString}"/></field>

Modified: ofbiz/branches/release14.12/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy?rev=1750091&r1=1750090&r2=1750091&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy (original)
+++ ofbiz/branches/release14.12/applications/party/webapp/partymgr/WEB-INF/actions/party/SetRoleVars.groovy Fri Jun 24 13:24:38 2016
@@ -19,30 +19,26 @@
  import org.ofbiz.entity.*;
  import org.ofbiz.entity.util.EntityUtil;
 
- roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "ACCOUNT").queryList();
- if (roleTypeAndParty) {
-     context.accountDescription = roleTypeAndParty[0].description;
- }
-
- roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "CONTACT").queryList();
- if (roleTypeAndParty) {
-     context.contactDescription = roleTypeAndParty.get(0).description;
- }
- roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "LEAD").queryList();
- if (roleTypeAndParty) {
-     context.leadDescription = roleTypeAndParty.get(0).description;
-     partyRelationships = from("PartyRelationship").where("partyIdTo", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryList();
-     if (partyRelationships) {
-         context.partyGroupId = partyRelationships.get(0).partyIdFrom;
-         context.partyId = parameters.partyId;
-     }
- }
- roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", "ACCOUNT_LEAD").queryList();
- if (roleTypeAndParty) {
-     context.leadDescription = roleTypeAndParty.get(0).description;
-     partyRelationships = from("PartyRelationship").where("partyIdFrom", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryList();
-     if (partyRelationships) {
-         context.partyGroupId = parameters.partyId;
-         context.partyId = partyRelationships.get(0).partyIdTo;
-     }
- }
+roleTypeId = parameters.roleTypeId;
+roleTypeAndParty = from("RoleTypeAndParty").where("partyId", parameters.partyId, "roleTypeId", roleTypeId).queryFirst();
+if (roleTypeAndParty) {
+    if ("ACCOUNT".equals(roleTypeId)) {
+        context.accountDescription = roleTypeAndParty.description;
+    } else if ("CONTACT".equals(roleTypeId)) {
+        context.contactDescription = roleTypeAndParty.description;
+    } else if ("LEAD".equals(roleTypeId)) {
+        context.leadDescription = roleTypeAndParty.description;
+        partyRelationships = from("PartyRelationship").where("partyIdTo", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryFirst();
+        if (partyRelationships) {
+            context.partyGroupId = partyRelationships.partyIdFrom;
+            context.partyId = parameters.partyId;
+        }
+    } else if ("ACCOUNT_LEAD".equals(roleTypeId)) {
+        context.leadDescription = roleTypeAndParty.description;
+        partyRelationships = from("PartyRelationship").where("partyIdFrom", parameters.partyId, "roleTypeIdFrom", "ACCOUNT_LEAD", "roleTypeIdTo", "LEAD", "partyRelationshipTypeId", "EMPLOYMENT").filterByDate().queryFirst();
+        if (partyRelationships) {
+            context.partyGroupId = parameters.partyId;
+            context.partyId = partyRelationships.partyIdTo;
+        }
+    }
+}