Commit 87dfdd59 authored by Yoshinori Okuji's avatar Yoshinori Okuji

edit_workflow should be invoked only if the workflow chain of the object contains it.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4156 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0bda79bf
......@@ -195,26 +195,26 @@ class CopyContainer:
# Add info about copy to edit workflow
REQUEST = get_request()
if REQUEST is not None and REQUEST.get('__cp', None) :
pw = getToolByName(self, 'portal_workflow')
copied_item_list = _cb_decode(REQUEST['__cp'])[1]
# Guess source item
for c_item in copied_item_list:
if c_item[-1] in item.getId():
source_item = '/'.join(c_item)
break
pw = getToolByName(self, 'portal_workflow')
if 'edit_workflow' in pw.getChainFor(self):
if REQUEST is not None and REQUEST.get('__cp', None) :
copied_item_list = _cb_decode(REQUEST['__cp'])[1]
# Guess source item
for c_item in copied_item_list:
if c_item[-1] in item.getId():
source_item = '/'.join(c_item)
break
else:
source_item = '/'.join(copied_item_list[0])
try:
pw.doActionFor(self, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item)
except WorkflowException:
pass
else:
source_item = '/'.join(copied_item_list[0])
try:
pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item)
except WorkflowException:
pass
else:
pw = getToolByName(self, 'portal_workflow')
try:
pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId())
except WorkflowException:
pass
try:
pw.doActionFor(self, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId())
except WorkflowException:
pass
self.__recurse('manage_afterClone', item)
......
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