Validate/fix dates only for event objects; don't export default values
This commit is contained in:
parent
2654abfcaf
commit
17dbcd9c9f
1 changed files with 21 additions and 18 deletions
|
@ -191,7 +191,6 @@ class libvcalendar
|
|||
'changed' => null,
|
||||
'_type' => $ve->name == 'VTODO' ? 'task' : 'event',
|
||||
// set defaults
|
||||
'free_busy' => 'busy',
|
||||
'priority' => 0,
|
||||
'attendees' => array(),
|
||||
);
|
||||
|
@ -350,6 +349,8 @@ class libvcalendar
|
|||
}
|
||||
}
|
||||
|
||||
// validate event dates
|
||||
if ($event['_type'] == 'event') {
|
||||
// check for all-day dates
|
||||
if ($event['start']->_dateonly) {
|
||||
$event['allday'] = true;
|
||||
|
@ -367,6 +368,7 @@ class libvcalendar
|
|||
else if ($event['end'] < $event['start']) {
|
||||
$event['end'] = clone $event['start'];
|
||||
}
|
||||
}
|
||||
|
||||
// make organizer part of the attendees list for compatibility reasons
|
||||
if (!empty($event['organizer']) && is_array($event['attendees'])) {
|
||||
|
@ -610,6 +612,7 @@ class libvcalendar
|
|||
$ve->add($cat);
|
||||
}
|
||||
|
||||
if (!empty($event['free_busy']))
|
||||
$ve->add('TRANSP', $event['free_busy'] == 'free' ? 'TRANSPARENT' : 'OPAQUE');
|
||||
|
||||
if ($event['priority'])
|
||||
|
@ -625,7 +628,7 @@ class libvcalendar
|
|||
if (!empty($event['sensitivity']))
|
||||
$ve->add('CLASS', strtoupper($event['sensitivity']));
|
||||
|
||||
if (isset($event['complete'])) {
|
||||
if (!empty($event['complete'])) {
|
||||
$ve->add('PERCENT-COMPLETE', intval($event['complete']));
|
||||
// Apple iCal required the COMPLETED date to be set in order to consider a task complete
|
||||
if ($event['complete'] == 100)
|
||||
|
|
Loading…
Add table
Reference in a new issue