mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-19 17:38:06 +02:00
* Calendar/iCal/CalDAV: normalize enddates not on a recurrence-date, to recurrence-date before (not next)
This commit is contained in:
parent
1cb00eb580
commit
d23d41ca50
@ -2972,12 +2972,7 @@ class calendar_ical extends calendar_boupdate
|
|||||||
{
|
{
|
||||||
// reset recure_enddate to 00:00:00 on the last day
|
// reset recure_enddate to 00:00:00 on the last day
|
||||||
$rriter = calendar_rrule::event2rrule($event, false);
|
$rriter = calendar_rrule::event2rrule($event, false);
|
||||||
$rriter->rewind();
|
$last = $rriter->normalize_enddate();
|
||||||
while ($rriter->current < $rriter->enddate)
|
|
||||||
{
|
|
||||||
$rriter->next_no_exception();
|
|
||||||
}
|
|
||||||
$last = clone $rriter->current;
|
|
||||||
$last->setTime(0, 0, 0);
|
$last->setTime(0, 0, 0);
|
||||||
//error_log(__METHOD__."() rrule=$recurence --> ".array2string($rriter)." --> enddate=".array2string($last).'='.egw_time::to($last, ''));
|
//error_log(__METHOD__."() rrule=$recurence --> ".array2string($rriter)." --> enddate=".array2string($last).'='.egw_time::to($last, ''));
|
||||||
$event['recur_enddate'] = egw_time::to($last, 'server');
|
$event['recur_enddate'] = egw_time::to($last, 'server');
|
||||||
|
@ -491,6 +491,33 @@ class calendar_rrule implements Iterator
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix enddates which are not on a recurrence, eg. for a on Monday recurring weekly event a Tuesday
|
||||||
|
*
|
||||||
|
* @return DateTime
|
||||||
|
*/
|
||||||
|
public function normalize_enddate()
|
||||||
|
{
|
||||||
|
$this->rewind();
|
||||||
|
while ($this->current < $this->enddate)
|
||||||
|
{
|
||||||
|
$previous = clone $this->current;
|
||||||
|
$this->next_no_exception();
|
||||||
|
}
|
||||||
|
// if enddate is now before next acurrence, but not on same day, we use previous recurrence
|
||||||
|
// this can happen if client gives an enddate which is NOT a recurrence date
|
||||||
|
// eg. for a on Monday recurring weekly event a Tuesday as enddate
|
||||||
|
if ($this->enddate < $this->current && $this->current->format('Ymd') != $this->enddate->format('Ymd'))
|
||||||
|
{
|
||||||
|
$last = $previous;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$last = clone $this->current;
|
||||||
|
}
|
||||||
|
return $last;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewind the Iterator to the first element (called at beginning of foreach loop)
|
* Rewind the Iterator to the first element (called at beginning of foreach loop)
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user