misc: always use perform_global_action to run a global action (#57750)

This commit is contained in:
Frédéric Péters 2021-10-11 19:23:14 +02:00
parent 7bbb071a68
commit 9276e5f547
2 changed files with 3 additions and 4 deletions

View File

@ -585,14 +585,13 @@ class FormData(StorableObject):
url = perform_items(wf_status.items, self, event=event)
return url
def perform_global_action(self, action_id, user):
def perform_global_action(self, action_id, user, event_name='global-action'):
from wcs.workflows import perform_items
for action in self.formdef.workflow.get_global_actions_for_user(formdata=self, user=user):
if action.id != action_id:
continue
perform_items(action.items, self, event=('global-action', action.id))
break
return perform_items(action.items, self, event=(event_name, action.id))
def get_workflow_messages(self, position='top', user=None):
wf_status = self.get_visible_status(user=user)

View File

@ -1798,7 +1798,7 @@ class WorkflowStatus:
# check for global actions
for action in filled.formdef.workflow.get_global_actions_for_user(filled, user):
if 'button-action-%s' % action.id in get_request().form:
url = perform_items(action.items, filled, event=('global-action-button', action.id))
url = filled.perform_global_action(action.id, user, event_name='global-action-button')
if url:
return url
return