Commit 263c9e03 authored by Jérome Perrin's avatar Jérome Perrin

Repair workflow transition from the module, workflow_action was in hidden group

Don't validate form again in Folder_modifyWorkflowStatus, it's already done just before in Base_callDialogMethod



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11171 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3929e339
...@@ -72,54 +72,60 @@ ...@@ -72,54 +72,60 @@
from Products.Formulator.Errors import ValidationError, FormValidationError\n from Products.Formulator.Errors import ValidationError, FormValidationError\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
from Products.ERP5Type.Message import Message\n
\n \n
N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n
request=context.REQUEST\n request=context.REQUEST\n
getObject = context.getPortalObject().portal_catalog.getObject\n
getActionsFor = context.getPortalObject().portal_workflow.getActionsFor\n
\n \n
try:\n
# Validate the form\n
form = getattr(context, dialog_id)\n
kw = {}\n
for f in form.get_fields():\n
k = f.id\n
fid = \'field_\' + k\n
v = getattr(request, fid, None)\n
if v is not None:\n
k = k[3:]\n
kw[k] = v\n
\n \n
selection_uid_list = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n form = getattr(context, dialog_id)\n
if len(selection_uid_list) == 0 :\n kw = {}\n
selection_list = context.portal_selections.callSelectionFor(selection_name, context=context)\n for f in form.get_fields():\n
else :\n k = f.getId()\n
selection_list = []\n if k.startswith(\'my_\'):\n
for uid in selection_uid_list :\n k = k[3:]\n
selection_list.append(context.portal_catalog.getObject(uid))\n elif k.startswith(\'your_\'):\n
k = k[5:]\n
v = getattr(request, k, None)\n
if v is not None:\n
kw[k] = v\n
\n \n
# If there are checked uids, pass the workflow for all checked uids.\n
selection_uid_list = context.portal_selections.getSelectionCheckedUidsFor(\n
selection_name)\n
if not selection_uid_list:\n
# else call the selection to apply to all object with\n
# current search parameters\n
selection_list = context.portal_selections.callSelectionFor(\n
selection_name, context=context)\n
else :\n
selection_list = [getObject(uid) for uid in selection_uid_list]\n
\n
len_selection_list = len(selection_list)\n
if len_selection_list == context.countFolder():\n
value_error = N_("Refusing to process the entire module")\n
else:\n
processed_object_count = 0 \n
for o in selection_list:\n for o in selection_list:\n
o = o.getObject()\n o = o.getObject()\n
o.activate().Base_workflowStatusModify(batch = 1, **kw)\n if workflow_action in [ai[\'id\'] for ai in getActionsFor(o)\n
\n if ai.has_key(\'id\')]:\n
value_error = "Done"\n o.activate().Base_workflowStatusModify(batch = 1, **kw)\n
redirect_url = \'%s/%s?portal_status_message=%s&form_id=%s\' % (\n processed_object_count += 1\n
context.absolute_url(), form_id\n \n
, value_error, form_id,\n value_error = N_("Workflow modification in progress for "\n
)\n "${processed_object_count} out of ${selected_object_count}",\n
\n mapping=dict(processed_object_count=processed_object_count,\n
return context.REQUEST[ \'RESPONSE\' ].redirect( redirect_url )\n selected_object_count=len_selection_list))\n
\n \n
except FormValidationError, validation_errors:\n redirect_url = \'%s/%s?portal_status_message=%s&form_id=%s\' % (\n
# Pack errors into the request\n context.absolute_url(), form_id\n
field_errors = form.ErrorFields(validation_errors)\n , value_error, form_id,\n
request.set(\'field_errors\', field_errors)\n )\n
return form(request)\n
\n \n
except ValueError, value_error:\n return request.RESPONSE.redirect( redirect_url )\n
# Pack errors into the request\n
redirect_url = \'%s/%s?%s%s\' % ( context.absolute_url(), form_id\n
, \'portal_status_message=\',value_error\n
)\n
\n
context.REQUEST[ \'RESPONSE\' ].redirect( redirect_url )\n
]]></string> </value> ]]></string> </value>
...@@ -130,6 +136,12 @@ except ValueError, value_error:\n ...@@ -130,6 +136,12 @@ except ValueError, value_error:\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>_filepath</string> </key> <key> <string>_filepath</string> </key>
<value> <value>
...@@ -144,7 +156,7 @@ except ValueError, value_error:\n ...@@ -144,7 +156,7 @@ except ValueError, value_error:\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id, dialog_id, selection_name</string> </value> <value> <string>form_id, dialog_id, selection_name, workflow_action</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -164,7 +176,7 @@ except ValueError, value_error:\n ...@@ -164,7 +176,7 @@ except ValueError, value_error:\n
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>4</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -173,36 +185,44 @@ except ValueError, value_error:\n ...@@ -173,36 +185,44 @@ except ValueError, value_error:\n
<string>form_id</string> <string>form_id</string>
<string>dialog_id</string> <string>dialog_id</string>
<string>selection_name</string> <string>selection_name</string>
<string>workflow_action</string>
<string>Products.Formulator.Errors</string> <string>Products.Formulator.Errors</string>
<string>ValidationError</string> <string>ValidationError</string>
<string>FormValidationError</string> <string>FormValidationError</string>
<string>Products.DCWorkflow.DCWorkflow</string> <string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string> <string>ValidationFailed</string>
<string>Products.ERP5Type.Message</string>
<string>Message</string>
<string>N_</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>getObject</string>
<string>getActionsFor</string>
<string>getattr</string> <string>getattr</string>
<string>form</string> <string>form</string>
<string>kw</string> <string>kw</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>f</string> <string>f</string>
<string>k</string> <string>k</string>
<string>fid</string> <string>_getitem_</string>
<string>None</string> <string>None</string>
<string>v</string> <string>v</string>
<string>_getitem_</string>
<string>_write_</string> <string>_write_</string>
<string>selection_uid_list</string> <string>selection_uid_list</string>
<string>len</string>
<string>selection_list</string> <string>selection_list</string>
<string>append</string>
<string>$append0</string>
<string>uid</string> <string>uid</string>
<string>len</string>
<string>len_selection_list</string>
<string>value_error</string>
<string>processed_object_count</string>
<string>o</string> <string>o</string>
<string>ai</string>
<string>_apply_</string> <string>_apply_</string>
<string>value_error</string> <string>dict</string>
<string>redirect_url</string> <string>redirect_url</string>
<string>validation_errors</string>
<string>field_errors</string>
<string>ValueError</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -230,4 +250,25 @@ except ValueError, value_error:\n ...@@ -230,4 +250,25 @@ except ValueError, value_error:\n
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -77,18 +77,17 @@ ...@@ -77,18 +77,17 @@
<value> <value>
<dictionary> <dictionary>
<item> <item>
<key> <string>hidden</string> </key> <key> <string>hidden</string> </key>
<value> <value>
<list> <list/>
<string>my_workflow_action</string>
</list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>left</string> </key> <key> <string>left</string> </key>
<value> <value>
<list> <list>
<string>my_comment</string> <string>your_comment</string>
<string>your_workflow_action</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_comment</string> </value> <value> <string>your_comment</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>my_workflow_action</string> </value> <value> <string>your_workflow_action</string> </value>
</item> </item>
<item> <item>
<key> <string>message_values</string> </key> <key> <string>message_values</string> </key>
...@@ -245,7 +245,7 @@ ...@@ -245,7 +245,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Hidden</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>truncate</string> </key> <key> <string>truncate</string> </key>
......
158 161
\ 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