0011702: __clone method called on non-object (rrule_constraints)
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 21 Mar 2016 12:25:57 +0000 (13:25 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 31 Mar 2016 10:33:15 +0000 (12:33 +0200)
* checks if rrule_constraints is instanceof Event Filter

https://forge.tine20.org/view.php?id=11702

Change-Id: Ibf4866382cbc5655c0d43268f69cf4964b17beca
Reviewed-on: http://gerrit.tine20.com/customers/2985
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Calendar/Controller/Event.php
tine20/Calendar/Model/Event.php

index cf7465e..4e85b47 100644 (file)
@@ -479,12 +479,14 @@ class Calendar_Controller_Event extends Tinebase_Controller_Record_Abstract impl
         $exdates = is_array($_record->exdate) ? $_record->exdate : array();
 
         // own event should not trigger constraints conflicts
-        $constraints = clone $_record->rrule_constraints;
-        $constraints->addFilter(new Tinebase_Model_Filter_Text('uid', 'not', $_record->uid));
+        if ($_record->rrule_constraints && $_record->rrule_constraints instanceof Calendar_Model_EventFilter) {
+            $constraints = clone $_record->rrule_constraints;
+            $constraints->addFilter(new Tinebase_Model_Filter_Text('uid', 'not', $_record->uid));
 
-        $constrainExdatePeriods = $this->getConflictingPeriods($this->getBlockingPeriods($_record), $constraints);
-        foreach ($constrainExdatePeriods as $constrainExdatePeriod) {
-            $exdates[] = $constrainExdatePeriod['from'];
+            $constrainExdatePeriods = $this->getConflictingPeriods($this->getBlockingPeriods($_record), $constraints);
+            foreach ($constrainExdatePeriods as $constrainExdatePeriod) {
+                $exdates[] = $constrainExdatePeriod['from'];
+            }
         }
 
         $_record->exdate = array_unique($exdates);
@@ -505,7 +507,7 @@ class Calendar_Controller_Event extends Tinebase_Controller_Record_Abstract impl
         )), NULL, 'id');
 
         // update each
-        foreach($constraintsEventIds as $constraintsEventId) {
+        foreach ($constraintsEventIds as $constraintsEventId) {
             try {
                 $event = $this->_backend->get($constraintsEventId);
                 $this->setConstraintsExdates($event);
index fccc13f..a238c79 100644 (file)
@@ -133,6 +133,7 @@ class Calendar_Model_Event extends Tinebase_Record_Abstract
 
         'is_all_day_event'      => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
         'rrule_until'           => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
+        // instanceof Calendar_Model_EventFilter
         'rrule_constraints'     => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
         'originator_tz'         => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
         'mute'                  => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => false      ),