Merge branch 'ent-2929-Check-servicios-favoritos' into 'develop'

Added control for favourites filter in TreeService class

See merge request artica/pandorafms!3098
This commit is contained in:
Alejandro Fraguas 2020-03-12 09:50:54 +01:00
commit 1a8539fe81
1 changed files with 15 additions and 1 deletions

View File

@ -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 '';
}
}