Avoid fatal errors when setting recurrence until date for tasks (#4852)
This commit is contained in:
parent
96442eae9d
commit
c51c60eff8
2 changed files with 32 additions and 1 deletions
|
@ -116,6 +116,20 @@ class kolab_format_task extends kolab_format_xcal
|
|||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the reference date for recurrence and alarms
|
||||
*
|
||||
* @return mixed DateTime instance of null if no refdate is available
|
||||
*/
|
||||
public function get_reference_date()
|
||||
{
|
||||
if ($this->data['due'] && $this->data['due'] instanceof DateTime) {
|
||||
return $this->data['due'];
|
||||
}
|
||||
|
||||
return self::php_datetime($this->obj->due()) ?: parent::get_reference_date();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for kolab_storage_cache to get object specific tags to cache
|
||||
*
|
||||
|
|
|
@ -184,7 +184,10 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
$object['recurrence']['COUNT'] = $count;
|
||||
}
|
||||
else if ($until = self::php_datetime($rr->end())) {
|
||||
$until->setTime($object['start']->format('G'), $object['start']->format('i'), 0);
|
||||
$refdate = $this->get_reference_date();
|
||||
if ($refdate && $refdate instanceof DateTime && !$refdate->_dateonly) {
|
||||
$until->setTime($refdate->format('G'), $refdate->format('i'), 0);
|
||||
}
|
||||
$object['recurrence']['UNTIL'] = $until;
|
||||
}
|
||||
|
||||
|
@ -567,6 +570,20 @@ abstract class kolab_format_xcal extends kolab_format
|
|||
$this->set_attachments($object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the reference date for recurrence and alarms
|
||||
*
|
||||
* @return mixed DateTime instance of null if no refdate is available
|
||||
*/
|
||||
public function get_reference_date()
|
||||
{
|
||||
if ($this->data['start'] && $this->data['start'] instanceof DateTime) {
|
||||
return $this->data['start'];
|
||||
}
|
||||
|
||||
return self::php_datetime($this->obj->start());
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for kolab_storage_cache to get words to index for fulltext search
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue