From 3eb85c64087aac9c0ccaa7d23d2d2f0d0f823edc Mon Sep 17 00:00:00 2001 From: zarzuelo Date: Tue, 30 Apr 2013 15:49:05 +0000 Subject: [PATCH] 2013-04-30 Sergio Martin * godmode/agentes/agent_template.php: Add tags creation in module tamplates application for bug #3611909 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8090 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ .../godmode/agentes/agent_template.php | 21 +++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 16615ad534..9067f4bf85 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2013-04-30 Sergio Martin + + * godmode/agentes/agent_template.php: Add tags creation + in module tamplates application for bug #3611909 + 2013-04-30 Sergio Martin * godmode/reporting/reporting_builder.item_editor.php: diff --git a/pandora_console/godmode/agentes/agent_template.php b/pandora_console/godmode/agentes/agent_template.php index a517844ceb..e615a55037 100644 --- a/pandora_console/godmode/agentes/agent_template.php +++ b/pandora_console/godmode/agentes/agent_template.php @@ -100,6 +100,14 @@ if (isset ($_POST["template_id"])) { $name = $row2["name"]; + // Put tags in array if the component has to add them later + if(!empty($row2["tags"])) { + $tags = explode(',', $row2["tags"]); + } + else { + $tags = array(); + } + // Check if this module exists in the agent $module_name_check = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('delete_pending' => 0, 'nombre' => $name, 'id_agente' => $id_agente)); @@ -114,6 +122,19 @@ if (isset ($_POST["template_id"])) { $error_count++; } else { + if(!empty($tags)) { + // Creating tags + $tag_ids = array(); + foreach ($tags as $tag_name) { + $tag_id = tags_get_id($tag_name); + + //If tag exists in the system we store to create it + $tag_ids[] = $tag_id; + } + + tags_insert_module_tag ($id_agente_modulo, $tag_ids); + } + $success_count++; } }