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

@ -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);