From c5888b1d1a8808acc24a1fb0e0d67ae6a380f225 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 11 Mar 2020 15:00:35 +0100 Subject: [PATCH] Added control for favourites filter in TreeService class --- .../include/class/TreeService.class.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/class/TreeService.class.php b/pandora_console/include/class/TreeService.class.php index 721b5e6f92..38787e47f3 100644 --- a/pandora_console/include/class/TreeService.class.php +++ b/pandora_console/include/class/TreeService.class.php @@ -122,6 +122,8 @@ class TreeService extends Tree { $fields = $this->getFirstLevelFields(); + $is_favourite = $this->getServiceFavouriteFilter(); + if (users_can_manage_group_all('AR')) { $groups_acl = ''; } else { @@ -143,13 +145,15 @@ class TreeService extends Tree ON ts.id=tse.id_service WHERE 1=1 + %s %s GROUP BY id ) as t1 ON tss.id_service_child = t1.id WHERE tss.id_service_child IS NULL ", - $groups_acl + $groups_acl, + $is_favourite ); $stats = db_get_all_rows_sql($sql); @@ -364,4 +368,14 @@ class TreeService extends Tree } + protected function getServiceFavouriteFilter() + { + if (isset($this->filter['is_favourite']) && !empty($this->filter['is_favourite'])) { + return ' AND is_favourite = 1'; + } + + return ''; + } + + }