Commit 70739263 authored by Jérome Perrin's avatar Jérome Perrin

Bug fix: edit_workflow must be the first when iterating on workflows for...

Bug fix: edit_workflow must be the first when iterating on workflows for getCreationDate / getModificationDate


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4582 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1f31bb35
...@@ -2099,12 +2099,14 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -2099,12 +2099,14 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
wf = portal_workflow.getWorkflowById('edit_workflow') wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = list(portal_workflow.getWorkflowsFor(self)) wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None: wf_list = [wf] + wf_list if wf is not None: wf_list = [wf] + wf_list
for wf in portal_workflow.getWorkflowsFor(self): for wf in wf_list:
history = wf.getInfoFor(self, 'history', None) history = wf.getInfoFor(self, 'history', None)
if history is not None: if history is not None:
if len(history): if len(history):
# Then get the first line of edit_workflow # Then get the first line of edit_workflow
return history[0].get('time', None) return history[0].get('time', None)
if hasattr(self, 'CreationDate') :
return self.CreationDate()
return None return None
security.declareProtected(Permissions.AccessContentsInformation, 'getModificationDate') security.declareProtected(Permissions.AccessContentsInformation, 'getModificationDate')
...@@ -2117,11 +2119,11 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -2117,11 +2119,11 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
wf = portal_workflow.getWorkflowById('edit_workflow') wf = portal_workflow.getWorkflowById('edit_workflow')
wf_list = list(portal_workflow.getWorkflowsFor(self)) wf_list = list(portal_workflow.getWorkflowsFor(self))
if wf is not None: wf_list = [wf] + wf_list if wf is not None: wf_list = [wf] + wf_list
for wf in portal_workflow.getWorkflowsFor(self): for wf in wf_list:
history = wf.getInfoFor(self, 'history', None) history = wf.getInfoFor(self, 'history', None)
if history is not None: if history is not None:
if len(history): if len(history):
# Then get the first line of edit_workflow # Then get the last line of edit_workflow
return history[-1].get('time', None) return history[-1].get('time', None)
return None return None
...@@ -2167,4 +2169,4 @@ class TempBase(Base): ...@@ -2167,4 +2169,4 @@ class TempBase(Base):
""" """
return getattr(self,'title',None) return getattr(self,'title',None)
security.declarePublic('setProperty') security.declarePublic('setProperty')
\ No newline at end of file
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