FIX MAIN_SEE_SUBORDONATES sql request errror (#35896)

Co-authored-by: atm-lena <lena.papazian@atm-consulting.fr>
This commit is contained in:
atm-lena
2025-10-22 17:42:58 +02:00
committed by GitHub
parent 3be9f0e9cc
commit 6df379c62a

View File

@@ -972,7 +972,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$sql .= " AND (sc.fk_user = ".((int) $user->id);
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
$userschilds = $user->getAllChildIds();
$sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")";
if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")";
}
$sql .= ")";
$sql .= " AND sc.fk_soc = s.rowid";
@@ -1082,9 +1082,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$sql .= " AND (sc.fk_user = ".((int) $user->id);
if (getDolGlobalInt('MAIN_SEE_SUBORDINATES')) {
$userschilds = $user->getAllChildIds();
foreach ($userschilds as $key => $value) {
$sql .= ' OR sc.fk_user = '.((int) $value);
}
if (!empty($userschilds)) $sql .= " OR sc.fk_user IN (".$db->sanitize(implode(',', $userschilds)).")";
}
$sql .= ')';
} else {