fire after update event when it's update with all related data
authorMichael Spahn <m.spahn@metaways.de>
Wed, 9 Aug 2017 14:13:26 +0000 (16:13 +0200)
committerMichael Spahn <m.spahn@metaways.de>
Wed, 9 Aug 2017 14:36:44 +0000 (16:36 +0200)
 - inspect after update is fired before related data are updated

Change-Id: I40881704576a5d18e5989eb9c633c3c6020e9b01
Reviewed-on: http://gerrit.tine20.com/customers/5436
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Reviewed-by: Michael Spahn <m.spahn@metaways.de>
Tested-by: Michael Spahn <m.spahn@metaways.de>
tine20/Calendar/Controller/Event.php

index 7636cf1..7d48a39 100644 (file)
@@ -915,7 +915,7 @@ class Calendar_Controller_Event extends Tinebase_Controller_Record_Abstract impl
                 }
 
                 parent::update($_record);
-                
+
             } else if ($_record->attendee instanceof Tinebase_Record_RecordSet) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
                     . " user has no editGrant for event: {$_record->id}, updating attendee status with valid authKey only");
@@ -939,7 +939,13 @@ class Calendar_Controller_Event extends Tinebase_Controller_Record_Abstract impl
         }
         
         $updatedEvent = $this->get($event->getId());
-        
+
+        if ($skipEvent === false) {
+            Tinebase_Record_PersistentObserver::getInstance()->fireEvent(new Calendar_Event_InspectEventAfterUpdate([
+                'observable' => $updatedEvent
+            ]));
+        }
+
         // send notifications
         $this->sendNotifications($sendNotifications);
         if ($this->_sendNotifications && $_record->mute != 1) {
@@ -961,10 +967,6 @@ class Calendar_Controller_Event extends Tinebase_Controller_Record_Abstract impl
         $this->_saveAttendee($record, $currentRecord, $record->isRescheduled($currentRecord));
         // need to save new attendee set in $updatedRecord for modlog
         $updatedRecord->attendee = clone($record->attendee);
-
-        Tinebase_Record_PersistentObserver::getInstance()->fireEvent(new Calendar_Event_InspectEventAfterUpdate([
-            'observable' => $updatedRecord
-        ]));
     }
     
     /**