From 9bf9101de5d84b314a2043ef4176c46690112889 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Thu, 24 Sep 2015 12:29:47 +0200 Subject: [PATCH] Fixed problems with wizard visual console. Tiquet: #2756 --- .../reporting/visual_console_builder.php | 60 ++++++++++--------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index ae1332d253..4e57f5b65d 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -404,9 +404,15 @@ switch ($activeTab) { if (defined("METACONSOLE")) { + $agents_ids = array(); + foreach ($id_agents as $id_agent_id) { + $server_and_agent = explode("|",$id_agent_id); + + $agents_ids[] = $server_and_agent[1]; + } $rows = db_get_all_rows_filter( 'tmetaconsole_agent', - array('id_tagente' => $id_agents)); + array('id_tagente' => $agents_ids)); $agents = array(); foreach ($rows as $row) { @@ -475,36 +481,36 @@ switch ($activeTab) { $id_modules = array(); if ($id_server != 0) { - if (metaconsole_connect(null, $id_server) != NOERR) { - continue; - } - } - - foreach ($name_modules as $mod) { - - - - foreach ($id_agents as $ag) { + foreach ($name_modules as $serial_data) { + $modules_serial = explode(';', $serial_data); - $id_module = agents_get_modules($ag, - array('id_agente_modulo'), - array('nombre' => $mod)); - - - - if (empty($id_module)) - continue; - else { - $id_module = reset($id_module); - $id_module = $id_module['id_agente_modulo']; + foreach ($modules_serial as $data_serialized) { + $data = explode('|', $data_serialized); + $id_modules[] = $data[0]; } - - $id_modules[] = $id_module; } } - - if ($id_server != 0) { - metaconsole_restore_db(); + else { + foreach ($name_modules as $mod) { + + foreach ($id_agents as $ag) { + + $id_module = agents_get_modules($ag, + array('id_agente_modulo'), + array('nombre' => $mod)); + + + + if (empty($id_module)) + continue; + else { + $id_module = reset($id_module); + $id_module = $id_module['id_agente_modulo']; + } + + $id_modules[] = $id_module; + } + } } $message .= visual_map_process_wizard_add_modules(