From f14a26444bfee56d2fa13ddd07776a5c21dd1d44 Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 10 Dec 2014 14:08:08 +0100 Subject: [PATCH] Fix to some event altering actions not updating the timestamp --- VERSION.json | 2 +- app/Controller/AttributesController.php | 2 ++ app/Controller/EventsController.php | 8 ++++++-- app/Controller/ShadowAttributesController.php | 2 ++ app/Controller/TemplatesController.php | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/VERSION.json b/VERSION.json index f6333ac73..6e27bb767 100644 --- a/VERSION.json +++ b/VERSION.json @@ -1 +1 @@ -{"major":2, "minor":3, "hotfix":35} +{"major":2, "minor":3, "hotfix":36} diff --git a/app/Controller/AttributesController.php b/app/Controller/AttributesController.php index 238b96109..51857f06d 100755 --- a/app/Controller/AttributesController.php +++ b/app/Controller/AttributesController.php @@ -1970,6 +1970,8 @@ class AttributesController extends AppController { 'recursive' => -1 )); $event['Event']['published'] = 0; + $date = new DateTime(); + $event['Event']['timestamp'] = $date->getTimestamp(); $this->Attribute->Event->save($event); } else { $message .= 'Update completed with some errors.'; diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index f138a273a..a2e57447d 100755 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -2863,12 +2863,16 @@ class EventsController extends AppController { } } } - if ($saved > 0 && $event['Event']['published'] == 1) { + if ($saved > 0) { $event = $this->Event->find('first', array( 'conditions' => array('Event.id' => $id), 'recursive' => -1 )); - $event['Event']['published'] = 0; + if ($event['Event']['published'] == 1) { + $event['Event']['published'] = 0; + } + $date = new DateTime(); + $event['Event']['timestamp'] = $date->getTimestamp(); $this->Event->save($event); } if ($failed > 0) { diff --git a/app/Controller/ShadowAttributesController.php b/app/Controller/ShadowAttributesController.php index b7d50ce90..09bfcb2a0 100644 --- a/app/Controller/ShadowAttributesController.php +++ b/app/Controller/ShadowAttributesController.php @@ -160,6 +160,8 @@ class ShadowAttributesController extends AppController { $event['Event']['proposal_email_lock'] = 0; } $event['Event']['published'] = 0; + $date = new DateTime(); + $event['Event']['timestamp'] = $date->getTimestamp(); $this->autoRender = false; if ($this->Event->save($event, array('fieldList' => $fieldList))) { $this->Log = ClassRegistry::init('Log'); diff --git a/app/Controller/TemplatesController.php b/app/Controller/TemplatesController.php index 2cf9c9724..8117f5b88 100644 --- a/app/Controller/TemplatesController.php +++ b/app/Controller/TemplatesController.php @@ -351,6 +351,8 @@ class TemplatesController extends AppController { 'recursive' => -1 )); $event['Event']['published'] = 0; + $date = new DateTime(); + $event['Event']['timestamp'] = $date->getTimestamp(); $this->Event->save($event); if ($fails == 0) $this->Session->setFlash(__('Event populated, ' . $count . ' attributes successfully created.')); else $this->Session->setFlash(__('Event populated, but ' . $fails . ' attributes could not be saved.'));