Update displayed publication date correctly
authorThierry Florac <thierry.florac@onf.fr>
Tue, 16 Jan 2018 15:24:57 +0100
changeset 328 3ae323f42a24
parent 327 f31d61be8b65
child 329 f4566bf0c917
Update displayed publication date correctly
src/pyams_content/shared/common/zmi/workflow.py
--- a/src/pyams_content/shared/common/zmi/workflow.py	Tue Jan 16 15:24:29 2018 +0100
+++ b/src/pyams_content/shared/common/zmi/workflow.py	Tue Jan 16 15:24:57 2018 +0100
@@ -150,12 +150,16 @@
         if ('publication_expiration_date' in self.widgets) and pub_info.publication_expiration_date:
             self.widgets['publication_expiration_date'].value = \
                 tztime(pub_info.publication_expiration_date).strftime('%d/%m/%y %H:%M')
+        if 'displayed_publication_date' in self.widgets:
+            self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
 
     def createAndAdd(self, data):
         pub_info = IWorkflowPublicationInfo(self.context)
         pub_info.publication_effective_date = data.get('publication_effective_date')
         pub_info.push_end_date = data.get('push_end_date')
         pub_info.publication_expiration_date = data.get('publication_expiration_date')
+        if 'displayed_publication_date' in data:
+            pub_info.displayed_publication_date = data.get('displayed_publication_date')
         return super(PublicationRequestForm, self).createAndAdd(data)
 
 
@@ -342,12 +346,16 @@
         if ('publication_expiration_date' in self.widgets) and pub_info.publication_expiration_date:
             self.widgets['publication_expiration_date'].value = \
                 tztime(pub_info.publication_expiration_date).strftime('%d/%m/%y %H:%M')
+        if 'displayed_publication_date' in self.widgets:
+            self.widgets['displayed_publication_date'].value = pub_info.displayed_publication_date
 
     def createAndAdd(self, data):
         pub_info = IWorkflowPublicationInfo(self.context)
         pub_info.publication_effective_date = data.get('publication_effective_date')
         pub_info.push_end_date = data.get('push_end_date')
         pub_info.publication_expiration_date = data.get('publication_expiration_date')
+        if 'displayed_publication_date' in data:
+            pub_info.displayed_publication_date = data.get('displayed_publication_date')
         return super(PublicationForm, self).createAndAdd(data)