update code toward php8 compliance

This commit is contained in:
Philippe GRAND 2022-09-09 10:29:27 +02:00
parent 9027e2b96b
commit b3d0be6b6b
2 changed files with 7 additions and 7 deletions

View File

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

View File

@ -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 '<br>';
$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 "<table class='noborder' width='100%'>\n";