From 4a20bdb2fd4e92307ca4f2e63871e04cb346fb99 Mon Sep 17 00:00:00 2001 From: Pablo Aragon Date: Tue, 16 Apr 2024 12:10:05 +0200 Subject: [PATCH] 13562-Fix duplicate column id_grupo in events_get_all() --- pandora_console/include/functions_events.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 856d91575c..6e6068f386 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1675,8 +1675,15 @@ function events_get_all( } if (!$user_is_admin && users_can_manage_group_all('ER') === false) { - if (str_contains($fields[0], 'te.id_grupo') === false) { - $fields[0] .= ', te.id_grupo'; + $exists_id_grupo = false; + foreach ($fields as $field) { + if (str_contains($field, 'te.id_grupo') === true || str_contains($field, 'te.*') === true) { + $exists_id_grupo = true; + } + } + + if ($exists_id_grupo === false) { + $fields[] = 'te.id_grupo'; } }