update code toward php8 compliance

This commit is contained in:
Philippe GRAND 2022-09-10 11:10:33 +02:00
parent b52bcf191f
commit 1485e3bd79
4 changed files with 11 additions and 11 deletions

View File

@ -283,7 +283,7 @@ for ($i = 1; $i <= 4; $i++) {
*/ */
$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; $filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid;
$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid; $urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid;
$genallowed = $user->rights->societe->lire; $genallowed = $user->hasRight('societe', 'lire');
$delallowed = $user->rights->societe->creer; $delallowed = $user->rights->societe->creer;
print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang); print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang);

View File

@ -209,7 +209,7 @@ if ($this->control->tpl['action_delete']) {
*/ */
$filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid; $filedir = $conf->societe->multidir_output[$this->control->tpl['entity']].'/'.$socid;
$urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid; $urlsource = $_SERVER["PHP_SELF"]."?socid=".$socid;
$genallowed = $user->rights->societe->lire; $genallowed = $user->hasRight('societe', 'lire');
$delallowed = $user->rights->societe->creer; $delallowed = $user->rights->societe->creer;
print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang); print $formfile->showdocuments('company', $socid, $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $objcanvas->control->object->default_lang);

View File

@ -132,7 +132,7 @@ class Thirdparties extends DolibarrApi
{ {
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -848,7 +848,7 @@ class Thirdparties extends DolibarrApi
*/ */
public function getOutStandingProposals($id, $mode = 'customer') public function getOutStandingProposals($id, $mode = 'customer')
{ {
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -890,7 +890,7 @@ class Thirdparties extends DolibarrApi
*/ */
public function getOutStandingOrder($id, $mode = 'customer') public function getOutStandingOrder($id, $mode = 'customer')
{ {
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -931,7 +931,7 @@ class Thirdparties extends DolibarrApi
*/ */
public function getOutStandingInvoices($id, $mode = 'customer') public function getOutStandingInvoices($id, $mode = 'customer')
{ {
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -972,7 +972,7 @@ class Thirdparties extends DolibarrApi
*/ */
public function getSalesRepresentatives($id, $mode = 0) public function getSalesRepresentatives($id, $mode = 0)
{ {
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -1015,7 +1015,7 @@ class Thirdparties extends DolibarrApi
{ {
$obj_ret = array(); $obj_ret = array();
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -1439,7 +1439,7 @@ class Thirdparties extends DolibarrApi
*/ */
public function getSocieteAccounts($id, $site = null) public function getSocieteAccounts($id, $site = null)
{ {
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401); throw new RestException(401);
} }
@ -1870,7 +1870,7 @@ class Thirdparties extends DolibarrApi
{ {
global $conf; global $conf;
if (!DolibarrApiAccess::$user->rights->societe->lire) { if (!DolibarrApiAccess::$user->hasRight('societe', 'lire')) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login.'. No read permission on thirdparties.'); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login.'. No read permission on thirdparties.');
} }

View File

@ -491,7 +491,7 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', ''); llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', '');
if ($socid && !$projectid && !$project_ref && $user->rights->societe->lire) { if ($socid && !$projectid && !$project_ref && $user->hasRight('societe', 'lire')) {
$socstat = new Societe($db); $socstat = new Societe($db);
$res = $socstat->fetch($socid); $res = $socstat->fetch($socid);
if ($res > 0) { if ($res > 0) {