You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/02/16 12:54:51 UTC

svn commit: r1446876 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/data/DataServices.xml party/script/org/ofbiz/party/party/PartySimpleMethods.xml

Author: jleroux
Date: Sat Feb 16 11:54:50 2013
New Revision: 1446876

URL: http://svn.apache.org/r1446876
Log:
A patch from Chatree Srichart for "The createDataResourceRole service does not check if partyId exists" https://issues.apache.org/jira/browse/OFBIZ-5133

The createDataResourceRole service has a partyId attribute as optional but its implementation method does not check if the partyId exists before creating a DataResourceRole value.
The ensurePartyRole service also has a partyId attribute as optional but its implementation method does not check if the partyId exists before creating a PartyRole value.

Modified:
    ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml
    ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml?rev=1446876&r1=1446875&r2=1446876&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/data/DataServices.xml Sat Feb 16 11:54:50 2013
@@ -180,16 +180,16 @@ under the License.
 
   <!-- Methods for DataResourceRole -->
     <simple-method method-name="createDataResourceRole" short-description="Create Data Resource Role">
-        <make-value entity-name="DataResourceRole" value-field="newEntity"/>
-        <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <set-pk-fields map="parameters" value-field="newEntity"/>
-
-        <if-empty field="newEntity.fromDate">
-            <now-timestamp field="nowTimestamp"/>
-            <set field="newEntity.fromDate" from-field="nowTimestamp"/>
-        </if-empty>
-
-        <create-value value-field="newEntity"/>
+        <if-not-empty field="parameters.partyId">
+            <make-value entity-name="DataResourceRole" value-field="newEntity"/>
+            <set-nonpk-fields map="parameters" value-field="newEntity"/>
+            <set-pk-fields map="parameters" value-field="newEntity"/>
+            <if-empty field="newEntity.fromDate">
+                <now-timestamp field="nowTimestamp"/>
+                <set field="newEntity.fromDate" from-field="nowTimestamp"/>
+            </if-empty>
+            <create-value value-field="newEntity"/>
+        </if-not-empty>
     </simple-method>
     <simple-method method-name="updateDataResourceRole" short-description="Update Data Resource Role">
         <make-value entity-name="DataResourceRole" value-field="lookupKeyValue"/>

Modified: ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml?rev=1446876&r1=1446875&r2=1446876&view=diff
==============================================================================
--- ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml (original)
+++ ofbiz/trunk/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml Sat Feb 16 11:54:50 2013
@@ -65,11 +65,14 @@ under the License.
             <set from-field="parameters.roleTypeId" field="lookupPKMap.roleTypeId"/>
         </else>
         </if-empty>
-        <find-by-primary-key entity-name="PartyRole" map="lookupPKMap" value-field="lookedUpValue"/>
-        <if-empty field="lookedUpValue">
-            <make-value value-field="newValue" entity-name="PartyRole" map="lookupPKMap"/>
-            <create-value value-field="newValue"/>
-        </if-empty>
+        <if-not-empty field="lookupPKMap.partyId">
+            <find-by-primary-key entity-name="PartyRole" map="lookupPKMap" value-field="lookedUpValue"/>
+            <if-empty field="lookedUpValue">
+                <make-value value-field="newValue" entity-name="PartyRole" map="lookupPKMap"/>
+                <create-value value-field="newValue"/>
+            </if-empty>
+        </if-not-empty>
+
     </simple-method>
 
     <simple-method method-name="createPersonAndUserLogin" short-description="Creates a person and userlogin" login-required="false">