#12168 Fixed sql bringing main services

This commit is contained in:
Jorge Rincon 2023-11-13 13:41:47 +01:00
parent 13ba9aff39
commit 04649dee00
2 changed files with 7 additions and 10 deletions

View File

@ -738,19 +738,15 @@ class TreeService extends Tree
$filterResult = db_get_all_rows_sql($sqlFilter);
$services = [];
foreach ($filterResult as $key => $result) {
$ancestors = services_get_services_ancestors($result['id']);
$idAncestors = implode(',', $ancestors);
$numAncestors = count($ancestors);
if ($numAncestors > 1) {
$whereAncestors = ' AND tse.id_service_child in ('.$idAncestors.')';
} else if ($numAncestors == 1) {
$whereAncestors = ' AND ts.id ='.$idAncestors;
} else {
$whereAncestors = ' AND ts.id ='.$result['id'];
}
$services_ancestors = services_get_services_ancestors($result['id']);
$services[] = array_pop($services_ancestors);
}
$services_list = array_unique($services, SORT_NUMERIC);
$whereAncestors = ' AND tse.id_service IN ('.implode(',', $services_list).')';
return $whereAncestors;
}

View File

@ -1561,6 +1561,7 @@ var TreeController = {
* Filter the tree based on a search criterion
*/
function _filterItems(rawTree, searched) {
console.log(rawTree);
const ancestors = [];
const father = [];
const newTree = [];