mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:49:10 +01:00
for new or changed group-invitations, remove previously deleted members, so they show up again
This commit is contained in:
parent
c281300cbf
commit
9397280688
@ -1562,6 +1562,8 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
{
|
{
|
||||||
if (!count($recurrences)) $recurrences[] = 0; // insert the default recurrence
|
if (!count($recurrences)) $recurrences[] = 0; // insert the default recurrence
|
||||||
|
|
||||||
|
$delete_deleted = array();
|
||||||
|
|
||||||
// update participants
|
// update participants
|
||||||
foreach($participants as $uid => $status)
|
foreach($participants as $uid => $status)
|
||||||
{
|
{
|
||||||
@ -1582,6 +1584,22 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
'cal_user_id' => $id,
|
'cal_user_id' => $id,
|
||||||
),__LINE__,__FILE__,'calendar');
|
),__LINE__,__FILE__,'calendar');
|
||||||
}
|
}
|
||||||
|
// for new or changed group-invitations, remove previously deleted members, so they show up again
|
||||||
|
if ($uid < 0)
|
||||||
|
{
|
||||||
|
$delete_deleted = array_merge($delete_deleted, $GLOBALS['egw']->accounts->members($uid, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($delete_deleted)
|
||||||
|
{
|
||||||
|
$this->db->delete($this->user_table, $where=array(
|
||||||
|
'cal_id' => $cal_id,
|
||||||
|
'cal_recur_date' => $recurrences,
|
||||||
|
'cal_user_type' => 'u',
|
||||||
|
'cal_user_id' => array_unique($delete_deleted),
|
||||||
|
'cal_status' => 'X',
|
||||||
|
),__LINE__,__FILE__,'calendar');
|
||||||
|
//error_log(__METHOD__."($cal_id, ".array2string($participants).", since=$change_since, add_only=$add_only) db->delete('$this->user_table', ".array2string($where).") affected ".$this->db->affected_rows().' rows');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1614,9 +1632,11 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
|
|
||||||
if (is_numeric($status)) $status = $status_code_short[$status];
|
if (is_numeric($status)) $status = $status_code_short[$status];
|
||||||
|
|
||||||
|
if (!$user_type) $user_type == 'u';
|
||||||
|
|
||||||
$where = array(
|
$where = array(
|
||||||
'cal_id' => $cal_id,
|
'cal_id' => $cal_id,
|
||||||
'cal_user_type' => $user_type ? $user_type : 'u',
|
'cal_user_type' => $user_type,
|
||||||
'cal_user_id' => $user_id,
|
'cal_user_id' => $user_id,
|
||||||
);
|
);
|
||||||
if ((int) $recur_date)
|
if ((int) $recur_date)
|
||||||
@ -1631,15 +1651,24 @@ ORDER BY cal_user_type, cal_usre_id
|
|||||||
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
|
||||||
{
|
{
|
||||||
$this->db->delete($this->user_table,$where,__LINE__,__FILE__,'calendar');
|
$this->db->delete($this->user_table,$where,__LINE__,__FILE__,'calendar');
|
||||||
|
$ret = $this->db->affected_rows();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$set = array('cal_status' => $status);
|
$set = array('cal_status' => $status);
|
||||||
if (!is_null($role) && $role != 'REQ-PARTICIPANT') $set['cal_role'] = $role;
|
if (!is_null($role) && $role != 'REQ-PARTICIPANT') $set['cal_role'] = $role;
|
||||||
$this->db->insert($this->user_table,$set,$where,__LINE__,__FILE__,'calendar');
|
$this->db->insert($this->user_table,$set,$where,__LINE__,__FILE__,'calendar');
|
||||||
|
// for new or changed group-invitations, remove previously deleted members, so they show up again
|
||||||
|
if (($ret = $this->db->affected_rows()) && $user_type == 'u' && $user_id < 0)
|
||||||
|
{
|
||||||
|
$where['cal_user_id'] = $GLOBALS['egw']->accounts->members($user_id, true);
|
||||||
|
$where['cal_status'] = 'X';
|
||||||
|
$this->db->delete($this->user_table, $where, __LINE__, __FILE__, 'calendar');
|
||||||
|
//error_log(__METHOD__."($cal_id,$user_type,$user_id,$status,$recur_date) = $ret, db->delete('$this->user_table', ".array2string($where).") affected ".$this->db->affected_rows().' rows');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// update modified and modifier in main table
|
// update modified and modifier in main table
|
||||||
if (($ret = $this->db->affected_rows()))
|
if ($ret)
|
||||||
{
|
{
|
||||||
$this->updateModified($cal_id, true); // true = update series master too
|
$this->updateModified($cal_id, true); // true = update series master too
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user