From 656a0a1d21aa9b19139205d58c9e6f5dbedcba9d Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 18 May 2010 12:10:39 +0000 Subject: [PATCH] 2010-05-18 Sergio Martin * operation/agentes/ver_agente.php godmode/reporting/visual_console_builder.wizard.php godmode/reporting/visual_console_builder.php: Fixed the multiple agents selection on visual console wizard for bug 2997750 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2744 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 8 +++++++ .../reporting/visual_console_builder.php | 22 ++++++++++++++++--- .../visual_console_builder.wizard.php | 4 ++-- .../operation/agentes/ver_agente.php | 2 +- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ca5962b9a8..cf49eed0fd 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,11 @@ +2010-05-18 Sergio Martin + + * operation/agentes/ver_agente.php + godmode/reporting/visual_console_builder.wizard.php + godmode/reporting/visual_console_builder.php: Fixed the + multiple agents selection on visual console wizard + for bug 2997750 + 2010-05-18 Miguel de Dios * include/javascript/pandora.js: added function diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index edf649b38c..596b8cd2fd 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -136,16 +136,32 @@ switch ($activeTab) { switch ($action) { case 'update': $id_agents = get_parameter ('id_agents', array ()); - $id_modules = get_parameter ('module', array ()); + $name_modules = get_parameter ('module', array ()); + $image = get_parameter ('image'); $range = (int) get_parameter ("range", 50); $width = (int) get_parameter ("width", 0); $height = (int) get_parameter ("height", 0); $message = ''; - if ($id_modules[0] == 0) + if ($name_modules[0] == '0') $message .= process_wizard_add ($id_agents, $image, $idVisualConsole, $range, $width, $height); - else + else{ + $id_modules = array(); + $cont_dest = 1; + $cont_mod = 1; + foreach($name_modules as $mod){ + $cont_ag = 1; + foreach($id_agents as $ag){ + $sql = "SELECT id_agente_modulo FROM tagente_modulo WHERE delete_pending = 0 AND id_agente = ".$ag." AND nombre = '".$mod."'"; + $result = get_db_row_sql ($sql); + $id_modules[$cont_dest] = $result['id_agente_modulo']; + $cont_ag = $cont_ag + 1; + $cont_dest = $cont_dest + 1; + } + $cont_mod = $cont_mod + 1; + } $message .= process_wizard_add_modules ($id_modules, $image, $idVisualConsole, $range, $width, $height); + } $statusProcessInDB = array('flag' => true, 'message' => $message); $action = 'edit'; break; diff --git a/pandora_console/godmode/reporting/visual_console_builder.wizard.php b/pandora_console/godmode/reporting/visual_console_builder.wizard.php index 8de49b88da..30e2734f4b 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.wizard.php +++ b/pandora_console/godmode/reporting/visual_console_builder.wizard.php @@ -82,6 +82,6 @@ echo ''; \ No newline at end of file + diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 3b129900b1..ead3e35280 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -75,7 +75,7 @@ if (is_ajax ()) { if ($get_agent_modules_json_for_multiple_agents) { $idAgents = get_parameter('id_agent'); - $nameModules = get_db_all_rows_sql('SELECT DISTINCT(nombre) FROM tagente_modulo WHERE id_agente IN (' . implode(',', $idAgents) . ')'); + $nameModules = get_db_all_rows_sql('SELECT DISTINCT(nombre) FROM tagente_modulo t1 WHERE delete_pending = 0 AND id_agente IN (' . implode(',', $idAgents) . ') AND (SELECT count(nombre) FROM tagente_modulo t2 WHERE delete_pending = 0 AND t1.nombre = t2.nombre AND id_agente IN (' . implode(',', $idAgents) . ')) = (' . count($idAgents) . ')'); $result = array(); foreach($nameModules as $nameModule) {