瀏覽代碼

update code toward php8 compliance

Philippe GRAND 2 年之前
父節點
當前提交
e73b8983bf

+ 1 - 1
htdocs/core/boxes/box_contacts.php

@@ -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";

+ 1 - 1
htdocs/core/boxes/box_prospect.php

@@ -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";

+ 2 - 2
htdocs/core/lib/security.lib.php

@@ -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";

+ 1 - 1
htdocs/hrm/position_card.php

@@ -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);

+ 1 - 1
htdocs/margin/index.php

@@ -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';

+ 1 - 1
htdocs/margin/lib/margins.lib.php

@@ -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';