From 236b86bdd3f0a968e8f3d88560212576c7178b76 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Sat, 10 Sep 2022 11:18:31 +0200 Subject: [PATCH] update code toward php8 compliance --- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/contact/list.php | 4 ++-- htdocs/societe/card.php | 6 +++--- htdocs/societe/list.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 786c3914b92..e417f21832c 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -396,7 +396,7 @@ if (empty($reshook)) { $objectclass = 'Bookkeeping'; $objectlabel = 'Bookkeeping'; $permissiontoread = $user->hasRight('societe', 'lire'); - $permissiontodelete = $user->rights->societe->supprimer; + $permissiontodelete = $user->hasRight('societe', 'supprimer'); $permissiontoadd = $user->rights->societe->creer; $uploaddir = $conf->societe->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index c2b0120790b..387fc2c06e6 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -313,7 +313,7 @@ if (empty($reshook)) { $objectclass = 'Contact'; $objectlabel = 'Contact'; $permissiontoread = $user->hasRight('societe', 'lire'); - $permissiontodelete = $user->rights->societe->supprimer; + $permissiontodelete = $user->hasRight('societe', 'supprimer'); $permissiontoadd = $user->rights->societe->creer; $uploaddir = $conf->societe->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -690,7 +690,7 @@ $arrayofmassactions = array( // 'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), ); //if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); -if ($user->rights->societe->supprimer) { +if ($user->hasRight('societe', 'supprimer')) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } if ($user->rights->societe->creer) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index ab3ce495872..4b612df0c00 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -139,7 +139,7 @@ if (!empty($canvas)) { // Permissions $permissiontoread = $user->hasRight('societe', 'lire'); $permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$permissiontodelete = $user->rights->societe->supprimer || ($permissiontoadd && isset($object->status) && $object->status == 0); +$permissiontodelete = $user->hasRight('societe', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == 0); $permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php $upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1]; @@ -914,7 +914,7 @@ if (empty($reshook)) { } // Delete third party - if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { + if ($action == 'confirm_delete' && $confirm == 'yes' && $user->hasRight('societe', 'supprimer')) { $object->fetch($socid); $object->oldcopy = clone $object; $result = $object->delete($socid, $user); @@ -3247,7 +3247,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print dolGetButtonAction($langs->trans('MergeThirdparties'), $langs->trans('Merge'), 'danger', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=merge&token='.newToken(), '', $permissiontodelete); - if ($user->rights->societe->supprimer) { + if ($user->hasRight('societe', 'supprimer')) { $deleteUrl = $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=delete&token='.newToken(); $buttonId = 'action-delete-no-ajax'; if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) { // We can't use preloaded confirm form with jmobile diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 6ebd9e3336d..680ab8aff82 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -384,7 +384,7 @@ if (empty($reshook)) { $objectclass = 'Societe'; $objectlabel = 'ThirdParty'; $permissiontoread = $user->hasRight('societe', 'lire'); - $permissiontodelete = $user->rights->societe->supprimer; + $permissiontodelete = $user->hasRight('societe', 'supprimer'); $permissiontoadd = $user->rights->societe->creer; $uploaddir = $conf->societe->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; @@ -898,7 +898,7 @@ if ($user->rights->societe->creer) { if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) { $arrayofmassactions = array(); } -if ($user->rights->societe->supprimer) { +if ($user->hasRight('societe', 'supprimer')) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } $massactionbutton = $form->selectMassAction('', $arrayofmassactions);