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 2012/05/15 10:21:05 UTC

svn commit: r1338594 - in /ofbiz/branches/release10.04: ./ applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml

Author: jleroux
Date: Tue May 15 08:21:04 2012
New Revision: 1338594

URL: http://svn.apache.org/viewvc?rev=1338594&view=rev
Log:
"Applied fix from trunk for revision: 1338591  " 
------------------------------------------------------------------------
r1338591 | jleroux | 2012-05-15 10:19:58 +0200 (mar., 15 mai 2012) | 4 lines

A patch from Pierre Smits "Rates don't start on the first moment of a day and don't last till the latest moment of a day" https://issues.apache.org/jira/browse/OFBIZ-4676

Currently rates for persons have a fromDate that starts on the moment the rate is created but not on the first moment of the day. This increases the difficulty to use rates in calculations. Rates should start on the first moment of a day (eg 01-02-2012 00:00:00.000). Thus rates must end on the last moment (eb 31-01-2012 23:59:59 999) of the day previous to the day a new rate starts.

------------------------------------------------------------------------


Modified:
    ofbiz/branches/release10.04/   (props changed)
    ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml

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

Modified: ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml?rev=1338594&r1=1338593&r2=1338594&view=diff
==============================================================================
--- ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml (original)
+++ ofbiz/branches/release10.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml Tue May 15 08:21:04 2012
@@ -65,7 +65,7 @@ under the License.
         <make-value entity-name="RateAmount" value-field="newEntity"/>
         <set-pk-fields map="parameters" value-field="newEntity"/>
         <set-nonpk-fields map="parameters" value-field="newEntity"/>
-        <now-timestamp field="newEntity.fromDate"/>
+        <set field="newEntity.fromDate" value="${groovy: org.ofbiz.base.util.UtilDateTime.getDayStart(nowTimestamp)}" type="Timestamp"/>
         <clear-field field="newEntity.thruDate"/>
         <create-value value-field="newEntity"/>
     </simple-method>
@@ -95,7 +95,9 @@ under the License.
         <entity-one entity-name="RateAmount" value-field="rateAmount"/>
 
         <if-not-empty field="rateAmount">
-            <now-timestamp field="rateAmount.thruDate"/>
+            <now-timestamp field="nowTimestamp"/>
+            <set field ="previousDay" value="${groovy: org.ofbiz.base.util.UtilDateTime.adjustTimestamp(nowTimestamp,5,-1)}" type="Timestamp"/>
+            <set field="rateAmount.thruDate" value="${groovy: org.ofbiz.base.util.UtilDateTime.getDayEnd(previousDay)}" type="Timestamp"/>
             <store-value value-field="rateAmount"/>
             <else>
                 <add-error><fail-message message="could not find record to be deleted"/></add-error>