From d6363d37b7df5e0f5b301a680b3d23f86e722f51 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 26 Dec 2023 13:22:24 +0100 Subject: [PATCH 1/2] #12684 Fix tree view filter --- pandora_console/include/ajax/tree.ajax.php | 4 +++- pandora_console/include/class/Tree.class.php | 13 +++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 7b47fa8b42..309c314a90 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -214,7 +214,9 @@ if (is_ajax() === true) { $tree->setFilter($filter); ob_clean(); - echo json_encode(['success' => 1, 'tree' => $tree->getArray()]); + $tree_json = json_encode(['success' => 1, 'tree' => $tree->getArray()]); + + echo $tree_json; return; } diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index fc02023b3e..9ec4ac14b6 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -126,11 +126,12 @@ class Tree public function setFilter($filter) { // There is not module filter in metaconsole. - /* - if (is_metaconsole()) { + if (is_metaconsole()) { + $filter['searchMetaconsoleModule'] = $filter['searchModule']; $filter['searchModule'] = ''; + $filter['statusMetaconsoleModule'] = $filter['statusModule']; $filter['statusModule'] = self::TV_DEFAULT_AGENT_STATUS; - }*/ + } $this->filter = $filter; } @@ -1064,9 +1065,9 @@ class Tree if (!empty($this->filter['searchModule'])) { $module_search_inner = ' INNER JOIN tagente_estado tae - ON tae.id_agente_modulo = tam_inner.id_agente_modulo'; - $module_search_filter = "AND tam_inner.disabled = 0 - AND tam_inner.nombre LIKE '%%".$this->filter['searchModule']."%%' ".$this->getModuleStatusFilterFromTestado(); + ON tae.id_agente_modulo = tam.id_agente_modulo'; + $module_search_filter = "AND tam.disabled = 0 + AND tam.nombre LIKE '%%".$this->filter['searchModule']."%%' ".$this->getModuleStatusFilterFromTestado(); } $sql_model = "SELECT %s FROM From 696ca72a8022dcdb9bb3233d323c23a78fdbe1ec Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 27 Dec 2023 13:20:36 +0100 Subject: [PATCH 2/2] #12684 Fix tree view filter --- pandora_console/include/class/Tree.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index 6e91e36fcc..99b4f5b039 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -1068,9 +1068,7 @@ class Tree $module_search_filter = ''; if (!empty($this->filter['searchModule'])) { - $module_search_inner = ' - INNER JOIN tagente_estado tae - ON tae.id_agente_modulo = tam.id_agente_modulo'; + $module_search_inner = ''; $module_search_filter = "AND tam.disabled = 0 AND tam.nombre LIKE '%%".$this->filter['searchModule']."%%' ".$this->getModuleStatusFilterFromTestado(); }