From c8cc1ffad3f02258ee55baaba29569b3c22d91da Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 16 Jul 2015 12:08:44 +0000 Subject: [PATCH] * Calendar/CalDAV: rejected meeting-requests were not returned when searching for free time --- calendar/inc/class.calendar_ical.inc.php | 1 + calendar/inc/class.calendar_uiforms.inc.php | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 2fffd50379..fb76a2b543 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -3222,6 +3222,7 @@ class calendar_ical extends calendar_boupdate { if ($event['non_blocking']) continue; if ($event['uid'] === $extra['X-CALENDARSERVER-MASK-UID']) continue; + if ($event['participants'][$user] == 'R') continue; $fbtype = $event['participants'][$user] == 'T' ? 'BUSY-TENTATIVE' : 'BUSY'; diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index afa3ebe020..7c24ec88a6 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -2136,7 +2136,7 @@ class calendar_uiforms extends calendar_ui */ function freetime($participants,$start,$end,$duration=1,$cal_id=0) { - if ($this->debug > 2) $this->bo->debug_message('uiforms::freetime(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5)',true,$participants,$start,$end,$duration,$cal_id); + if ($this->debug > 2) $this->bo->debug_message(__METHOD__.'(participants=%1, start=%2, end=%3, duration=%4, cal_id=%5)',true,$participants,$start,$end,$duration,$cal_id); $busy = $this->bo->search(array( 'start' => $start, @@ -2157,6 +2157,22 @@ class calendar_uiforms extends calendar_ui if ($event['non_blocking']) continue; // ignore non_blocking events + // check if from all wanted participants at least one has a not rejected status in found event + $non_rejected_found = false; + foreach($participants as $uid) + { + if ($event['participants'][$uid] == 'R') continue; + + if (isset($event['participants'][$uid]) || + $uid > 0 && array_intersect(array_keys((array)$event['participants']), + $GLOBALS['egw']->accounts->memberships($uid, true))) + { + $non_rejected_found = true; + break; + } + } + if (!$non_rejected_found) continue; + if ($this->debug) { echo "

ft_start=".date('D d.m.Y H:i',$ft_start)."
\n";