Merge branch 'ent-7767-secondary-groups-no-se-anaden-agente' into 'develop'

Improve code for get secondary groups

Closes pandora_enterprise#7767

See merge request artica/pandorafms!4259
This commit is contained in:
Daniel Rodriguez 2021-08-02 07:18:02 +00:00
commit 2963d67225
3 changed files with 6 additions and 3 deletions

View File

@ -500,7 +500,10 @@ if (enterprise_installed()) {
false, false,
// Delete_groups. // Delete_groups.
// Do not show the primary group in this selection. // 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. // Include_groups.
// Size. // Size.
// Simple_multiple_options. // Simple_multiple_options.

View File

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

View File

@ -388,7 +388,7 @@ $table_contact->data[] = $data;
$data = []; $data = [];
$data[0] = '<b>'.__('Secondary groups').'</b>'; $data[0] = '<b>'.__('Secondary groups').'</b>';
$secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]); $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]);
if (!$secondary_groups) { if (empty($secondary_groups['for_select']) === true) {
$data[1] = '<em>'.__('N/A').'</em>'; $data[1] = '<em>'.__('N/A').'</em>';
} else { } else {
$secondary_links = []; $secondary_links = [];