Commit 767634e4 authored by Jérome Perrin's avatar Jérome Perrin

translate message used for "Object copied from" / "Object copied as" in

workflow history. Also don't do this while business template installation,
because manage_afterClone is called, and the user may have a __cp cookie.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25854 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4f4efc44
...@@ -26,6 +26,7 @@ from Acquisition import aq_base, aq_inner, aq_parent ...@@ -26,6 +26,7 @@ from Acquisition import aq_base, aq_inner, aq_parent
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Globals import PersistentMapping, MessageDialog from Globals import PersistentMapping, MessageDialog
from Products.ERP5Type.Utils import get_request from Products.ERP5Type.Utils import get_request
from Products.ERP5Type.Message import translateString
from Products.CMFCore.WorkflowCore import WorkflowException from Products.CMFCore.WorkflowCore import WorkflowException
from Products.CMFCore.CatalogTool import CatalogTool as CMFCoreCatalogTool from Products.CMFCore.CatalogTool import CatalogTool as CMFCoreCatalogTool
from Products.CMFActivity.Errors import ActivityPendingError from Products.CMFActivity.Errors import ActivityPendingError
...@@ -271,8 +272,9 @@ class CopyContainer: ...@@ -271,8 +272,9 @@ class CopyContainer:
# Add info about copy to edit workflow # Add info about copy to edit workflow
REQUEST = get_request() REQUEST = get_request()
pw = getToolByName(self, 'portal_workflow') pw = getToolByName(self, 'portal_workflow')
if 'edit_workflow' in pw.getChainFor(self): if 'edit_workflow' in pw.getChainFor(self)\
if REQUEST is not None and REQUEST.get('__cp', None) : and not REQUEST.get('is_business_template_installation', 0):
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:
...@@ -282,12 +284,16 @@ class CopyContainer: ...@@ -282,12 +284,16 @@ class CopyContainer:
else: else:
source_item = '/'.join(copied_item_list[0]) source_item = '/'.join(copied_item_list[0])
try: try:
pw.doActionFor(self, 'edit_action', wf_id='edit_workflow', comment='Object copied from %s' % source_item) pw.doActionFor(self, 'edit_action', wf_id='edit_workflow',
comment=translateString('Object copied from ${source_item}',
mapping=(dict(source_item=source_item))))
except WorkflowException: except WorkflowException:
pass pass
else: else:
try: try:
pw.doActionFor(self, 'edit_action', wf_id='edit_workflow', comment='Object copied as %s' % item.getId()) pw.doActionFor(self, 'edit_action', wf_id='edit_workflow',
comment=translateString('Object copied as ${item_id}',
mapping=(dict(item_id=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