This is an automated email from the ASF dual-hosted git repository.

akashjain pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 5ef3e5e  Fixed: Quick Add Lead does not work without group name 
(OFBIZ-11896)
5ef3e5e is described below

commit 5ef3e5e4f37685d57c8daf3c8dd064a97b012d72
Author: Akash Jain <akash.j...@hotwaxsystems.com>
AuthorDate: Sat Aug 29 21:45:31 2020 +0530

    Fixed: Quick Add Lead does not work without group name (OFBIZ-11896)
    
    Thanks, Pawan Verma for reporting the issue.
---
 .../marketing/groovyScripts/sfa/lead/LeadServices.groovy       | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy 
b/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy
index 9480ecf..61d1e93 100644
--- a/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy
+++ b/applications/marketing/groovyScripts/sfa/lead/LeadServices.groovy
@@ -32,14 +32,14 @@ def createLead() {
     String partyGroupPartyId
     // Check if Person or PartyGroup name is supplied
     if ((!parameters.firstName || !parameters.lastName) && 
!parameters.groupName) {
-        return error(UtilProperties.getMessage("MarketingUiLabels", 
+        return error(UtilProperties.getMessage("MarketingUiLabels",
                 "SfaFirstNameLastNameAndCompanyNameMissingError", locale))
     }
     run service: "ensurePartyRole", with: [partyId: userLogin.partyId,
                                            roleTypeId: "OWNER"]
     // PartyRole check end
     parameters.roleTypeId = "LEAD"
-    
+
     Map serviceResult = run service: "createPersonRoleAndContactMechs", with: 
parameters
     if (ServiceUtil.isError(serviceResult)) {
         return serviceResult
@@ -58,6 +58,7 @@ def createLead() {
 
     // Now create PartyGroup corresponding to the companyName, if its not null 
and then set up
     // relationship of Person and PartyGroup as Employee and title
+    if (parameters.groupName) {
     parameters.partyTypeId = "PARTY_GROUP"
     if (!leadContactPartyId) {
         parameters.roleTypeId = "ACCOUNT_LEAD"
@@ -81,7 +82,8 @@ def createLead() {
             return serviceResult
         }
     }
-    if (leadContactPartyId) {
+    }
+    if (leadContactPartyId && partyGroupPartyId) {
         run service: "createPartyRelationship", with: [partyIdFrom: 
partyGroupPartyId,
                                                        partyIdTo: 
leadContactPartyId,
                                                        roleTypeIdFrom: 
"ACCOUNT_LEAD",
@@ -89,11 +91,13 @@ def createLead() {
                                                        positionTitle: 
parameters.title,
                                                        
partyRelationshipTypeId: "EMPLOYMENT"]
     }
+    if (partyGroupPartyId) {
     run service: "createPartyRelationship", with: [partyIdFrom: 
userLogin.partyId,
                                                    partyIdTo: 
partyGroupPartyId,
                                                    roleTypeIdFrom: "OWNER",
                                                    roleTypeIdTo: 
"ACCOUNT_LEAD",
                                                    partyRelationshipTypeId: 
"LEAD_OWNER"]
+    }
 
     if (parameters.dataSourceId) {
         serviceResult = run service: "createPartyDataSource", with: [partyId: 
leadContactPartyId,

Reply via email to