svn commit: r1714974 - /ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml

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

svn commit: r1714974 - /ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml

pgil
Author: pgil
Date: Wed Nov 18 11:50:16 2015
New Revision: 1714974

URL: http://svn.apache.org/viewvc?rev=1714974&view=rev
Log:
OFBIZ-6703 Cannot create more than one lead in the SFA component by same user

Replace createPartyRole service call with ensurePartyRole, avoiding duplicate pk creation error.

Thanks Taher for reporting

Modified:
    ofbiz/trunk/applications/marketing/script/org/ofbiz/sfa/lead/LeadServices.xml

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=1714974&r1=1714973&r2=1714974&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 Nov 18 11:50:16 2015
@@ -38,17 +38,10 @@
             </then>
         </if>
         <check-errors/>
-        <set field="createPartyRoleCtx.partyId" from-field="userLogin.partyId"/>
-        <set field="createPartyRoleCtx.roleTypeId" value="OWNER"/>
+        <set field="ensurePartyRoleCtx.partyId" from-field="userLogin.partyId"/>
+        <set field="ensurePartyRoleCtx.roleTypeId" value="OWNER"/>
         
-        <!-- PartyRole check start - if the user does not have OWNER roleType then add it -->
-        <entity-one entity-name="PartyRole" value-field="roleFound">
-            <field-map field-name="partyId" from-field="createPartyRoleCtx.partyId"/>
-            <field-map field-name="roleTypeId" from-field="createPartyRoleCtx.roleTypeId"/>
-        </entity-one>
-        <if-empty field="roleFound">
-            <call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
-        </if-empty>
+        <call-service service-name="ensurePartyRole" in-map-name="ensurePartyRoleCtx"/>
         <!-- PartyRole check end -->
 
         <if>
@@ -191,7 +184,7 @@
 
         <set field="partyRoleCtx.partyId" from-field="partyGroupId"/>
         <set field="partyRoleCtx.roleTypeId" value="ACCOUNT"/>
-        <call-service service-name="createPartyRole" in-map-name="partyRoleCtx"/>
+        <call-service service-name="ensurePartyRole" in-map-name="partyRoleCtx"/>
 
         <set field="partyRelationshipCtx.partyIdFrom" from-field="userLogin.partyId"/>
         <set field="partyRelationshipCtx.partyIdTo" from-field="partyGroupId"/>