From eaad829b6fccd18d88499dd64d87fd0fc00995c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 12 Jun 2023 20:31:34 +0200 Subject: [PATCH] use user hasRight --- htdocs/adherents/subscription.php | 2 +- htdocs/bookcal/availabilities_agenda.php | 2 +- htdocs/bookcal/availabilities_card.php | 2 +- htdocs/bookcal/availabilities_contact.php | 2 +- htdocs/bookcal/availabilities_document.php | 2 +- htdocs/bookcal/availabilities_note.php | 2 +- htdocs/bookcal/booking_agenda.php | 2 +- htdocs/bookcal/booking_card.php | 2 +- htdocs/bookcal/booking_contact.php | 2 +- htdocs/bookcal/booking_document.php | 2 +- htdocs/bookcal/booking_note.php | 2 +- htdocs/comm/card.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/line.php | 2 +- htdocs/contact/card.php | 6 +++--- htdocs/societe/card.php | 8 ++++---- htdocs/website/index.php | 6 +++--- htdocs/workstation/workstation_agenda.php | 2 +- htdocs/workstation/workstation_card.php | 2 +- htdocs/workstation/workstation_document.php | 2 +- htdocs/workstation/workstation_note.php | 2 +- 21 files changed, 28 insertions(+), 28 deletions(-) diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 9f6ea1c74c9..03923f903a7 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -580,7 +580,7 @@ print '
'; print ''; // Tags / Categories -if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { +if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print ''; print ''; print '"; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $langs->load('categories'); // Bank line diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 3603bf8d9fc..994a9bd9a63 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -867,7 +867,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print ''; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $arrayselected = array(); print ''; print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1); diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php index d3e7aa1a3a8..6054c5e4279 100644 --- a/htdocs/bookcal/availabilities_agenda.php +++ b/htdocs/bookcal/availabilities_agenda.php @@ -162,7 +162,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php index ca9fd3bf8db..6d21b777405 100644 --- a/htdocs/bookcal/availabilities_card.php +++ b/htdocs/bookcal/availabilities_card.php @@ -346,7 +346,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { diff --git a/htdocs/bookcal/availabilities_contact.php b/htdocs/bookcal/availabilities_contact.php index 8dfa04288f7..cef8bd0367c 100644 --- a/htdocs/bookcal/availabilities_contact.php +++ b/htdocs/bookcal/availabilities_contact.php @@ -144,7 +144,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/bookcal/availabilities_document.php b/htdocs/bookcal/availabilities_document.php index 96700096ee6..301ccdc2eae 100644 --- a/htdocs/bookcal/availabilities_document.php +++ b/htdocs/bookcal/availabilities_document.php @@ -140,7 +140,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/bookcal/availabilities_note.php b/htdocs/bookcal/availabilities_note.php index 27cdbbce880..dea5fee7625 100644 --- a/htdocs/bookcal/availabilities_note.php +++ b/htdocs/bookcal/availabilities_note.php @@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/bookcal/booking_agenda.php b/htdocs/bookcal/booking_agenda.php index 7fc3c68e105..87edd2113ac 100644 --- a/htdocs/bookcal/booking_agenda.php +++ b/htdocs/bookcal/booking_agenda.php @@ -162,7 +162,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { diff --git a/htdocs/bookcal/booking_card.php b/htdocs/bookcal/booking_card.php index 623bf142e60..fd8ddbc4614 100644 --- a/htdocs/bookcal/booking_card.php +++ b/htdocs/bookcal/booking_card.php @@ -342,7 +342,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { diff --git a/htdocs/bookcal/booking_contact.php b/htdocs/bookcal/booking_contact.php index ceec965f5b2..e1954ce07a3 100644 --- a/htdocs/bookcal/booking_contact.php +++ b/htdocs/bookcal/booking_contact.php @@ -144,7 +144,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/bookcal/booking_document.php b/htdocs/bookcal/booking_document.php index aadcb0f14c9..83031edec2b 100644 --- a/htdocs/bookcal/booking_document.php +++ b/htdocs/bookcal/booking_document.php @@ -140,7 +140,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/bookcal/booking_note.php b/htdocs/bookcal/booking_note.php index 5b00686fc27..a194d084fe1 100644 --- a/htdocs/bookcal/booking_note.php +++ b/htdocs/bookcal/booking_note.php @@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index b6713c5e257..2bab31751c3 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -606,7 +606,7 @@ if ($object->id > 0) { } // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $langs->load("categories"); print '
'.$langs->trans("CustomersCategoriesShort").''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index ac429de383f..95c7a630301 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1039,7 +1039,7 @@ if ($resql) { if (isModEnabled('categorie')) { // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $langs->load('categories'); // Bank line diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index fd75c9ceaee..d8517391e17 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -588,7 +588,7 @@ if ($result) { print "
'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1); print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, null, null, '90%'); @@ -1157,7 +1157,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print '
'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).''; @@ -1430,7 +1430,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print ''; print ''; print '
'.$langs->trans("Categories").''; print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index db9201852d5..1d1ba6308f9 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -811,7 +811,7 @@ if (empty($reshook)) { } // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) - if (!$error && !empty($user->rights->categorie->lire)) { + if (!$error && $user->hasRight('categorie', 'lire')) { // Customer categories association $categories = GETPOST('custcats', 'array'); $result = $object->setCategories($categories, 'customer'); @@ -1816,7 +1816,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $langs->load('categories'); // Customer @@ -2556,7 +2556,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { // Customer print '
'.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).''; @@ -3002,7 +3002,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Tags / categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { // Customer if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) { print ''; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 773cd83eea4..09073cc0c68 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -4260,7 +4260,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties print ''; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { $langs->load('categories'); if (!GETPOSTISSET('categories')) { @@ -4588,7 +4588,7 @@ if ($mode == 'replacesite' || $massaction == 'replace') { print ''; // Categories - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { print '
'; print '
'; print $langs->trans("Category"); @@ -4725,7 +4725,7 @@ if ($mode == 'replacesite' || $massaction == 'replace') { // Categories - Tags print '
'.$langs->trans("CustomersCategoriesShort").'
'; - if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) { + if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) { // Get current categories $existing = $c->containing($answerrecord->id, Categorie::TYPE_WEBSITE_PAGE, 'object'); if (is_array($existing)) { diff --git a/htdocs/workstation/workstation_agenda.php b/htdocs/workstation/workstation_agenda.php index 76bbec57bbe..0a6ace8f3d6 100644 --- a/htdocs/workstation/workstation_agenda.php +++ b/htdocs/workstation/workstation_agenda.php @@ -152,7 +152,7 @@ if ($object->id > 0) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/workstation/workstation_card.php b/htdocs/workstation/workstation_card.php index 37d7b079c8a..dfeccf54a87 100644 --- a/htdocs/workstation/workstation_card.php +++ b/htdocs/workstation/workstation_card.php @@ -344,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) { + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref .= '
'.$langs->trans('Project') . ' '; if ($permissiontoadd) { diff --git a/htdocs/workstation/workstation_document.php b/htdocs/workstation/workstation_document.php index 631783abd67..8f54ef50dde 100644 --- a/htdocs/workstation/workstation_document.php +++ b/htdocs/workstation/workstation_document.php @@ -130,7 +130,7 @@ if ($object->id) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' '; diff --git a/htdocs/workstation/workstation_note.php b/htdocs/workstation/workstation_note.php index 52bbd2498af..37e01cb7d10 100644 --- a/htdocs/workstation/workstation_note.php +++ b/htdocs/workstation/workstation_note.php @@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) { // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->project->enabled)) + if (isModEnabled('project')) { $langs->load("projects"); $morehtmlref.='
'.$langs->trans('Project') . ' ';