From eccd46c5c54602e4a48620a9b5cff9de5d613cb3 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:35:35 +0200 Subject: [PATCH 1/4] update code --- htdocs/accountancy/admin/accountmodel.php | 2 +- htdocs/accountancy/admin/categories_list.php | 2 +- htdocs/accountancy/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index c1bc435145f..7f90ae4594c 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -78,7 +78,7 @@ $search_country_id = GETPOST('search_country_id', 'int'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index ea613ea38cd..a32c7a28682 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -42,7 +42,7 @@ $rowid = GETPOST('rowid', 'alpha'); $code = GETPOST('code', 'alpha'); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 2745ab4784a..21c736900aa 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -44,7 +44,7 @@ if ($user->socid > 0) { if (!isModEnabled('accounting')) { accessforbidden(); } -if (empty($user->rights->accounting->mouvements->lire)) { +if (!$user->hasRight('accounting', 'mouvements', 'lire')) { accessforbidden(); } */ From e04b7333b1f68c3358beb233fdb78556d6fd892c Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:37:06 +0200 Subject: [PATCH 2/4] update code --- htdocs/accountancy/admin/account.php | 2 +- htdocs/accountancy/admin/card.php | 2 +- htdocs/accountancy/admin/categories.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 423a32cf9c1..2e0c4ad8930 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -59,7 +59,7 @@ $permissiontodelete = $user->hasRight('accounting', 'chartofaccount'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 7876712fe51..0764bcd78d1 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -48,7 +48,7 @@ $label = GETPOST('label', 'alpha'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index e65572eafd3..c2f4d604061 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -44,7 +44,7 @@ if ($cat_id == 0) { } // Security check -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } From 644a23a0acceb0d5562a0fdaf740ff9f7390dd61 Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:38:08 +0200 Subject: [PATCH 3/4] update code --- htdocs/accountancy/admin/closure.php | 2 +- htdocs/accountancy/admin/defaultaccounts.php | 2 +- htdocs/accountancy/admin/export.php | 2 +- htdocs/accountancy/admin/index.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/accountancy/admin/closure.php b/htdocs/accountancy/admin/closure.php index 437ff1b7116..be2699223fd 100644 --- a/htdocs/accountancy/admin/closure.php +++ b/htdocs/accountancy/admin/closure.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $langs->loadLangs(array("compta", "admin", "accountancy")); // Security check -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index bfc1fd29316..9a3b63adcc3 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "salaries", "loan")); // Security check -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index d0a0ab671d4..23a16340c0b 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -36,7 +36,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy")); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index af569e08ae3..605b5d2d396 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->loadLangs(array("compta", "bills", "admin", "accountancy", "other")); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } From 3a5abf12bc2d88c00e74888c90d47c4feba888fc Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Tue, 6 Sep 2022 16:40:07 +0200 Subject: [PATCH 4/4] update code --- htdocs/accountancy/admin/journals_list.php | 2 +- htdocs/accountancy/admin/subaccount.php | 2 +- htdocs/admin/dict.php | 6 +++--- htdocs/compta/bank/list.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 3ea90e283ce..e9a6e222686 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -45,7 +45,7 @@ $rowid = GETPOST('rowid', 'alpha'); $code = GETPOST('code', 'alpha'); // Security access -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/accountancy/admin/subaccount.php b/htdocs/accountancy/admin/subaccount.php index cc0d4de9f31..d42de7990f7 100644 --- a/htdocs/accountancy/admin/subaccount.php +++ b/htdocs/accountancy/admin/subaccount.php @@ -47,7 +47,7 @@ $search_type = GETPOST('search_type', 'int'); if ($user->socid > 0) { accessforbidden(); } -if (empty($user->rights->accounting->chartofaccount)) { +if (!$user->hasRight('accounting', 'chartofaccount')) { accessforbidden(); } diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index ff74273d744..5363bbf3062 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -54,13 +54,13 @@ $entity = GETPOST('entity', 'int'); $code = GETPOST('code', 'alpha'); $allowed = $user->admin; -if ($id == 7 && !empty($user->rights->accounting->chartofaccount)) { +if ($id == 7 && $user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Tax page allowed to manager of chart account } -if ($id == 10 && !empty($user->rights->accounting->chartofaccount)) { +if ($id == 10 && $user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Vat page allowed to manager of chart account } -if ($id == 17 && !empty($user->rights->accounting->chartofaccount)) { +if ($id == 17 && $user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Dictionary with type of expense report and accounting account allowed to manager of chart account } if (!$allowed) { diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 362ca3d488f..065786d7402 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -69,7 +69,7 @@ if ($user->socid) { } $allowed = 0; -if (!empty($user->rights->accounting->chartofaccount)) { +if ($user->hasRight('accounting', 'chartofaccount')) { $allowed = 1; // Dictionary with list of banks accounting account allowed to manager of chart account } if (!$allowed) {