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

remove workflow script that was checking that a person have only one active...

remove workflow script that was checking that a person have only one active career. This is not always true. Check constraints instead.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@34661 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ef2a2086
...@@ -53,28 +53,8 @@ ...@@ -53,28 +53,8 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>state_change[\'object\'].Base_checkConsistency()\n
</string> </value>
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n
# Get the career object and its parent\n
career_object = state_change[\'object\']\n
person_object = career_object.getParentValue()\n
\n
active_careers = []\n
\n
# Count the number of opened career\n
for career in person_object.contentValues(filter={\'portal_type\': \'Career\'}):\n
if career.getValidationState() == \'open\':\n
active_careers.append(career.getTitleOrId())\n
\n
# There is at least one open career, so we can\'t open a new one until the current one is inactive (closed or cancelled)\n
# XXX is this check really needed ?\n
if len(active_careers) > 0:\n
raise ValidationFailed, "Error : current active career (\'" + "\', \'".join(active_careers) + "\') must be inactive"\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_code</string> </key> <key> <string>_code</string> </key>
...@@ -111,16 +91,8 @@ if len(active_careers) > 0:\n ...@@ -111,16 +91,8 @@ if len(active_careers) > 0:\n
<value> <value>
<tuple> <tuple>
<string>state_change</string> <string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>_getitem_</string>
<string>career_object</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>person_object</string> <string>_getitem_</string>
<string>active_careers</string>
<string>_getiter_</string>
<string>career</string>
<string>len</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -137,7 +109,7 @@ if len(active_careers) > 0:\n ...@@ -137,7 +109,7 @@ if len(active_careers) > 0:\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Career_checkUniqueActiveCareer</string> </value> <value> <string>Career_checkConsistency</string> </value>
</item> </item>
<item> <item>
<key> <string>warnings</string> </key> <key> <string>warnings</string> </key>
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string>Career_checkUniqueActiveCareer</string> </value> <value> <string>Career_checkConsistency</string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
......
714 715
\ No newline at end of file \ 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