Improve code for get secondary groups

This commit is contained in:
José González 2021-07-02 12:20:53 +02:00
parent 159920a05d
commit 498a353a29
2 changed files with 5 additions and 2 deletions

View File

@ -500,7 +500,10 @@ if (enterprise_installed()) {
false,
// Delete_groups.
// Do not show the primary group in this selection.
array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']])
array_merge(
(empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [],
[$agent['id_grupo']]
)
// Include_groups.
// Size.
// Simple_multiple_options.

View File

@ -4843,7 +4843,7 @@ function events_page_general($event)
if (isset($event['id_agente']) && $event['id_agente'] > 0) {
enterprise_include_once('include/functions_agents.php');
$secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]);
if (!empty($secondary_groups_selected)) {
if (empty($secondary_groups_selected['for_select']) === false) {
$secondary_groups = implode(', ', $secondary_groups_selected['for_select']);
}
}