mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
#12168 Fixed sql bringing main services
This commit is contained in:
parent
13ba9aff39
commit
04649dee00
@ -738,19 +738,15 @@ class TreeService extends Tree
|
|||||||
|
|
||||||
$filterResult = db_get_all_rows_sql($sqlFilter);
|
$filterResult = db_get_all_rows_sql($sqlFilter);
|
||||||
|
|
||||||
|
$services = [];
|
||||||
foreach ($filterResult as $key => $result) {
|
foreach ($filterResult as $key => $result) {
|
||||||
$ancestors = services_get_services_ancestors($result['id']);
|
$services_ancestors = services_get_services_ancestors($result['id']);
|
||||||
$idAncestors = implode(',', $ancestors);
|
$services[] = array_pop($services_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_list = array_unique($services, SORT_NUMERIC);
|
||||||
|
$whereAncestors = ' AND tse.id_service IN ('.implode(',', $services_list).')';
|
||||||
|
|
||||||
return $whereAncestors;
|
return $whereAncestors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1561,6 +1561,7 @@ var TreeController = {
|
|||||||
* Filter the tree based on a search criterion
|
* Filter the tree based on a search criterion
|
||||||
*/
|
*/
|
||||||
function _filterItems(rawTree, searched) {
|
function _filterItems(rawTree, searched) {
|
||||||
|
console.log(rawTree);
|
||||||
const ancestors = [];
|
const ancestors = [];
|
||||||
const father = [];
|
const father = [];
|
||||||
const newTree = [];
|
const newTree = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user