update code toward php8 compliance

This commit is contained in:
Philippe GRAND 2022-09-10 11:14:25 +02:00
parent a2b8dd446b
commit c8a70ba221
5 changed files with 5 additions and 5 deletions

View File

@ -131,7 +131,7 @@ if ($id > 0 && empty($object->id)) {
}
}
if ($object->id > 0) {
if (!($object->client > 0) || empty($user->rights->societe->lire)) {
if (!($object->client > 0) || !$user->hasRight('societe', 'lire')) {
accessforbidden();
}
}

View File

@ -104,7 +104,7 @@ class FormContract
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) {
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight('societe', 'lire')) {
// Do nothing
} else {
$labeltoshow = dol_trunc($obj->ref, 18);

View File

@ -99,7 +99,7 @@ class FormIntervention
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) {
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight('societe', 'lire')) {
// Do nothing
} else {
$labeltoshow = dol_trunc($obj->ref, 18);

View File

@ -206,7 +206,7 @@ class FormProjets
while ($i < $num) {
$obj = $this->db->fetch_object($resql);
// If we ask to filter on a company and user has no permission to see all companies and project is linked to another company, we hide project.
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($user->rights->societe->lire)) {
if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && !$user->hasRight('societe', 'lire')) {
// Do nothing
} else {
if ($discard_closed == 1 && $obj->fk_statut == 2 && $obj->rowid != $selected) { // We discard closed except if selected

View File

@ -421,7 +421,7 @@ function restrictedArea(User $user, $features, $objectid = 0, $tableandshare = '
}
if ($feature == 'societe') {
if (empty($user->rights->societe->lire) && empty($user->rights->fournisseur->lire)) {
if (!$user->hasRight('societe', 'lire') && empty($user->rights->fournisseur->lire)) {
$readok = 0;
$nbko++;
}