From 198f5399012abad2463ce69385ce7bdfb859911d Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 12 Dec 2022 16:39:14 +0100 Subject: [PATCH] #10000 Fixed api call tree_agents --- pandora_console/include/functions_api.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index c8b9d7ae01..e96667d300 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -904,7 +904,7 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) global $module_field_column_mampping; // module related field mappings 2/2 (output field => column for 'tagente_estado') - global $estado_fields_to_columns_mapping; + global $estado_fields_to_columns_mapping; // alert related field mappings (output field => column for 'talert_template_modules', ... ) $alert_fields_to_columns_mapping = [ @@ -1016,9 +1016,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $groups = []; } - $groups = str_replace('\n', $returnReplace, $groups); - foreach ($groups as &$group) { + $group = str_replace('\n', $returnReplace, $group); + $group['type_row'] = 'group'; $returnVar[] = $group; @@ -1034,9 +1034,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $agents = []; } - $agents = str_replace('\n', $returnReplace, $agents); - foreach ($agents as $index => &$agent) { + $agent = str_replace('\n', $returnReplace, $agent); + $agent['type_row'] = 'agent'; $returnVar[] = $agent; @@ -1063,9 +1063,9 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $modules = []; } - $modules = str_replace('\n', $returnReplace, $modules); - foreach ($modules as &$module) { + $module = str_replace('\n', $returnReplace, $module); + $module['type_row'] = 'module'; if ($module['module_macros']) { @@ -1097,9 +1097,8 @@ function api_get_tree_agents($trash1, $trahs2, $other, $returnType) $alerts = []; } - $alerts = str_replace('\n', $returnReplace, $alerts); - foreach ($alerts as &$alert) { + $alert = str_replace('\n', $returnReplace, $alert); $alert['type_row'] = 'alert'; $returnVar[] = $alert; }