From 0ca34c744d7f7c163e590274bfcb8f1fedb18caf Mon Sep 17 00:00:00 2001 From: fermin831 Date: Tue, 16 Oct 2018 13:29:00 +0200 Subject: [PATCH] Fixed tags filter on Tree tags --- pandora_console/include/class/Tree.class.php | 8 +++++++- pandora_console/include/class/TreeTag.class.php | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 05c994df9e..778a56afbc 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -41,6 +41,8 @@ class Tree { protected $L2conditionInside = ''; protected $L2inner = ''; + protected $L3forceTagCondition = false; + const TV_DEFAULT_AGENT_STATUS = -1; public function __construct($type, $rootType = '', $id = -1, $rootID = -1, $serverID = false, $childrenMethod = "on_demand", $access = 'AR') { @@ -891,7 +893,9 @@ class Tree { $module_status_filter = $this->getModuleStatusFilterFromTestado(); $agent_filter = "AND ta.id_agente = " . $this->id; $tag_condition = $this->getTagCondition(); - $tag_join = empty($tag_condition) ? '' : $this->getTagJoin(); + $tag_join = empty($tag_condition) && (!$this->L3forceTagCondition) + ? '' + : $this->getTagJoin(); $condition = $this->L2condition; $inner = $this->L2inner; @@ -922,6 +926,8 @@ class Tree { $module_search_filter $tag_condition ORDER BY tam.nombre ASC, tam.id_agente_modulo ASC"; + html_debug($sql, true); + html_debug($sql, true, true); return $sql; } diff --git a/pandora_console/include/class/TreeTag.class.php b/pandora_console/include/class/TreeTag.class.php index c02fb7ba4a..374945005c 100644 --- a/pandora_console/include/class/TreeTag.class.php +++ b/pandora_console/include/class/TreeTag.class.php @@ -37,6 +37,8 @@ class TreeTag extends Tree { $this->L2condition = "AND ttm.id_tag = " . $this->rootID; $this->L2inner = $this->L1innerInside; + + $this->L3forceTagCondition = true; } protected function getData() { @@ -52,10 +54,6 @@ class TreeTag extends Tree { protected function getTagJoin () { return ''; } - - protected function getTagCondition () { - return ''; - } } ?>