Commit eb2e0cb5 authored by iv's avatar iv

ERP5Workflow: add getWorklistValueById method on workflow to replace

non-existing getWorklistValueDict one
+ add getGuardRoleList method on DCWorkflow worklists
parent 2508758f
......@@ -5,6 +5,6 @@
portal_workflow = context.getPortalObject().portal_workflow
workflow = getattr(portal_workflow, workflow_id)
worklist = workflow.getWorklistValueDict()[worklist_id]
roles = worklist.getGuard().getRolesText().split(';')
return roles
worklist = workflow.getWorklistValueById(worklist_id)
role_list = worklist.getGuardRoleList()
return role_list
......@@ -14,7 +14,7 @@ except:
return {}
# If this is a worklist action, read the worklist definition
worklist = workflow.getWorklistValueDict()[action['worklist_id']]
worklist = workflow.getWorklistValueById(action['worklist_id'])
for varkey in worklist.getVarMatchKeys():
kw[varkey] = worklist.getVarMatch(varkey)
......
......@@ -827,6 +827,10 @@ def DCWorkflowDefinition_getTransitionIdList(self):
if self.transitions is not None:
return self.transitions.objectIds()
return []
def DCWorkflowDefinition_getWorklistValueById(self, worklist_id):
if self.worklists is not None:
return self.worklists.get(worklist_id, None)
return None
def DCWorkflowDefinition_getWorklistValueList(self):
if self.worklists is not None:
return self.worklists.values()
......@@ -1087,6 +1091,9 @@ def DCWorkflowDefinition_addTransition(self, name):
def DCWorkflowDefinition_deleteTransitions(self, name):
self.transitions.deleteTransitions(name)
def WorklistDefinition_getGuardRoleList(self):
return self.getGuard().getRolesText().split(';')
DCWorkflowDefinition.addTransition = DCWorkflowDefinition_addTransition
DCWorkflowDefinition.deleteTransitions = DCWorkflowDefinition_deleteTransitions
DCWorkflowDefinition.getReference = method_getReference
......@@ -1099,6 +1106,7 @@ DCWorkflowDefinition.getStateValueById = DCWorkflowDefinition_getStateValueById
DCWorkflowDefinition.getStateValueList = DCWorkflowDefinition_getStateValueList
DCWorkflowDefinition.getTransitionValueById = DCWorkflowDefinition_getTransitionValueById
DCWorkflowDefinition.getTransitionValueList = DCWorkflowDefinition_getTransitionValueList
DCWorkflowDefinition.getWorklistValueById = DCWorkflowDefinition_getWorklistValueById
DCWorkflowDefinition.getWorklistValueList = DCWorkflowDefinition_getWorklistValueList
DCWorkflowDefinition.getScriptValueList = DCWorkflowDefinition_getScriptValueList
DCWorkflowDefinition.getVariableIdList = DCWorkflowDefinition_getVariableIdList
......@@ -1123,6 +1131,7 @@ VariableDefinition.getReference = method_getReference
VariableDefinition.showDict = DCWorkflowDefinition_showDict
WorklistDefinition.getReference = method_getReference
WorklistDefinition.showDict = DCWorkflowDefinition_showDict
WorklistDefinition.getGuardRoleList = WorklistDefinition_getGuardRoleList
# This patch allows to use workflowmethod as an after_script
# However, the right way of doing would be to have a combined state of TRIGGER_USER_ACTION and TRIGGER_WORKFLOW_METHOD
......
......@@ -550,6 +550,9 @@ class Workflow(IdAsReferenceMixin("", "prefix"), XMLObject):
id_list.append(ob.getReference())
return id_list
def getWorklistValueById(self, worklist_reference):
return self._getOb('worklist_' + worklist_reference, None)
def getTransitionValueById(self, transition_reference):
return self._getOb('transition_' + transition_reference, None)
......
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