Author: taher
Date: Wed Oct 28 14:16:00 2015
New Revision: 1711020

URL: http://svn.apache.org/viewvc?rev=1711020&view=rev
Log:
Fix a bug in createLead service as described in OFBIZ-6703

Fix a bug in createLead service in which a system user cannot create
a lead more than one time in the SFA screens. The reason is that
the createLead service tries everytime to create a PartyRole of type
OWNER in this service even if it already exists which leads to a failure
and transaction rollback for the entire call.

REF https://issues.apache.org/jira/browse/OFBIZ-6703

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=1711020&r1=1711019&r2=1711020&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 Oct 28 14:16:00 2015
@@ -38,9 +38,19 @@
             </then>
         </if>
         <check-errors/>
+
+        <!-- PartyRole check start - if the user does not have OWNER roleType 
then add it -->
         <set field="createPartyRoleCtx.partyId" 
from-field="userLogin.partyId"/>
         <set field="createPartyRoleCtx.roleTypeId" value="OWNER"/>
-        <call-service service-name="createPartyRole" 
in-map-name="createPartyRoleCtx"/>
+        <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>
+        <!-- PartyRole check end -->
+
         <if>
             <condition>
                 <and>


Reply via email to