diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php
index d5345106093..76381c0d53d 100644
--- a/htdocs/categories/class/api_categories.class.php
+++ b/htdocs/categories/class/api_categories.class.php
@@ -386,7 +386,7 @@ class Categories extends DolibarrApi
}
$object = new Contact($this->db);
} elseif ($type === Categorie::TYPE_MEMBER) {
- if (!DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
throw new RestException(401);
}
$object = new Adherent($this->db);
@@ -466,7 +466,7 @@ class Categories extends DolibarrApi
}
$object = new Contact($this->db);
} elseif ($type === Categorie::TYPE_MEMBER) {
- if (!DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
throw new RestException(401);
}
$object = new Adherent($this->db);
@@ -546,7 +546,7 @@ class Categories extends DolibarrApi
}
$object = new Contact($this->db);
} elseif ($type === Categorie::TYPE_MEMBER) {
- if (!DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
throw new RestException(401);
}
$object = new Adherent($this->db);
@@ -624,7 +624,7 @@ class Categories extends DolibarrApi
}
$object = new Contact($this->db);
} elseif ($type === Categorie::TYPE_MEMBER) {
- if (!DolibarrApiAccess::$user->rights->adherent->creer) {
+ if (!DolibarrApiAccess::$user->hasRight('adherent', 'creer')) {
throw new RestException(401);
}
$object = new Adherent($this->db);
diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php
index 0e5da0735ce..6ed4622ac00 100644
--- a/htdocs/categories/viewcat.php
+++ b/htdocs/categories/viewcat.php
@@ -117,7 +117,7 @@ if ($id > 0 && $removeelem > 0 && $action == 'unlink') {
$tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem);
$elementtype = 'customer';
- } elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) {
+ } elseif ($type == Categorie::TYPE_MEMBER && $user->hasRight('adherent', 'creer')) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$tmpobject = new Adherent($db);
$result = $tmpobject->fetch($removeelem);
@@ -733,7 +733,7 @@ if ($type == Categorie::TYPE_MEMBER) {
if ($user->hasRight("adherent", "read")) {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
- $permission = $user->rights->adherent->creer;
+ $permission = $user->hasRight('adherent', 'creer');
$prods = $object->getObjectsInCateg($type, 0, $limit, $offset);
if ($prods < 0) {
@@ -768,7 +768,7 @@ if ($type == Categorie::TYPE_MEMBER) {
print '
';
$param = '&limit='.$limit.'&id='.$id.'&type='.$type; $num = count($prods); $nbtotalofrecords = '';
- $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->rights->adherent->creer);
+ $newcardbutton = dolGetButtonTitle($langs->trans("AddMember"), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/card.php?action=create&memcats[]='.$object->id.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?id='.$object->id), '', $user->hasRight('adherent', 'creer'));
print_barre_liste($langs->trans("Member"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit);
print "