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