diff --git a/pandora_console/extensions/agents_modules.php b/pandora_console/extensions/agents_modules.php index d3467b846c..5bf3d18ab5 100644 --- a/pandora_console/extensions/agents_modules.php +++ b/pandora_console/extensions/agents_modules.php @@ -729,16 +729,31 @@ function mainAgentsModules() if (isset($modules_selected[0]) === true && $modules_selected[0]) { $all_modules = []; foreach ($modules_selected as $key => $value) { - $name = modules_get_agentmodule_name($value); - $sql = "SELECT id_agente_modulo - FROM tagente_modulo - WHERE nombre = '".$name."';"; + if (is_int($value)) { + $name = modules_get_agentmodule_name($value); + $sql = "SELECT id_agente_modulo + FROM tagente_modulo + WHERE nombre = '".$name."';"; - $result_sql = db_get_all_rows_sql($sql); + $result_sql = db_get_all_rows_sql($sql); - if (is_array($result_sql)) { - foreach ($result_sql as $key => $value) { - $all_modules[$value['id_agente_modulo']] = io_safe_output($name); + if (is_array($result_sql)) { + foreach ($result_sql as $key => $value) { + $all_modules[$value['id_agente_modulo']] = io_safe_output($name); + } + } + } else { + $name = $value; + $sql = "SELECT id_agente_modulo + FROM tagente_modulo + WHERE nombre = '".$name."';"; + + $result_sql = db_get_all_rows_sql($sql); + + if (is_array($result_sql)) { + foreach ($result_sql as $key => $value) { + $all_modules[$value['id_agente_modulo']] = io_safe_output($name); + } } } } @@ -838,7 +853,7 @@ function mainAgentsModules() echo '