From fb57915828e03f50268d156462c0091b3c3f0843 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Wed, 28 Apr 2004 11:23:31 +0000 Subject: [PATCH] disabled my last change, we check if selection has changed directly on base_view_dialog git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@760 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../folder_workflow_status_modify.py | 60 +++++++++---------- 1 file changed, 27 insertions(+), 33 deletions(-) diff --git a/product/Coramy/skins/coramy_erp5/folder_workflow_status_modify.py b/product/Coramy/skins/coramy_erp5/folder_workflow_status_modify.py index 187956b27b..3cce15d2b3 100755 --- a/product/Coramy/skins/coramy_erp5/folder_workflow_status_modify.py +++ b/product/Coramy/skins/coramy_erp5/folder_workflow_status_modify.py @@ -4,7 +4,7 @@ ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath -##parameters=form_id,dialog_id,selection_name,md5_object_uid_list=None +##parameters=form_id,dialog_id,selection_name ##title= ## from Products.Formulator.Errors import ValidationError, FormValidationError @@ -24,39 +24,33 @@ try: if v is not None: kw[k] = v selection_list = context.portal_selections.callSelectionFor(selection_name, context=context) - # Check if the selection did not changed - if md5_object_uid_list is not None: - object_uid_list = map(lambda x:x.getObject().getUid(),selection_list) - error = context.portal_selections.selectionHasChanged(md5_object_uid_list,object_uid_list) - if error: - error_message = 'Sorry+your+selection+has+changed' - if error_message == '': - for selection_item in selection_list: - o = selection_item.getObject() - workflow_action = kw['workflow_action'] - action_list = o.portal_workflow.getActionsFor(o) - action_list = filter(lambda x:x.has_key('id'), action_list ) - action_id_list = map(lambda x:x['id'], action_list) - # If the user is not allowed to do this transition, it will not be in action_list - if workflow_action in action_id_list: - o.portal_workflow.doActionFor( - o, - workflow_action, - wf_id=kw['workflow_id'], - **kw) + for selection_item in selection_list: + o = selection_item.getObject() + workflow_action = kw['workflow_action'] + action_list = o.portal_workflow.getActionsFor(o) + action_list = filter(lambda x:x.has_key('id'), action_list ) + action_id_list = map(lambda x:x['id'], action_list) + # If the user is not allowed to do this transition, it will not be in action_list + if workflow_action in action_id_list: + o.portal_workflow.doActionFor( + o, + workflow_action, + wf_id=kw['workflow_id'], + **kw) + + # We will check if there's an error_message + history_data = None + try: + history_data = o.portal_workflow.getInfoFor(ob=o, name='history') + except: + pass + redirect_url = None + if history_data is not None: + last_history_data = history_data[len(history_data)-1] + this_error = last_history_data.get('error_message') + if this_error != None and this_error != '': + error_message += this_error + "-" - # We will check if there's an error_message - history_data = None - try: - history_data = o.portal_workflow.getInfoFor(ob=o, name='history') - except: - pass - redirect_url = None - if history_data is not None: - last_history_data = history_data[len(history_data)-1] - this_error = last_history_data.get('error_message') - if this_error != None and this_error != '': - error_message += this_error + "-" except FormValidationError, validation_errors: # Pack errors into the request field_errors = form.ErrorFields(validation_errors) -- 2.30.9