fixed status of all recurrences get set to "unknown", if status of a single recurrence get changed

This commit is contained in:
Ralf Becker 2011-01-06 05:19:10 +00:00
parent df5aae20f5
commit 3c469c8392

View File

@ -1277,7 +1277,7 @@ ORDER BY cal_user_type, cal_usre_id
if ((int) $change_since) if ((int) $change_since)
{ {
$where[0] = '(cal_recur_date=0 OR cal_recur_date >= '.(int)$change_since.')'; $where[] = '(cal_recur_date=0 OR cal_recur_date >= '.(int)$change_since.')';
} }
if ($change_since !== false) if ($change_since !== false)
@ -1289,13 +1289,18 @@ ORDER BY cal_user_type, cal_usre_id
} }
// update existing entries // update existing entries
$existing_entries = $this->db->select($this->user_table,'DISTINCT cal_user_type,cal_user_id',$where,__LINE__,__FILE__,false,'','calendar'); $existing_entries = $this->db->select($this->user_table,'*',$where,__LINE__,__FILE__,false,'ORDER BY cal_recur_date DESC','calendar');
// create a full list of participants which already exist in the db // create a full list of participants which already exist in the db
// with status, quantity and role of the earliest recurence
$old_participants = array(); $old_participants = array();
foreach($existing_entries as $row) foreach($existing_entries as $row)
{ {
$old_participants[self::combine_user($row['cal_user_type'],$row['cal_user_id'])] = true; $uid = self::combine_user($row['cal_user_type'],$row['cal_user_id']);
if ($row['cal_recur_date'] || !isset($old_participants[$uid]))
{
$old_participants[$uid] = self::combine_status($row['cal_status'],$row['cal_quantity'],$row['cal_role']);
}
} }
// tag participants which should be deleted // tag participants which should be deleted
@ -1413,7 +1418,8 @@ ORDER BY cal_user_type, cal_usre_id
// check if the user has any status database entries and create the default set if needed // check if the user has any status database entries and create the default set if needed
// a status update before having the necessary entries happens on e.g. group invitations // a status update before having the necessary entries happens on e.g. group invitations
$this->participants($cal_id,array(self::combine_user($user_type,$user_id) => 'U'),0,true); // commented out, as it causes problems when called with a single / not all participants (not sure why it is necessary anyway)
// $this->participants($cal_id,array(self::combine_user($user_type,$user_id) => 'U'),0,true);
if ($status == 'G') // remove group invitations, as we dont store them in the db if ($status == 'G') // remove group invitations, as we dont store them in the db
{ {