use user hasRight

This commit is contained in:
Frédéric France 2023-06-12 20:31:34 +02:00
parent f9a1fbf410
commit eaad829b6f
21 changed files with 28 additions and 28 deletions

View file

@ -580,7 +580,7 @@ print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Tags / Categories
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
print '<tr><td>'.$langs->trans("Categories").'</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, Categorie::TYPE_MEMBER, 1);

View file

@ -162,7 +162,7 @@ if ($object->id > 0) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {

View file

@ -346,7 +346,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {

View file

@ -144,7 +144,7 @@ if ($object->id) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -140,7 +140,7 @@ if ($object->id) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -162,7 +162,7 @@ if ($object->id > 0) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {

View file

@ -342,7 +342,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {

View file

@ -144,7 +144,7 @@ if ($object->id) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -140,7 +140,7 @@ if ($object->id) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -118,7 +118,7 @@ if ($id > 0 || !empty($ref)) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -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 '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';
print '<td>';

View file

@ -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

View file

@ -588,7 +588,7 @@ if ($result) {
print "</tr>";
// Categories
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
$langs->load('categories');
// Bank line

View file

@ -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 '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td><td colspan="3">';
$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 '</td></tr>';
// Categories
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
$arrayselected = array();
print '<tr><td>'.$form->editfieldkey('Categories', 'contcats', '', $object, 0).'</td>';
print '<td colspan="3">';
@ -1430,7 +1430,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border tableforfield centpercent">';
// Categories
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td>';
print '<td>';
print $form->showCategories($object->id, Categorie::TYPE_CONTACT, 1);

View file

@ -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 '<tr class="visibleifcustomer"><td>'.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).'</td>';
print '<td colspan="3">';
@ -3002,7 +3002,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print '<table class="border tableforfield centpercent">';
// 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 '<tr><td>'.$langs->trans("CustomersCategoriesShort").'</td>';

View file

@ -4260,7 +4260,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties
print '</td></tr>';
// 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 '</div>';
// Categories
if (isModEnabled('categorie') && !empty($user->rights->categorie->lire)) {
if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
print '<div class="tagtr">';
print '<div class="tagtd paddingrightonly marginrightonly opacitymedium tdoverflowmax100onsmartphone" style="padding-right: 10px !important">';
print $langs->trans("Category");
@ -4725,7 +4725,7 @@ if ($mode == 'replacesite' || $massaction == 'replace') {
// Categories - Tags
print '<td>';
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)) {

View file

@ -152,7 +152,7 @@ if ($object->id > 0) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -344,7 +344,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
if ($permissiontoadd) {

View file

@ -130,7 +130,7 @@ if ($object->id) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';

View file

@ -104,7 +104,7 @@ if ($id > 0 || !empty($ref)) {
// Thirdparty
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
// Project
if (! empty($conf->project->enabled))
if (isModEnabled('project'))
{
$langs->load("projects");
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';