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 \n
# Validate the form\n form = getattr(context, dialog_id)\n
form = getattr(context, dialog_id)\n kw = {}\n
kw = {}\n for f in form.get_fields():\n
for f in form.get_fields():\n k = f.getId()\n
k = f.id\n if k.startswith(\'my_\'):\n
fid = \'field_\' + k\n
v = getattr(request, fid, None)\n
if v is not None:\n
k = k[3:]\n k = k[3:]\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 kw[k] = v\n
\n \n
selection_uid_list = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n # If there are checked uids, pass the workflow for all checked uids.\n
if len(selection_uid_list) == 0 :\n selection_uid_list = context.portal_selections.getSelectionCheckedUidsFor(\n
selection_list = context.portal_selections.callSelectionFor(selection_name, context=context)\n selection_name)\n
else :\n if not selection_uid_list:\n
selection_list = []\n # else call the selection to apply to all object with\n
for uid in selection_uid_list :\n # current search parameters\n
selection_list.append(context.portal_catalog.getObject(uid))\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 \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
if workflow_action in [ai[\'id\'] for ai in getActionsFor(o)\n
if ai.has_key(\'id\')]:\n
o.activate().Base_workflowStatusModify(batch = 1, **kw)\n o.activate().Base_workflowStatusModify(batch = 1, **kw)\n
\n processed_object_count += 1\n
value_error = "Done"\n \n
redirect_url = \'%s/%s?portal_status_message=%s&form_id=%s\' % (\n value_error = N_("Workflow modification in progress for "\n
"${processed_object_count} out of ${selected_object_count}",\n
mapping=dict(processed_object_count=processed_object_count,\n
selected_object_count=len_selection_list))\n
\n
redirect_url = \'%s/%s?portal_status_message=%s&form_id=%s\' % (\n
context.absolute_url(), form_id\n context.absolute_url(), form_id\n
, value_error, form_id,\n , value_error, form_id,\n
)\n )\n
\n \n
return context.REQUEST[ \'RESPONSE\' ].redirect( redirect_url )\n return request.RESPONSE.redirect( redirect_url )\n
\n
except FormValidationError, validation_errors:\n
# Pack errors into the request\n
field_errors = form.ErrorFields(validation_errors)\n
request.set(\'field_errors\', field_errors)\n
return form(request)\n
\n
except ValueError, value_error:\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>
...@@ -79,16 +79,15 @@ ...@@ -79,16 +79,15 @@
<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