diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyWorkflowStatus.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyWorkflowStatus.xml index f87758bd584d224302d2d0e83a00a88a004bccc1..bb55af1652acd890c4b8fe00ea4131c21dbc2a90 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyWorkflowStatus.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_modifyWorkflowStatus.xml @@ -72,54 +72,60 @@ from Products.Formulator.Errors import ValidationError, FormValidationError\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n +from Products.ERP5Type.Message import Message\n \n +N_ = lambda msg, **kw: Message(\'erp5_ui\', msg, **kw)\n request=context.REQUEST\n +getObject = context.getPortalObject().portal_catalog.getObject\n +getActionsFor = context.getPortalObject().portal_workflow.getActionsFor\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 - selection_uid_list = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n - if len(selection_uid_list) == 0 :\n - selection_list = context.portal_selections.callSelectionFor(selection_name, context=context)\n - else :\n - selection_list = []\n - for uid in selection_uid_list :\n - selection_list.append(context.portal_catalog.getObject(uid))\n +form = getattr(context, dialog_id)\n +kw = {}\n +for f in form.get_fields():\n + k = f.getId()\n + if k.startswith(\'my_\'):\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 \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 o = o.getObject()\n - o.activate().Base_workflowStatusModify(batch = 1, **kw)\n -\n - value_error = "Done"\n - redirect_url = \'%s/%s?portal_status_message=%s&form_id=%s\' % (\n - context.absolute_url(), form_id\n - , value_error, form_id,\n - )\n -\n - return context.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 + 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 + processed_object_count += 1\n + \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 + , value_error, form_id,\n + )\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 +return request.RESPONSE.redirect( redirect_url )\n ]]></string> </value> @@ -130,6 +136,12 @@ except ValueError, value_error:\n <none/> </value> </item> + <item> + <key> <string>_dav_writelocks</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> <item> <key> <string>_filepath</string> </key> <value> @@ -144,7 +156,7 @@ except ValueError, value_error:\n </item> <item> <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> <key> <string>errors</string> </key> @@ -164,7 +176,7 @@ except ValueError, value_error:\n <dictionary> <item> <key> <string>co_argcount</string> </key> - <value> <int>3</int> </value> + <value> <int>4</int> </value> </item> <item> <key> <string>co_varnames</string> </key> @@ -173,36 +185,44 @@ except ValueError, value_error:\n <string>form_id</string> <string>dialog_id</string> <string>selection_name</string> + <string>workflow_action</string> <string>Products.Formulator.Errors</string> <string>ValidationError</string> <string>FormValidationError</string> <string>Products.DCWorkflow.DCWorkflow</string> <string>ValidationFailed</string> + <string>Products.ERP5Type.Message</string> + <string>Message</string> + <string>N_</string> <string>_getattr_</string> <string>context</string> <string>request</string> + <string>getObject</string> + <string>getActionsFor</string> <string>getattr</string> <string>form</string> <string>kw</string> <string>_getiter_</string> <string>f</string> <string>k</string> - <string>fid</string> + <string>_getitem_</string> <string>None</string> <string>v</string> - <string>_getitem_</string> <string>_write_</string> <string>selection_uid_list</string> - <string>len</string> <string>selection_list</string> + <string>append</string> + <string>$append0</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>ai</string> <string>_apply_</string> - <string>value_error</string> + <string>dict</string> <string>redirect_url</string> - <string>validation_errors</string> - <string>field_errors</string> - <string>ValueError</string> </tuple> </value> </item> @@ -230,4 +250,25 @@ except ValueError, value_error:\n </dictionary> </pickle> </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> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog.xml index 5dff07770906878bfb314c3e0c8b4c619b96c760..de4d219a4ecef5c1fc4fb827def989315a1bd799 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog.xml @@ -77,18 +77,17 @@ <value> <dictionary> <item> - <key> <string>hidden</string> </key> + <key> <string>hidden</string> </key> <value> - <list> - <string>my_workflow_action</string> - </list> + <list/> </value> </item> <item> - <key> <string>left</string> </key> + <key> <string>left</string> </key> <value> <list> - <string>my_comment</string> + <string>your_comment</string> + <string>your_workflow_action</string> </list> </value> </item> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/my_comment.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/your_comment.xml similarity index 99% rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/my_comment.xml rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/your_comment.xml index c49aa3e9385847f189da02acc9169988dd615864..7f5e06342f9869724a084fecfe292f97cac2e579 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/my_comment.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/your_comment.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>id</string> </key> - <value> <string>my_comment</string> </value> + <value> <string>your_comment</string> </value> </item> <item> <key> <string>message_values</string> </key> diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/my_workflow_action.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/your_workflow_action.xml similarity index 98% rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/my_workflow_action.xml rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/your_workflow_action.xml index a456cd0891128a9e17c4cf81668b62935d1b926d..b4db13c97a73a9196d102feacd80fd42be1395fa 100644 --- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/my_workflow_action.xml +++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Folder_viewWorkflowActionDialog/your_workflow_action.xml @@ -14,7 +14,7 @@ <dictionary> <item> <key> <string>id</string> </key> - <value> <string>my_workflow_action</string> </value> + <value> <string>your_workflow_action</string> </value> </item> <item> <key> <string>message_values</string> </key> @@ -245,7 +245,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>Hidden</string> </value> + <value> <string></string> </value> </item> <item> <key> <string>truncate</string> </key> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 147ea53ba1b4b991eb9a128a1231e006722485a3..7f3a7cc66c28f7ce9fa4e69a9fcc5e8f03bbad1b 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -158 \ No newline at end of file +161 \ No newline at end of file