From 7b32964069b274aaf767906d9b98143b949351e1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 23 Oct 2012 14:55:41 +0000 Subject: [PATCH] * Calendar: fixed not working extending of an event series (latter recurrence end-date), after schema update in last package --- calendar/inc/class.calendar_so.inc.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php index d774ea7f23..5db9309297 100644 --- a/calendar/inc/class.calendar_so.inc.php +++ b/calendar/inc/class.calendar_so.inc.php @@ -1015,6 +1015,13 @@ ORDER BY cal_user_type, cal_usre_id if ($cal_id) { + // query old recurrance information, before updating main table, where recur_endate is now stored + if ($event['recur_type'] != MCAL_RECUR_NONE) + { + $old_repeats = $this->db->select($this->repeats_table, "$this->repeats_table.*,range_end AS recur_enddate", + "$this->repeats_table.cal_id=".(int)$cal_id, __LINE__, __FILE__, + false, '', 'calendar', 0, "JOIN $this->cal_table ON $this->repeats_table.cal_id=$this->cal_table.cal_id")->fetch(); + } $where = array('cal_id' => $cal_id); // read only timezone id, to check if it is changed if ($event['recur_type'] != MCAL_RECUR_NONE) @@ -1084,7 +1091,6 @@ ORDER BY cal_user_type, cal_usre_id // fetch information about the currently saved (old) event $old_min = (int) $this->db->select($this->dates_table,'MIN(cal_start)',array('cal_id'=>$cal_id),__LINE__,__FILE__,false,'','calendar')->fetchColumn(); $old_duration = (int) $this->db->select($this->dates_table,'MIN(cal_end)',array('cal_id'=>$cal_id),__LINE__,__FILE__,false,'','calendar')->fetchColumn() - $old_min; - $old_repeats = $this->db->select($this->repeats_table,'*',array('cal_id' => $cal_id),__LINE__,__FILE__,false,'','calendar')->fetch(); $old_exceptions = array(); foreach($this->db->select($this->dates_table, 'cal_start', array( 'cal_id' => $cal_id, @@ -1178,6 +1184,7 @@ ORDER BY cal_user_type, cal_usre_id $set_recurrences = true; $set_recurrences_start = ($old_repeats['recur_enddate'] + 1*DAY_s); } + //error_log(__METHOD__."() event[recur_enddate]=$event[recur_enddate], old_repeats[recur_enddate]=$old_repeats[recur_enddate] --> set_recurrences=".array2string($set_recurrences).", set_recurrences_start=$set_recurrences_start"); } // truncate recurrences by given exceptions