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