update code toward php8 compliance

This commit is contained in:
Philippe GRAND 2022-09-10 11:07:00 +02:00
parent 4ccc79f253
commit e73b8983bf
6 changed files with 7 additions and 7 deletions

View File

@ -85,7 +85,7 @@ class box_contacts extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedContacts", $max));
if ($user->rights->societe->lire && $user->rights->societe->contact->lire) {
if ($user->hasRight('societe', 'lire') && $user->rights->societe->contact->lire) {
$sql = "SELECT sp.rowid as id, sp.lastname, sp.firstname, sp.civility as civility_id, sp.datec, sp.tms, sp.fk_soc, sp.statut as status";
$sql .= ", sp.address, sp.zip, sp.town, sp.phone, sp.phone_perso, sp.phone_mobile, sp.email as spemail";

View File

@ -86,7 +86,7 @@ class box_prospect extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedProspects", $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";

View File

@ -831,7 +831,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
if ($user->socid != $objectid) {
return false;
}
} elseif (isModEnabled("societe") && ($user->rights->societe->lire && empty($user->rights->societe->client->voir))) {
} elseif (isModEnabled("societe") && ($user->hasRight('societe', 'lire') && empty($user->rights->societe->client->voir))) {
// If internal user: Check permission for internal users that are restricted on their objects
$sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -857,7 +857,7 @@ function checkUserAccessToObject($user, array $featuresarray, $object = 0, $tabl
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
$sql .= " WHERE dbt.".$dbt_select." IN (".$db->sanitize($objectid, 1).")";
$sql .= " AND dbt.fk_soc = ".((int) $user->socid);
} elseif (isModEnabled("societe") && ($user->rights->societe->lire && empty($user->rights->societe->client->voir))) {
} elseif (isModEnabled("societe") && ($user->hasRight('societe', 'lire') && empty($user->rights->societe->client->voir))) {
// If internal user: Check permission for internal users that are restricted on their objects
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";

View File

@ -337,7 +337,7 @@ function displayPositionCard(&$object)
// */
// $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id;
// $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id;
// $genallowed = $user->rights->societe->lire;
// $genallowed = $user->hasRight('societe', 'lire');
// $delallowed = $user->rights->societe->creer;
//
// print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);

View File

@ -27,7 +27,7 @@ require '../main.inc.php';
if ($user->rights->produit->lire) {
$page = 'productMargins';
} elseif ($user->rights->societe->lire) {
} elseif ($user->hasRight('societe', 'lire')) {
$page = 'customerMargins';
} else {
$page = 'agentMargins';

View File

@ -71,7 +71,7 @@ function marges_prepare_head()
$h++;
}
if ($user->rights->societe->lire) {
if ($user->hasRight('societe', 'lire')) {
$head[$h][0] = DOL_URL_ROOT."/margin/customerMargins.php";
$head[$h][1] = $langs->trans("CustomerMargins");
$head[$h][2] = 'customerMargins';