Commit df3d0fbe authored by Rafael Monnerat's avatar Rafael Monnerat 👻

Added new parameter to round scripts. This is usefull to round that values in...

Added new parameter to round scripts. This is usefull to round that values in a different way for begin and the end of the block.

See: http://www.erp5.org/Discussion/DateRange

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20504 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6ceaf9c3
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -74,11 +71,18 @@
Script used by PlanningBox validator to round the bound dates to the\n
closest full day.\n
"""\n
if axis == \'begin\':\n
if full_date.hour() > 12: \n
return DateTime(full_date.Date()) + 1\n
else:\n
return DateTime(full_date.Date())\n
\n
if full_date.hour() > 12:\n
return DateTime(full_date.Date()) + 1\n
else:\n
return DateTime(full_date.Date())\n
if axis == \'end\':\n
# round to 23:59:59\n
if full_date.hour() > 12:\n
return DateTime(full_date.Date()) + 1 - (1.0/(24*3600))\n
else:\n
return DateTime(full_date.Date()) - (1.0/(24*3600))\n
]]></string> </value>
......@@ -103,7 +107,7 @@ else:\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>full_date</string> </value>
<value> <string>full_date, axis=\'begin\'</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -123,13 +127,14 @@ else:\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>full_date</string>
<string>axis</string>
<string>_getattr_</string>
<string>DateTime</string>
</tuple>
......@@ -143,13 +148,19 @@ else:\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
<tuple>
<string>begin</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Planning_roundBoundToDay</string> </value>
</item>
<item>
<key> <string>isIndexable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -95,7 +92,7 @@ return int(value + 0.5)\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>value</string> </value>
<value> <string>value, axis=\'begin\'</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -115,13 +112,14 @@ return int(value + 0.5)\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>value</string>
<string>axis</string>
<string>int</string>
</tuple>
</value>
......@@ -134,13 +132,19 @@ return int(value + 0.5)\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
<tuple>
<string>begin</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Planning_roundBoundToInt</string> </value>
</item>
<item>
<key> <string>isIndexable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
......
......@@ -3,11 +3,8 @@
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
......@@ -104,7 +101,7 @@ else:\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>full_date</string> </value>
<value> <string>full_date, axis=\'begin\'</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
......@@ -124,13 +121,14 @@ else:\n
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>full_date</string>
<string>axis</string>
<string>_getattr_</string>
<string>DateTime</string>
</tuple>
......@@ -144,13 +142,19 @@ else:\n
<item>
<key> <string>func_defaults</string> </key>
<value>
<none/>
<tuple>
<string>begin</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Planning_roundBoundToMinute</string> </value>
</item>
<item>
<key> <string>isIndexable</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
......
790
\ No newline at end of file
792
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment