svn commit: r1637721 - in /ofbiz/trunk: applications/order/script/org/ofbiz/order/opportunity/ applications/party/script/org/ofbiz/party/party/ specialpurpose/projectmgr/script/org/ofbiz/project/

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

svn commit: r1637721 - in /ofbiz/trunk: applications/order/script/org/ofbiz/order/opportunity/ applications/party/script/org/ofbiz/party/party/ specialpurpose/projectmgr/script/org/ofbiz/project/

nmalin
Author: nmalin
Date: Sun Nov  9 19:30:26 2014
New Revision: 1637721

URL: http://svn.apache.org/r1637721
Log:
Correct createPartyRole call with pk collision risk detected by Supatthra Nawicha on OFBIZ-5853, while waiting for discussion if revert of createPartyRole from entity-auto is need or not

Modified:
    ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml?rev=1637721&r1=1637720&r2=1637721&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/opportunity/OpportunityServices.xml Sun Nov  9 19:30:26 2014
@@ -145,7 +145,13 @@ This file contains basic services for Sa
             <if-not-empty field="parameters.accountPartyId">
                 <set field="roleMap.roleTypeId" value="ACCOUNT"/>
                 <set field="roleMap.partyId" from-field="parameters.accountPartyId"/>
-                <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+                <entity-one value-field="partyRole" entity-name="PartyRole">
+                    <field-map field-name="roleTypeId" from-field="roleMap.roleTypeId"/>
+                    <field-map field-name="partyId" from-field="roleMap.partyId"/>
+                </entity-one>
+                <if-empty field="partyRole">
+                    <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+                </if-empty>
             </if-not-empty>
             <set field="salesOpportunityRole.roleTypeId" value="ACCOUNT"/>
             <set field="salesOpportunityRole.salesOpportunityId" from-field="parameters.salesOpportunityId"/>

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml?rev=1637721&r1=1637720&r2=1637721&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml Sun Nov  9 19:30:26 2014
@@ -88,8 +88,13 @@ under the License.
         <if-not-empty field="partyInvitationRoleAssocs">
             <set field="createPartyRoleCtx.partyId" from-field="parameters.partyId"/>
             <iterate list="partyInvitationRoleAssocs" entry="partyInvitationRoleAssoc">
-                <set field="createPartyRoleCtx.roleTypeId" from-field="partyInvitationRoleAssoc.roleTypeId"/>
-                <call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
+                <entity-one value-field="partyRole" entity-name="PartyRole">
+                    <field-map field-name="roleTypeId" from-field="partyInvitationRoleAssoc.roleTypeId"/>
+                </entity-one>
+                <if-empty field="partyRole">
+                    <set field="createPartyRoleCtx.roleTypeId" from-field="partyInvitationRoleAssoc.roleTypeId"/>
+                    <call-service service-name="createPartyRole" in-map-name="createPartyRoleCtx"/>
+                </if-empty>
             </iterate>
         </if-not-empty>
         <set field="updatePartyInvitationCtx.partyInvitationId" from-field="parameters.partyInvitationId"/>

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml?rev=1637721&r1=1637720&r2=1637721&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartyServices.xml Sun Nov  9 19:30:26 2014
@@ -841,10 +841,22 @@ under the License.
     <simple-method method-name="createPartyRelationshipContactAccount" short-description="create a company/contact relationship and add the related roles">
         <set field="roleMap.partyId" from-field="parameters.accountPartyId"/>
         <set field="roleMap.roleTypeId" value="ACCOUNT"/>
-        <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+        <entity-one value-field="partyRole" entity-name="PartyRole">
+            <field-map field-name="partyId" from-field="roleMap.partyId"/>
+            <field-map field-name="roleTypeId" from-field="roleMap.roleTypeId"/>
+        </entity-one>
+        <if-empty field="partyRole">
+            <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+        </if-empty>
         <set field="roleMap.partyId" from-field="parameters.contactPartyId"/>
         <set field="roleMap.roleTypeId" value="CONTACT"/>
-        <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+        <entity-one value-field="partyRole" entity-name="PartyRole">
+            <field-map field-name="partyId" from-field="roleMap.partyId"/>
+            <field-map field-name="roleTypeId" from-field="roleMap.roleTypeId"/>
+        </entity-one>
+        <if-empty field="partyRole">
+            <call-service service-name="createPartyRole" in-map-name="roleMap"/>
+        </if-empty>
         <set field="relMap.partyIdFrom" from-field="parameters.accountPartyId"/>
         <set field="relMap.roleTypeIdFrom" value="ACCOUNT"/>
         <set field="relMap.partyIdTo" from-field="parameters.contactPartyId"/>

Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml?rev=1637721&r1=1637720&r2=1637721&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectSimpleEvents.xml Sun Nov  9 19:30:26 2014
@@ -116,10 +116,18 @@
         </if-not-empty>
     </simple-method>
     <simple-method method-name="addProjectMgrResource" short-description="make parties available in the project manager.">
-        <set-service-fields service-name="createPartyRole" map="parameters" to-map="roleData"/>
-        <call-service service-name="createPartyRole" in-map-name="roleData"/>
+        <entity-one value-field="partyRole" entity-name="PartyRole"/>
+        <if-empty field="partyRole">
+            <set-service-fields service-name="createPartyRole" map="parameters" to-map="roleData"/>
+            <call-service service-name="createPartyRole" in-map-name="roleData"/>
+        </if-empty>
         <set field="roleData.roleTypeId" value="PROJECT_TEAM"/>
-        <call-service service-name="createPartyRole" in-map-name="roleData"/>
+        <entity-one value-field="partyRole" entity-name="PartyRole">
+            <field-map field-name="roleTypeId" from-field="roleData.roleTypeId"/>
+        </entity-one>
+        <if-empty field="partyRole">
+            <call-service service-name="createPartyRole" in-map-name="roleData"/>
+        </if-empty>
     </simple-method>
     <!-- create workEffort content -->
     <simple-method method-name="createWorkEffortContent" short-description="Creates Party Associated Content" login-required="false">