Calculate the EGw recur_enddate properly

This commit is contained in:
Jörg Lehrke 2010-01-05 11:24:27 +00:00
parent ed519fda33
commit ac7424612e

View File

@ -72,7 +72,7 @@ class calendar_ical extends calendar_boupdate
5 => 2, // normal
4 => 3, 3 => 3, 2 => 3, 1 => 3, // high
);
/**
* @var array $priority_egw2funambol conversion of the priority egw => funambol
*/
@ -776,7 +776,7 @@ class calendar_ical extends calendar_boupdate
// check if we are importing an event series with exceptions in CalDAV
// only first event / series master get's cal_id from URL
// other events are exceptions and need to be checked if they are new
// and for real (not status only) exceptions their recurrence-id need
// and for real (not status only) exceptions their recurrence-id need
// to be included as recur_exception to the master
if ($this->productManufacturer == 'groupdav' && $cal_id > 0 &&
count($events) > 1 && !$events[1]['id'] &&
@ -2072,16 +2072,6 @@ class calendar_ical extends calendar_boupdate
}
}
if (!empty($vcardData['recur_enddate']))
{
// reset recure_enddate to 00:00:00 on the last day
$vcardData['recur_enddate'] = mktime(0, 0, 0,
date('m', $vcardData['recur_enddate']),
date('d', $vcardData['recur_enddate']),
date('Y', $vcardData['recur_enddate'])
);
}
$event['priority'] = 2; // default
$event['alarm'] = $alarms;
@ -2121,6 +2111,21 @@ class calendar_ical extends calendar_boupdate
break;
}
}
if (!empty($event['recur_enddate']))
{
// reset recure_enddate to 00:00:00 on the last day
$rriter = calendar_rrule::event2rrule($event, false);
$rriter->rewind();
$last = clone $rriter->time;
while ($rriter->current <= $rriter->enddate)
{
$last = clone $rriter->current;
$rriter->next_no_exception();
}
$last->setTime(0, 0, 0);
$event['recur_enddate'] = $this->date2ts($last);
}
if ($this->calendarOwner) $event['owner'] = $this->calendarOwner;
//Horde::logMessage("vevent2egw:\n" . print_r($event, true),
// __FILE__, __LINE__, PEAR_LOG_DEBUG);