Commit 9566f866 authored by Jérome Perrin's avatar Jérome Perrin

Make sur we do not chain a portal type to the same workflow twice

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5496 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d2e18b9e
No related merge requests found
...@@ -580,7 +580,7 @@ class ObjectTemplateItem(BaseTemplateItem): ...@@ -580,7 +580,7 @@ class ObjectTemplateItem(BaseTemplateItem):
chain_dict = getChainByType(context)[1] chain_dict = getChainByType(context)[1]
default_chain = '' default_chain = ''
chain_dict['chain_%s' %(object_id)] = wf_chain chain_dict['chain_%s' %(object_id)] = wf_chain
context.portal_workflow.manage_changeWorkflows(default_chain, props=chain_dict) context.portal_workflow.manage_changeWorkflows(default_chain, props=chain_dict)
# import sub objects if there is # import sub objects if there is
elif len(subobjects_dict) > 0: elif len(subobjects_dict) > 0:
# get a jar # get a jar
...@@ -1173,13 +1173,20 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem): ...@@ -1173,13 +1173,20 @@ class PortalTypeWorkflowChainTemplateItem(BaseTemplateItem):
if action == 'nothing': if action == 'nothing':
continue continue
portal_type = path.split('/', 1)[1] portal_type = path.split('/', 1)[1]
if chain_dict.has_key('chain_%s' % portal_type): if chain_dict.has_key('chain_%s' % portal_type):
old_chain_dict = chain_dict['chain_%s' % portal_type] old_chain_dict = chain_dict['chain_%s' % portal_type]
# XXX we don't use the chain (Default) in erp5 so don't keep it # XXX we don't use the chain (Default) in erp5 so don't keep it
if old_chain_dict != '(Default)' and old_chain_dict != '': if old_chain_dict != '(Default)' and old_chain_dict != '':
chain_dict['chain_%s' % portal_type] = old_chain_dict +', '+self._objects[path] # unique workflow chains
old_chain_workflow_id_set = {}
for wf_id in old_chain_dict.split(', '):
old_chain_workflow_id_set[wf_id] = 1
for wf_id in self._objects[path].split(', '):
old_chain_workflow_id_set[wf_id] = 1
chain_dict['chain_%s' % portal_type] = ', '.join(
old_chain_workflow_id_set.keys())
else: else:
chain_dict['chain_%s' % portal_type] = self._objects[path] chain_dict['chain_%s' % portal_type] = self._objects[path]
else: else:
chain_dict['chain_%s' % portal_type] = self._objects[path] chain_dict['chain_%s' % portal_type] = self._objects[path]
context.portal_workflow.manage_changeWorkflows(default_chain, context.portal_workflow.manage_changeWorkflows(default_chain,
......
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