From 3f2faf466768471729ec95054b26a549b080aa64 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 10 Sep 2022 11:02:48 +0200 Subject: [PATCH] update code toward php8 compliance --- htdocs/comm/index.php | 4 ++-- htdocs/contact/list.php | 2 +- htdocs/core/ajax/objectonoff.php | 2 +- htdocs/core/boxes/box_clients.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index ed6184e0cd4..01f3bba9eff 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -594,7 +594,7 @@ print '
'; /* * Last modified customers or prospects */ -if (isModEnabled("societe") && $user->rights->societe->lire) { +if (isModEnabled("societe") && $user->hasRight('societe', 'lire')) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; @@ -700,7 +700,7 @@ if (isModEnabled("societe") && $user->rights->societe->lire) { /* * Last suppliers */ -if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->rights->societe->lire) { +if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) && $user->hasRight('societe', 'lire')) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.code_fournisseur, s.code_compta_fournisseur, s.fournisseur"; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1070c9e0b9d..c2b0120790b 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -312,7 +312,7 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Contact'; $objectlabel = 'Contact'; - $permissiontoread = $user->rights->societe->lire; + $permissiontoread = $user->hasRight('societe', 'lire'); $permissiontodelete = $user->rights->societe->supprimer; $permissiontoadd = $user->rights->societe->creer; $uploaddir = $conf->societe->dir_output; diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index c66a49557d0..77cd3234cd8 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -67,7 +67,7 @@ if (!empty($user->socid)) { $socid = $user->socid; } -//$user->rights->societe->lire = 0;$user->rights->fournisseur->lire = 0; +//$user->hasRight('societe', 'lire') = 0;$user->rights->fournisseur->lire = 0; //restrictedArea($user, 'societe', $id); if (in_array($field, array('status'))) { diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 364b79932ef..cb934debef3 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -86,7 +86,7 @@ class box_clients extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max)); - if ($user->rights->societe->lire) { + if ($user->hasRight('societe', 'lire')) { $sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; $sql .= ", s.logo, s.email, s.entity";