From 50e5f3387004dddb2c9f1991474af45fa32ef8b0 Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 19 May 2017 14:47:01 +0200 Subject: [PATCH] Fix events visibilities when connected as student see BT#11972 - show all student event - show all events sent to everyone --- main/inc/lib/agenda.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main/inc/lib/agenda.lib.php b/main/inc/lib/agenda.lib.php index 8027ad20fc..bc27eb372b 100644 --- a/main/inc/lib/agenda.lib.php +++ b/main/inc/lib/agenda.lib.php @@ -1688,7 +1688,6 @@ class Agenda } else { $where_condition = "( ip.to_user_id = $user_id OR ip.to_user_id IS NULL OR (ip.to_group_id IN (0, ".implode(", ", $group_memberships).")) ) "; } - //var_dump($where_condition); if (empty($session_id)) { $sessionCondition = " @@ -1730,11 +1729,12 @@ class Agenda if (empty($user_id)) { $where_condition = ''; } else { - $where_condition = " (ip.to_user_id = ".$user_id.") AND ip.to_group_id IS NULL AND "; + $where_condition = " (ip.to_user_id = ".$user_id.") AND (ip.to_group_id IS NULL OR ip.to_group_id = 0) AND "; } $visibilityCondition = " (ip.visibility IN ('1', '0')) AND "; } else { - $where_condition = " ( (ip.to_user_id = ".api_get_user_id().") AND ip.to_group_id IS NULL) AND "; + // Show my items and also items sent to everyone + $where_condition = " ( (ip.to_user_id = ".api_get_user_id()." OR (ip.to_user_id = 0 or ip.to_user_id is NULL)) AND (ip.to_group_id IS NULL OR ip.to_group_id = 0)) AND "; } if (empty($session_id)) {