Fix changing recurring end date to earlier always gave one extra recurrence

This commit is contained in:
Nathan Gray 2015-11-24 18:15:11 +00:00
parent f4fc9a464e
commit b034eeac92
4 changed files with 4 additions and 7 deletions

View File

@ -800,7 +800,7 @@ class calendar_bo
{
$exceptions[] = egw_time::to($exception, true); // true = date
}
//error_log(__METHOD__."(".array2string($event).", $start) exceptions=".array2string($exceptions));
error_log(__METHOD__."(".array2string($event).", $start) exceptions=".array2string($exceptions));
foreach($events as $event)
{
$is_exception = in_array(egw_time::to($event['start'], true), $exceptions);
@ -1020,6 +1020,7 @@ class calendar_bo
foreach($rrule as $time)
{
$time->setUser(); // $time is in timezone of event, convert it to usertime used here
error_log($time);
if (($ts = $this->date2ts($time)) < $start-$event_length)
{
//echo "<p>".$time." --> ignored as $ts < $start-$event_length</p>\n";

View File

@ -1213,7 +1213,7 @@ class calendar_boupdate extends calendar_bo
$event['created'] = $this->now;
$event['creator'] = $this->user;
}
$set_recurrences = false;
$set_recurrences = $old_event ? $event['recur_enddate'] != $old_event['recur_enddate'] : false;
$set_recurrences_start = 0;
if (($cal_id = $this->so->save($event,$set_recurrences,$set_recurrences_start,0,$event['etag'])) && $set_recurrences && $event['recur_type'] != MCAL_RECUR_NONE)
{

View File

@ -1328,7 +1328,7 @@ ORDER BY cal_user_type, cal_usre_id
$cal_id = (int) $event['id'];
unset($event['id']);
$set_recurrences = !$cal_id && $event['recur_type'] != MCAL_RECUR_NONE;
$set_recurrences = $set_recurrences || !$cal_id && $event['recur_type'] != MCAL_RECUR_NONE;
if ($event['recur_type'] != MCAL_RECUR_NONE &&
!(int)$event['recur_interval'])

View File

@ -819,10 +819,6 @@ foreach($recur_event as $_k => $_v) error_log($_k . ': ' . array2string($_v));
$event['alarm'] = array();
}
}
else if ($event['recur_enddate'] != $old_event['recur_enddate'])
{
error_log(__METHOD__ . ':'.__LINE__ . ' ' .$event['recur_enddate'] . (isset($event['recur_enddate']) ? ' SET' : ' NOT SET'));
}
}
else
{