Commit cf301661 authored by Jérome Perrin's avatar Jérome Perrin

2008-02-26 Jerome

* Add 2 utility scripts for persons: Person_getAge and Person_getCareerStartDate.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19531 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a428b282
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
"""Returns the age of the person at the current date or at the given `at_date`.\n
If `year` is true, return the integer value, otherwise returns a translated\n
string.\n
"""\n
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getIntervalBetweenDates\n
N_ = context.Base_translateString\n
\n
birthday = context.getBirthday()\n
if birthday is None:\n
return None\n
\n
if at_date is None:\n
at_date = DateTime()\n
\n
interval_dict = getIntervalBetweenDates(from_date=birthday,\n
to_date=at_date)\n
if year:\n
return interval_dict[\'year\']\n
\n
# mapping contains year, month & day\n
return N_("${year} Years Old", mapping=interval_dict)\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>at_date=None, year=0</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>at_date</string>
<string>year</string>
<string>DateTime</string>
<string>Products.ERP5Type.DateUtils</string>
<string>getIntervalBetweenDates</string>
<string>_getattr_</string>
<string>context</string>
<string>N_</string>
<string>birthday</string>
<string>None</string>
<string>interval_dict</string>
<string>_getitem_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_getAge</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>all_career_step_list = context.contentValues(portal_type=\'Career\',\n
checked_permission=\'View\')\n
\n
career_step_list = []\n
# only keep "active" career steps (and related to this organisation if given)\n
for career_step in all_career_step_list :\n
if (subordination_relative_url is None or \\\n
career_step.getSubordination() == subordination_relative_url) and \\\n
career_step.getStartDate() and \\\n
career_step.getValidationState() not in (\'cancelled\', \'deleted\'):\n
career_step_list.append(career_step)\n
\n
# sort them by start date\n
career_step_list.sort( lambda x, y: cmp(x.getStartDate(), y.getStartDate()) )\n
for career_step in career_step_list :\n
# TODO: take the first date of the last active career range.\n
# for now, we only return the first one.\n
return career_step.getStartDate()\n
\n
raise ValueError, \'No Career Step Defined.\'\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>subordination_relative_url=None</string> </value>
</item>
<item>
<key> <string>errors</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>func_code</string> </key>
<value>
<object>
<klass>
<global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>co_argcount</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>subordination_relative_url</string>
<string>_getattr_</string>
<string>context</string>
<string>all_career_step_list</string>
<string>career_step_list</string>
<string>_getiter_</string>
<string>career_step</string>
<string>None</string>
<string>ValueError</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_getCareerStartDate</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2008-02-26 Jerome
* Add 2 utility scripts for persons: Person_getAge and Person_getCareerStartDate.
2008-1-9 Yusei
* Hide document tab on organisation if erp5_dms is installed.
......
275
\ No newline at end of file
282
\ 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