diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index b3298be2fc..7594f0e5a6 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,9 @@ +2012-05-31 Vanessa Gil + + * godmode/agentes/agent_template.php: Fixed bug: adding + modules to an agent with templates, if the agent already had + modules can be duplicated with the same name. + 2012-05-31 Sergio Martin * extensions/system_info.php: Fixed strange behavior in diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index 45abd8d7b9..d5b516a9db 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -27,7 +27,7 @@ require_once($config['homedir'] . "/include/functions_modules.php"); // ========================== if (isset ($_POST["template_id"])) { // Take agent data - $row = db_get_row ("tagente", "id_agente", $id_agente); + $row = db_get_row ("tagente", "id_agente", $id_agente); if ($row !== false) { $intervalo = $row["intervalo"]; $nombre_agente = $row["nombre"]; @@ -43,8 +43,9 @@ if (isset ($_POST["template_id"])) { } else { return; } - + $id_np = get_parameter_post ("template_id"); + $name_template = db_get_value ('name', 'tnetwork_profile', 'id_np', $id_np); $npc = db_get_all_rows_field_filter ("tnetwork_profile_component", "id_np", $id_np); if ($npc === false) { $npc = array (); @@ -54,12 +55,12 @@ if (isset ($_POST["template_id"])) { if ($nc === false) { $nc = array (); } - foreach ($nc as $row2) { + foreach ($nc as $row2) { // Insert each module from tnetwork_component into agent $values = array( 'id_agente' => $id_agente, 'id_tipo_modulo' => $row2["type"], - 'descripcion' => $row2["description"], + 'descripcion' => __('Created by template ').$name_template. ' . '.$row2["description"], 'nombre' => $row2["name"], 'max' => $row2["max"], 'min' => $row2["min"],