Fix php8.2 warnings

This commit is contained in:
Laurent Destailleur 2023-10-15 18:46:18 +02:00
parent c2bdb3be90
commit 7a3e6606b7
14 changed files with 33 additions and 33 deletions

View File

@ -1082,7 +1082,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
<a class="hideonsmartphone" onclick="FullScreen();" title="<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave")); ?>"><span class="fa fa-expand-arrows-alt"></span></a>
<?php }?>
</div>
<?php
<?php
}?>
<div class="login_block_user">
<?php

View File

@ -71,7 +71,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
?>
</td>
</tr>
<?php
<?php
}
if (count($linkedObjectBlock) > 1) {
?>

View File

@ -295,7 +295,7 @@ function getActionComm($authentication, $id)
if (!$error) {
$fuser->getrights();
if ($fuser->rights->agenda->allactions->read) {
if ($fuser->hasRight('agenda', 'allactions', 'read')) {
$actioncomm = new ActionComm($db);
$result = $actioncomm->fetch($id);
if ($result > 0) {
@ -388,7 +388,7 @@ function getListActionCommType($authentication)
if (!$error) {
$fuser->getrights();
if ($fuser->rights->agenda->myactions->read) {
if ($fuser->hasRight('agenda', 'myactions', 'read')) {
$cactioncomm = new CActionComm($db);
$result = $cactioncomm->liste_array('', 'code');
if ($result > 0) {

View File

@ -231,7 +231,7 @@ function getCategory($authentication, $id)
$fuser->getrights();
$nbmax = 10;
if ($fuser->rights->categorie->lire) {
if ($fuser->hasRight('categorie', 'lire')) {
$categorie = new Categorie($db);
$result = $categorie->fetch($id);
if ($result > 0) {

View File

@ -292,8 +292,8 @@ function getContact($authentication, $id, $ref_ext)
if ($result > 0) {
// Only internal user who have contact read permission
// Or for external user who have contact read permission, with restrict on socid
if ($fuser->rights->societe->contact->lire && !$fuser->socid
|| ($fuser->rights->societe->contact->lire && ($fuser->socid == $contact->socid))
if ($fuser->hasRight('societe', 'contact', 'lire') && !$fuser->socid
|| ($fuser->hasRight('societe', 'contact', 'lire') && ($fuser->socid == $contact->socid))
) {
$contact_result_fields = array(
'id' => $contact->id,

View File

@ -329,7 +329,7 @@ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
if (!$error) {
$fuser->getrights();
if ($fuser->rights->facture->lire) {
if ($fuser->hasRight('facture', 'lire')) {
$invoice = new Facture($db);
$result = $invoice->fetch($id, $ref, $ref_ext);
if ($result > 0) {
@ -685,7 +685,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
if (!$error) {
$fuser->getrights();
if ($fuser->rights->commande->lire) {
if ($fuser->hasRight('commande', 'lire')) {
$order = new Commande($db);
$result = $order->fetch($id_order, $ref_order, $ref_ext_order);
if ($result > 0) {

View File

@ -408,7 +408,7 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '')
if (!$error) {
$fuser->getrights();
if ($fuser->rights->commande->lire) {
if ($fuser->hasRight('commande', 'lire')) {
$order = new Commande($db);
$result = $order->fetch($id, $ref, $ref_ext);
if ($result > 0) {
@ -836,7 +836,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0)
if (!$error) {
$fuser->getrights();
if ($fuser->rights->commande->lire) {
if ($fuser->hasRight('commande', 'lire')) {
$order = new Commande($db);
$result = $order->fetch($id);

View File

@ -394,7 +394,7 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = ''
$fuser->getrights();
$nbmax = 10;
if ($fuser->rights->produit->lire || $fuser->rights->service->lire) {
if ($fuser->hasRight('produit', 'lire') || $fuser->hasRight('service', 'lire')) {
$product = new Product($db);
$result = $product->fetch($id, $ref, $ref_ext);
@ -1017,7 +1017,7 @@ function getProductsForCategory($authentication, $id, $lang = '')
$fuser->getrights();
$nbmax = 10;
if ($fuser->rights->produit->lire) {
if ($fuser->hasRight('produit', 'lire')) {
$categorie = new Categorie($db);
$result = $categorie->fetch($id);
if ($result > 0) {

View File

@ -279,7 +279,7 @@ function createProject($authentication, $project)
if (!$error) {
$fuser->getrights();
if ($fuser->rights->projet->creer) {
if ($fuser->hasRight('projet', 'creer')) {
$newobject = new Project($db);
$newobject->ref = $project['ref'];
$newobject->title = $project['label'];
@ -371,7 +371,7 @@ function getProject($authentication, $id = '', $ref = '')
if (!$error) {
$fuser->getrights();
if ($fuser->rights->projet->lire) {
if ($fuser->hasRight('projet', 'lire')) {
$project = new Project($db);
$result = $project->fetch($id, $ref);
if ($result > 0) {

View File

@ -266,7 +266,7 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
if (!$error) {
$fuser->getrights();
if ($fuser->rights->fournisseur->facture->lire) {
if ($fuser->hasRight('fournisseur', 'facture', 'lire')) {
$invoice = new FactureFournisseur($db);
$result = $invoice->fetch($id, $ref, $ref_ext);
if ($result > 0) {

View File

@ -339,7 +339,7 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '', $bar
if (!$error) {
$fuser->getrights();
if ($fuser->rights->societe->lire) {
if ($fuser->hasRight('societe', 'lire')) {
$thirdparty = new Societe($db);
$result = $thirdparty->fetch($id, $ref, $ref_ext, $barcode, $profid1, $profid2);
if ($result > 0) {
@ -831,7 +831,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '')
if (!$error) {
$fuser->getrights();
if ($fuser->rights->societe->lire && $fuser->rights->societe->supprimer) {
if ($fuser->hasRight('societe', 'lire') && $fuser->hasRight('societe', 'supprimer')) {
$thirdparty = new Societe($db);
$result = $thirdparty->fetch($id, $ref, $ref_ext);

View File

@ -352,10 +352,10 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '')
if (!$error) {
$fuser->getrights();
if ($fuser->rights->user->user->lire
|| ($fuser->rights->user->self->creer && $id && $id == $fuser->id)
|| ($fuser->rights->user->self->creer && $ref && $ref == $fuser->login)
|| ($fuser->rights->user->self->creer && $ref_ext && $ref_ext == $fuser->ref_ext)) {
if ($fuser->hasRight('user', 'user', 'lire')
|| ($fuser->hasRight('user', 'self', 'creer') && $id && $id == $fuser->id)
|| ($fuser->hasRight('user', 'self', 'creer') && $ref && $ref == $fuser->login)
|| ($fuser->hasRight('user', 'self', 'creer') && $ref_ext && $ref_ext == $fuser->ref_ext)) {
$user = new User($db);
$result = $user->fetch($id, $ref, $ref_ext);
if ($result > 0) {
@ -510,7 +510,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser)
if (!$error) {
$fuser->getrights();
if ($fuser->rights->societe->creer) {
if ($fuser->hasRight('societe', 'creer')) {
$thirdparty = new Societe($db);
// If a contact / company already exists with the email, return the corresponding socid
@ -704,7 +704,7 @@ function setUserPassword($authentication, $shortuser)
if (!$error) {
$fuser->getrights();
if ($fuser->rights->user->user->password || $fuser->rights->user->self->password) {
if ($fuser->hasRight('user', 'user', 'password') || $fuser->hasRight('user', 'self', 'password')) {
$userstat = new User($db);
$res = $userstat->fetch('', $shortuser['login']);
if ($res) {

View File

@ -50,7 +50,7 @@ require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$langs->loadLangs(array("admin", "other", "website", "errors"));
// Security check
if (!$user->rights->website->read) {
if (!$user->hasRight('website', 'read')) {
accessforbidden();
}
@ -588,7 +588,7 @@ if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && $userca
$message = $langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock');
}
setEventMessages($message, null, 'errors');
} elseif (empty($user->rights->website->writephp)) {
} elseif (!$user->hasRight('website', 'writephp')) {
setEventMessages("NotAllowedToAddDynamicContent", null, 'errors');
} elseif (!$replacestring) {
setEventMessages("ErrorReplaceStringEmpty", null, 'errors');
@ -2357,7 +2357,7 @@ if ($usercanedit && (($action == 'updatesource' || $action == 'updatecontent' ||
}
// Export site
if ($action == 'exportsite' && !empty($user->rights->website->export)) {
if ($action == 'exportsite' && $user->hasRight('website', 'export')) {
$fileofzip = $object->exportWebSite();
if ($fileofzip) {
@ -2817,11 +2817,11 @@ if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource'
if (!GETPOST('hide_websitemenu')) {
$disabled = '';
if (empty($user->rights->website->write)) {
if (!$user->hasRight('website', 'write')) {
$disabled = ' disabled="disabled"';
}
$disabledexport = '';
if (empty($user->rights->website->export)) {
if (!$user->hasRight('website', 'export')) {
$disabledexport = ' disabled="disabled"';
}
@ -3201,7 +3201,7 @@ if (!GETPOST('hide_websitemenu')) {
if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone' || $action == 'deletesite') {
$disabled = '';
if (empty($user->rights->website->write)) {
if (!$user->hasRight('website', 'write')) {
$disabled = ' disabled="disabled"';
}
@ -4814,7 +4814,7 @@ if ($mode == 'replacesite' || $massaction == 'replace') {
print '<td class="tdwebsitesearchresult right nowraponall">';
$disabled = '';
$urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editmeta&token='.newToken().'&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param);
if (empty($user->rights->website->write)) {
if (!$user->hasRight('website', 'write')) {
$disabled = ' disabled';
$urltoedithtmlsource = '';
}
@ -4822,7 +4822,7 @@ if ($mode == 'replacesite' || $massaction == 'replace') {
$disabled = '';
$urltoedithtmlsource = $_SERVER["PHP_SELF"].'?action=editsource&token='.newToken().'&websiteid='.$website->id.'&pageid='.$answerrecord->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].$param);
if (empty($user->rights->website->write)) {
if (!$user->hasRight('website', 'write')) {
$disabled = ' disabled';
$urltoedithtmlsource = '';
}

View File

@ -793,7 +793,7 @@ class Workstation extends CommonObject
if (!empty($conf->global->WORKSTATION_WORKSTATION_ADDON)) {
$mybool = false;
$file = $conf->global->WORKSTATION_WORKSTATION_ADDON.".php";
$file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON') . ".php";
$classname = $conf->global->WORKSTATION_WORKSTATION_ADDON;
// Include file with class