Skip to content

Commit 9c2cc1b

Browse files
authored
Fix SQL query that finds alerts to display to the user (#145)
1 parent 059b49e commit 9c2cc1b

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

inc/alert.class.php

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -285,26 +285,30 @@ public static function findAllToNotify($params = [])
285285
$show_central_sql = [];
286286
if (isset($_SESSION['glpiID']) && isset($_SESSION['glpiactiveprofile']['id'])) {
287287
$targets_sql = [
288-
'OR' => [
288+
'AND' => [
289289
[
290-
'AND' => [
291-
"$ttable.itemtype" => 'Profile',
292-
'OR' => [
293-
"$ttable.items_id" => $_SESSION['glpiactiveprofile']['id'],
294-
"$ttable.all_items" => 1,
290+
'OR' => [
291+
[
292+
'AND' => [
293+
"$ttable.itemtype" => 'Profile',
294+
'OR' => [
295+
"$ttable.items_id" => $_SESSION['glpiactiveprofile']['id'],
296+
"$ttable.all_items" => 1,
297+
],
298+
]
299+
],
300+
[
301+
'AND' => [
302+
"$ttable.itemtype" => 'Group',
303+
"$ttable.items_id" => $fndgroup,
304+
]
305+
],
306+
[
307+
'AND' => [
308+
"$ttable.itemtype" => 'User',
309+
"$ttable.items_id" => $_SESSION['glpiID'],
310+
]
295311
],
296-
]
297-
],
298-
[
299-
'AND' => [
300-
"$ttable.itemtype" => 'Group',
301-
"$ttable.items_id" => $fndgroup,
302-
]
303-
],
304-
[
305-
'AND' => [
306-
"$ttable.itemtype" => 'User',
307-
"$ttable.items_id" => $_SESSION['glpiID'],
308312
]
309313
],
310314
]

0 commit comments

Comments
 (0)