From a698c60a7d063ea4d8a92182d502b3f51d0b10aa Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:12:09 +0200 Subject: [PATCH 1/7] update code for PHP8 compliance --- htdocs/accountancy/closure/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index a1d75440b56..999e2ce5bd1 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -75,7 +75,7 @@ if (empty($user->rights->accounting->fiscalyear->write)) { $now = dol_now(); -if ($action == 'validate_movements_confirm' && !empty($user->rights->accounting->fiscalyear->write)) { +if ($action == 'validate_movements_confirm' && $user->hasRight('accounting', 'fiscalyear', 'write')) { $date_start = dol_mktime(0, 0, 0, GETPOST('date_startmonth', 'int'), GETPOST('date_startday', 'int'), GETPOST('date_startyear', 'int')); $date_end = dol_mktime(23, 59, 59, GETPOST('date_endmonth', 'int'), GETPOST('date_endday', 'int'), GETPOST('date_endyear', 'int')); From 29cb0ce68719645f69c5e48d47c0ea6c992562b4 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:13:12 +0200 Subject: [PATCH 2/7] update code for PHP8 compliance --- htdocs/accountancy/admin/productaccount.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index c8cb62cd7e0..d520c82bf35 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -522,7 +522,7 @@ if ($resql) { // Filter on categories $moreforfilter = ''; - if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { + if (!empty($conf->categorie->enabled) && $user->hasRight('categorie', 'lire')) { $moreforfilter .= '
'; $moreforfilter .= img_picto($langs->trans('Categories'), 'category', 'class="pictofixedwidth"'); $categoriesProductArr = $form->select_all_categories(Categorie::TYPE_PRODUCT, '', '', 64, 0, 1); From 723d90f33f0732b851d141b4a5cb568ad9930d32 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:13:34 +0200 Subject: [PATCH 3/7] update code for PHP8 compliance --- htdocs/accountancy/admin/fiscalyear.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 2eb77815b60..6a6135dad40 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -121,7 +121,7 @@ if ($result) { $i = 0; - $addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write); + $addbutton .= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->hasRight('accounting', 'fiscalyear', 'write')); $title = $langs->trans('AccountingPeriods'); From 71f138caba8755b9c18ed3ac3407fc2d9cd3e717 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:13:52 +0200 Subject: [PATCH 4/7] update code for PHP8 compliance --- htdocs/accountancy/admin/fiscalyear_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 2aa33f21645..f6e765caf13 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -299,7 +299,7 @@ if ($action == 'create') { /* * Action bar */ - if (!empty($user->rights->accounting->fiscalyear->write)) { + if ($user->hasRight('accounting', 'fiscalyear', 'write')) { print '
'; print ''.$langs->trans('Modify').''; From d9dcecb6be15acc925faa3808b2ecfe50a81d795 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:14:41 +0200 Subject: [PATCH 5/7] update code for PHP8 compliance --- htdocs/accountancy/admin/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 02b95cfd043..5c1044380f9 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -66,7 +66,7 @@ if (GETPOST('cancel', 'alpha')) { exit; } -if ($action == 'add' && $user->rights->accounting->chartofaccount) { +if ($action == 'add' && $user->hasRight('accounting', 'chartofaccount')) { if (!$cancel) { if (!$account_number) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors'); @@ -127,7 +127,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { } } } -} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) { +} elseif ($action == 'edit' && $user->hasRight('accounting', 'chartofaccount')) { if (!$cancel) { if (!$account_number) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("AccountNumber")), null, 'errors'); @@ -184,7 +184,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { header("Location: ".$urltogo); exit(); } -} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) { +} elseif ($action == 'delete' && $user->hasRight('accounting', 'chartofaccount')) { $result = $object->fetch($id); if (!empty($object->id)) { @@ -419,13 +419,13 @@ if ($action == 'create') { */ print '
'; - if (!empty($user->rights->accounting->chartofaccount)) { + if ($user->hasRight('accounting', 'chartofaccount')) { print 'id.'">'.$langs->trans('Modify').''; } else { print ''.$langs->trans('Modify').''; } - if (!empty($user->rights->accounting->chartofaccount)) { + if ($user->hasRight('accounting', 'chartofaccount')) { print 'id.'">'.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; From 6298dc2f0d7f25b138272bc6131fa4ca7953ad84 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:14:58 +0200 Subject: [PATCH 6/7] update code for PHP8 compliance --- htdocs/accountancy/admin/account.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 4d74237e2e4..f818e9a0a1a 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -52,8 +52,8 @@ $confirm = GETPOST('confirm', 'alpha'); $chartofaccounts = GETPOST('chartofaccounts', 'int'); -$permissiontoadd = !empty($user->rights->accounting->chartofaccount); -$permissiontodelete = !empty($user->rights->accounting->chartofaccount); +$permissiontoadd = $user->hasRight('accounting', 'chartofaccount'); +$permissiontodelete = $user->hasRight('accounting', 'chartofaccount'); // Security check if ($user->socid > 0) { @@ -294,7 +294,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { } // List of mass actions available -if ($user->rights->accounting->chartofaccount) { +if ($user->hasRight('accounting', 'chartofaccount')) { $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); } if (in_array($massaction, array('presend', 'predelete', 'closed'))) { @@ -590,7 +590,7 @@ if ($resql) { // Action print ''; - if ($user->rights->accounting->chartofaccount) { + if ($user->hasRight('accounting', 'chartofaccount')) { print ''; print img_edit(); print ''; From a9b6d97217072ea9c1c04621c4079eb2c55ca584 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Fri, 12 Aug 2022 09:15:32 +0200 Subject: [PATCH 7/7] update code for PHP8 compliance --- htdocs/accountancy/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 926097c1509..cf0d94980fa 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -49,7 +49,7 @@ if (empty($user->rights->accounting->mouvements->lire)) { if (empty($conf->comptabilite->enabled) && empty($conf->accounting->enabled) && empty($conf->asset->enabled) && empty($conf->intracommreport->enabled)) { accessforbidden(); } -if (empty($user->hasRight('compta', 'resultat', 'lire')) && empty($user->hasRight('accounting', 'comptarapport', 'lire')) && empty($user->hasRight('accounting', 'mouvements', 'lire')) && empty($user->hasRight('asset', 'read')) && empty($user->hasRight('intracommreport', 'read'))) { +if ($user->hasRight('compta', 'resultat', 'lire') && $user->hasRight('accounting', 'comptarapport', 'lire') && $user->hasRight('accounting', 'mouvements', 'lire') && $user->hasRight('asset', 'read') && $user->hasRight('intracommreport', 'read')) { accessforbidden(); }