Fix RDATE handling (T1278)
Workarounds VObject-2.1 bug. In Kolab 16 we have no such issue.
This commit is contained in:
parent
5f55326cd1
commit
d1be2b7810
1 changed files with 28 additions and 18 deletions
|
@ -465,13 +465,17 @@ class libvcalendar implements Iterator
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'EXDATE':
|
case 'EXDATE':
|
||||||
if (!empty($prop->value))
|
if (!empty($prop->value)) {
|
||||||
$event['recurrence']['EXDATE'] = array_merge((array)$event['recurrence']['EXDATE'], self::convert_datetime($prop, true));
|
$rdates = array_map(function($_) { return is_array($_) ? $_[0] : $_; }, self::convert_datetime($prop, true));
|
||||||
|
$event['recurrence']['EXDATE'] = array_merge((array)$event['recurrence']['EXDATE'], $rdates);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'RDATE':
|
case 'RDATE':
|
||||||
if (!empty($prop->value))
|
if (!empty($prop->value)) {
|
||||||
$event['recurrence']['RDATE'] = array_merge((array)$event['recurrence']['RDATE'], self::convert_datetime($prop, true));
|
$rdates = array_map(function($_) { return is_array($_) ? $_[0] : $_; }, self::convert_datetime($prop, true));
|
||||||
|
$event['recurrence']['RDATE'] = array_merge((array)$event['recurrence']['RDATE'], $rdates);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'RECURRENCE-ID':
|
case 'RECURRENCE-ID':
|
||||||
|
@ -782,20 +786,26 @@ class libvcalendar implements Iterator
|
||||||
$dt[] = $item;
|
$dt[] = $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($prop instanceof VObject\Property\DateTime) {
|
else if (($prop instanceof VObject\Property\DateTime)
|
||||||
$dt = $prop->getDateTime();
|
|| ($prop instanceof VObject\Property && ($prop['VALUE'] == 'DATE' || $prop['VALUE'] == 'DATE-TIME'))
|
||||||
if ($prop->getDateType() & VObject\Property\DateTime::DATE) {
|
) {
|
||||||
$dt->_dateonly = true;
|
// Because of VObject 2.1 bug RDATE can end up here, so
|
||||||
}
|
// we workaround it by handling multiple values (T1278)
|
||||||
}
|
$dt = array();
|
||||||
else if ($prop instanceof VObject\Property && ($prop['VALUE'] == 'DATE' || $prop['VALUE'] == 'DATE-TIME')) {
|
foreach (explode(',', $prop->value) as $val) {
|
||||||
try {
|
try {
|
||||||
list($type, $dt) = VObject\Property\DateTime::parseData($prop->value, $prop);
|
list($type, $item) = VObject\Property\DateTime::parseData($val, $prop);
|
||||||
$dt->_dateonly = ($type & VObject\Property\DateTime::DATE);
|
$item->_dateonly = ($type & VObject\Property\DateTime::DATE);
|
||||||
}
|
$dt[] = $item;
|
||||||
catch (Exception $e) {
|
}
|
||||||
// ignore date parse errors
|
catch (Exception $e) {
|
||||||
}
|
// ignore single date parse errors
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$as_array) {
|
||||||
|
$dt = $dt[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($prop instanceof VObject\Property && $prop['VALUE'] == 'PERIOD') {
|
else if ($prop instanceof VObject\Property && $prop['VALUE'] == 'PERIOD') {
|
||||||
$dt = array();
|
$dt = array();
|
||||||
|
|
Loading…
Add table
Reference in a new issue