2012-05-31 Vanessa Gil <vanessa.gil@artica.es>

* 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.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6383 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-05-31 10:22:18 +00:00
parent 81dec672fb
commit 9013a6a540
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2012-05-31 Vanessa Gil <vanessa.gil@artica.es>
* 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 <sergio.martin@artica.es>
* extensions/system_info.php: Fixed strange behavior in

View File

@ -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"],