Author: jleroux
Date: Tue May 15 08:21:03 2012
New Revision: 1338593

URL: http://svn.apache.org/viewvc?rev=1338593&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/release12.04/   (props changed)
    
ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml

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

Modified: 
ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml?rev=1338593&r1=1338592&r2=1338593&view=diff
==============================================================================
--- 
ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml
 (original)
+++ 
ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/rate/RateServices.xml
 Tue May 15 08:21:03 2012
@@ -67,7 +67,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>
@@ -99,7 +99,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>


Reply via email to