Merge branch 'ent-8249-12679-Incluir-filtrado-por-nombre-en-vista-de-arbol-de-servicios' into 'develop'
Ent 8249 12679 incluir filtrado por nombre en vista de arbol de servicios Ref pandora_enterprise#8249 See merge request artica/pandorafms!4899
This commit is contained in:
commit
3bbd08ec11
|
@ -252,6 +252,7 @@ class TreeService extends Tree
|
||||||
protected function getProcessedServices()
|
protected function getProcessedServices()
|
||||||
{
|
{
|
||||||
$is_favourite = $this->getServiceFavouriteFilter();
|
$is_favourite = $this->getServiceFavouriteFilter();
|
||||||
|
$service_search = $this->getServiceNameSearchFilter();
|
||||||
|
|
||||||
if (users_can_manage_group_all('AR')) {
|
if (users_can_manage_group_all('AR')) {
|
||||||
$groups_acl = '';
|
$groups_acl = '';
|
||||||
|
@ -259,6 +260,16 @@ class TreeService extends Tree
|
||||||
$groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')';
|
$groups_acl = 'AND ts.id_group IN ('.implode(',', $this->userGroupsArray).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$exclude_children = 'ts.id NOT IN (
|
||||||
|
SELECT DISTINCT id_service_child
|
||||||
|
FROM tservice_element
|
||||||
|
WHERE id_server_meta = 0
|
||||||
|
)';
|
||||||
|
|
||||||
|
if ($service_search !== '') {
|
||||||
|
$exclude_children = '1=1';
|
||||||
|
}
|
||||||
|
|
||||||
$sql = sprintf(
|
$sql = sprintf(
|
||||||
'SELECT
|
'SELECT
|
||||||
ts.id,
|
ts.id,
|
||||||
|
@ -277,15 +288,14 @@ class TreeService extends Tree
|
||||||
FROM tservice ts
|
FROM tservice ts
|
||||||
LEFT JOIN tservice_element tse
|
LEFT JOIN tservice_element tse
|
||||||
ON tse.id_service = ts.id
|
ON tse.id_service = ts.id
|
||||||
WHERE ts.id NOT IN (
|
WHERE %s
|
||||||
SELECT DISTINCT id_service_child
|
%s
|
||||||
FROM tservice_element
|
|
||||||
WHERE id_server_meta = 0
|
|
||||||
)
|
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
GROUP BY ts.id',
|
GROUP BY ts.id',
|
||||||
|
$exclude_children,
|
||||||
$is_favourite,
|
$is_favourite,
|
||||||
|
$service_search,
|
||||||
$groups_acl
|
$groups_acl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -722,6 +732,23 @@ class TreeService extends Tree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve SQL filter for current filter
|
||||||
|
*
|
||||||
|
* @return string SQL filter.
|
||||||
|
*/
|
||||||
|
protected function getServiceNameSearchFilter()
|
||||||
|
{
|
||||||
|
if (isset($this->filter['searchService']) === true
|
||||||
|
&& empty($this->filter['searchService']) === false
|
||||||
|
) {
|
||||||
|
return " AND (ts.name LIKE '%".$this->filter['searchService']."%' OR ts.description LIKE '%".$this->filter['searchService']."%')";
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrites partial functionality of general Tree.class.
|
* Overwrites partial functionality of general Tree.class.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue