ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hans...@apache.org
Subject svn commit: r609995 - /ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml
Date Tue, 08 Jan 2008 14:16:49 GMT
Author: hansbak
Date: Tue Jan  8 06:16:44 2008
New Revision: 609995

URL: http://svn.apache.org/viewvc?rev=609995&view=rev
Log:
small update in partyrate services to ensure there is only one rate set to default

Modified:
    ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml

Modified: ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml?rev=609995&r1=609994&r2=609995&view=diff
==============================================================================
--- ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml
(original)
+++ ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/timesheet/RateServices.xml
Tue Jan  8 06:16:44 2008
@@ -25,20 +25,33 @@
     <simple-method method-name="createPartyRate" short-description="Create PartyRate">
         <check-permission permission="WORKEFFORTMGR" action="_CREATE"><fail-message
message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
         <check-errors/>
-        
         <make-value value-name="newEntity" entity-name="PartyRate"/>
         <set-pk-fields map-name="parameters" value-name="newEntity"/>
         <if-empty field-name="newEntity.fromDate"><now-timestamp-to-env env-name="newEntity.fromDate"/></if-empty>
         <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+        <call-simple-method method-name="checkOtherDefaultRate"/>
         <create-value value-name="newEntity"/>
     </simple-method>
     <simple-method method-name="updatePartyRate" short-description="Update PartyRate">
         <check-permission permission="WORKEFFORTMGR" action="_UPDATE"><fail-message
message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>
         <check-errors/>
-        
-        <entity-one entity-name="PartyRate" value-name="lookedUpValue"/>
-        <set-nonpk-fields map-name="parameters" value-name="lookedUpValue"/>
-        <store-value value-name="lookedUpValue"/>
+        <entity-one entity-name="PartyRate" value-name="newEntity"/>
+        <set-nonpk-fields map-name="parameters" value-name="newEntity"/>
+        <call-simple-method method-name="checkOtherDefaultRate"/>
+        <store-value value-name="newEntity"/>
+    </simple-method>
+    <simple-method method-name="checkOtherDefaultRate" short-description="remove an other
defaultRate flag">
+        <if-compare field-name="newEntity.defaultRate" value="Y" operator="equals">
+            <entity-and entity-name="PartyRate" list-name="rates" filter-by-date="true">
+                <field-map field-name="partyId" env-name="newEntity.partyId"/>
+                <field-map field-name="defaultRate" value="Y"/>
+            </entity-and>
+            <if-not-empty field-name="rates">
+                <first-from-list entry-name="rate" list-name="rates"/>
+                <set field="rate.defaultRate" value="N"/>
+                <store-value value-name="rate"/>
+            </if-not-empty>
+        </if-compare>
     </simple-method>
     <simple-method method-name="deletePartyRate" short-description="Delete PartyRate">
         <check-permission permission="WORKEFFORTMGR" action="_DELETE"><fail-message
message="You do not have permission to perform this operation: ${methodShortDescription}."/></check-permission>



Mime
View raw message