From 4ccc79f253a93ce423d36ef99a66ff2189da3c63 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 10 Sep 2022 11:04:37 +0200 Subject: [PATCH] update code toward php8 compliance --- htdocs/core/boxes/box_customers_outstanding_bill_reached.php | 2 +- htdocs/core/boxes/box_dolibarr_state_board.php | 4 ++-- htdocs/core/boxes/box_fournisseurs.php | 2 +- htdocs/core/boxes/box_goodcustomers.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index 2bf5a2c0693..ec82f1a57e4 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -86,7 +86,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastOutstandingBillReached", $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"; diff --git a/htdocs/core/boxes/box_dolibarr_state_board.php b/htdocs/core/boxes/box_dolibarr_state_board.php index a60d5c20a93..0f63582370c 100644 --- a/htdocs/core/boxes/box_dolibarr_state_board.php +++ b/htdocs/core/boxes/box_dolibarr_state_board.php @@ -114,8 +114,8 @@ class box_dolibarr_state_board extends ModeleBoxes $conditions = array( 'users' => $user->hasRight('user', 'user', 'lire'), 'members' => isModEnabled('adherent') && $user->rights->adherent->lire, - 'customers' => isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), - 'prospects' => isModEnabled('societe') && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), + 'customers' => isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), + 'prospects' => isModEnabled('societe') && $user->hasRight('societe', 'lire') && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), 'suppliers' => ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire) diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 59280aeec62..1c14ac0be4f 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -81,7 +81,7 @@ class box_fournisseurs extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $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_fournisseur, s.code_compta_fournisseur, s.fournisseur"; $sql .= ", s.logo, s.email, s.entity"; diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 3341e08107d..90ffc82a5d8 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -69,7 +69,7 @@ class box_goodcustomers extends ModeleBoxes $this->enabled = 0; // not enabled by default. Very slow on large database } - $this->hidden = empty($user->rights->societe->lire); + $this->hidden = !$user->hasRight('societe', 'lire'); } /** @@ -90,7 +90,7 @@ class box_goodcustomers extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxTitleGoodCustomers", $max)); - if ($user->rights->societe->lire) { + if ($user->hasRight('societe', 'lire')) { $sql = "SELECT s.rowid, s.nom as name, s.logo, s.code_client, s.code_fournisseur, s.client, s.fournisseur, s.tms as datem, s.status as status,"; $sql .= " count(*) as nbfact, sum(".$this->db->ifsql('f.paye=1', '1', '0').") as nbfactpaye"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";