diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index a5bb41a29a..a5e61f6d07 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -796,6 +796,8 @@ function agents_common_modules ($id_agent, $filter = false, $indexed = true, $ge * @param boolean $childGroups The flag to get agents in the child group of group parent passed. By default false. * @param boolean $serialized Only in metaconsole. Return the key as . By default false. * @param string $separator Only in metaconsole. Separator for the serialized data. By default |. + * @param bool $add_alert_bulk_op //TODO documentation + * @param bool $force_serialized. If the agent has not id_server (typically in node) put 0 as . * * @return array An array with all agents in the group or an empty array */ @@ -808,7 +810,7 @@ function agents_get_group_agents ( $serialized = false, $separator = '|', $add_alert_bulk_op = false, - $meta_use_main_id = false + $force_serialized = false ) { global $config; @@ -960,7 +962,7 @@ function agents_get_group_agents ( $table_name = 'tmetaconsole_agent'; $fields = array( - $meta_use_main_id ? 'id_agente' : 'id_tagente AS id_agente', + 'id_tagente AS id_agente', 'alias', 'id_tmetaconsole_setup AS id_server' ); @@ -986,11 +988,12 @@ function agents_get_group_agents ( if ($serialized && isset($row["id_server"])) { $key = $row["id_server"] . $separator . $row["id_agente"]; - } - else { + } elseif ($force_serialized) { + $key = "0" . $separator . $row["id_agente"]; + } else { $key = $row["id_agente"]; } - + switch ($case) { case "lower": $value = mb_strtolower ($row["alias"], "UTF-8"); diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 8979b04b14..680181c380 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -5455,7 +5455,7 @@ function api_set_add_agent_policy($id, $thrash1, $other, $thrash2) { } if ($id_agent_policy === false) { - $success = enterprise_hook('policies_create_agent', array($other['data'][0], $id, true)); + $success = enterprise_hook('policies_create_agent', array($other['data'][0], $id)); } else { returnError('error_add_agent_policy', __('Error adding agent to policy. The agent is already in the policy.'));