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,8 +195,9 @@ class CopyContainer: ...@@ -195,8 +195,9 @@ 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):
if REQUEST is not None and REQUEST.get('__cp', None) :
copied_item_list = _cb_decode(REQUEST['__cp'])[1] copied_item_list = _cb_decode(REQUEST['__cp'])[1]
# Guess source item # Guess source item
for c_item in copied_item_list: for c_item in copied_item_list:
...@@ -206,13 +207,12 @@ class CopyContainer: ...@@ -206,13 +207,12 @@ class CopyContainer:
else: else:
source_item = '/'.join(copied_item_list[0]) source_item = '/'.join(copied_item_list[0])
try: try:
pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item) pw.doActionFor(self, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item)
except WorkflowException: except WorkflowException:
pass pass
else: else:
pw = getToolByName(self, 'portal_workflow')
try: try:
pw.doActionFor(self_base, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId()) pw.doActionFor(self, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId())
except WorkflowException: except WorkflowException:
pass pass
......
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