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 15:35:49 UTC

svn commit: r1446899 - in /ofbiz/branches/release10.04: ./ applications/content/script/org/ofbiz/content/data/DataServices.xml applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml

Author: jleroux
Date: Sat Feb 16 14:35:49 2013
New Revision: 1446899

URL: http://svn.apache.org/r1446899
Log:
"Applied fix from trunk for revision: 1446876" 
------------------------------------------------------------------------
r1446876 | jleroux | 2013-02-16 12:54:50 +0100 (sam., 16 févr. 2013) | 4 lines

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/branches/release10.04/   (props changed)
    ofbiz/branches/release10.04/applications/content/script/org/ofbiz/content/data/DataServices.xml
    ofbiz/branches/release10.04/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml

Propchange: ofbiz/branches/release10.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1446876

Modified: ofbiz/branches/release10.04/applications/content/script/org/ofbiz/content/data/DataServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/content/script/org/ofbiz/content/data/DataServices.xml?rev=1446899&r1=1446898&r2=1446899&view=diff
==============================================================================
--- ofbiz/branches/release10.04/applications/content/script/org/ofbiz/content/data/DataServices.xml (original)
+++ ofbiz/branches/release10.04/applications/content/script/org/ofbiz/content/data/DataServices.xml Sat Feb 16 14:35:49 2013
@@ -160,16 +160,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/branches/release10.04/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml?rev=1446899&r1=1446898&r2=1446899&view=diff
==============================================================================
--- ofbiz/branches/release10.04/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml (original)
+++ ofbiz/branches/release10.04/applications/party/script/org/ofbiz/party/party/PartySimpleMethods.xml Sat Feb 16 14:35:49 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">