FIX php8 compatibility
This commit is contained in:
parent
4e51fca845
commit
f238597c2d
@ -796,7 +796,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||||||
if (in_array($feature, $check) && $objectid > 0) { // For $objectid = 0, no check
|
if (in_array($feature, $check) && $objectid > 0) { // For $objectid = 0, no check
|
||||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||||
if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) { // Special for multicompany
|
if (($feature == 'user' || $feature == 'usergroup') && isModEnabled('multicompany')) { // Special for multicompany
|
||||||
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||||
if ($conf->entity == 1 && $user->admin && !$user->entity) {
|
if ($conf->entity == 1 && $user->admin && !$user->entity) {
|
||||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
||||||
@ -840,7 +840,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||||||
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
$sql .= " AND sc.fk_user = ".((int) $user->id);
|
||||||
$sql .= " AND sc.fk_soc = s.rowid";
|
$sql .= " AND sc.fk_soc = s.rowid";
|
||||||
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
|
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
} elseif (!empty($conf->multicompany->enabled)) {
|
} elseif (isModEnabled('multicompany')) {
|
||||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||||
$sql = "SELECT COUNT(s.rowid) as nb";
|
$sql = "SELECT COUNT(s.rowid) as nb";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
@ -865,7 +865,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||||||
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
|
||||||
$sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user
|
$sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user
|
||||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
} elseif (!empty($conf->multicompany->enabled)) {
|
} elseif (isModEnabled('multicompany')) {
|
||||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||||
@ -951,7 +951,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
|
|||||||
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||||
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR sc.fk_user IS NULL)";
|
$sql .= " AND (sc.fk_user = ".((int) $user->id)." OR sc.fk_user IS NULL)";
|
||||||
}
|
}
|
||||||
} elseif (!empty($conf->multicompany->enabled)) {
|
} elseif (isModEnabled('multicompany')) {
|
||||||
// If multicompany and internal users with all permissions, check user is in correct entity
|
// If multicompany and internal users with all permissions, check user is in correct entity
|
||||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user