diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index b8b46a0c8d9..c05554d2242 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -112,17 +112,17 @@ if ($id > 0 || !empty($ref)) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('propalcard', 'globalcard')); -$usercanread = $user->rights->propal->lire; -$usercancreate = $user->rights->propal->creer; -$usercandelete = $user->rights->propal->supprimer; +$usercanread = $user->hasRight("propal", "lire"); +$usercancreate = $user->hasRight("propal", "creer"); +$usercandelete = $user->hasRight("propal", "supprimer"); $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->validate))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->propal->propal_advance->send))); -$usercancreateorder = $user->rights->commande->creer; -$usercancreateinvoice = $user->rights->facture->creer; -$usercancreatecontract = $user->rights->contrat->creer; +$usercancreateorder = $user->hasRight("commande", "creer"); +$usercancreateinvoice = $user->hasRight("facture", "creer"); +$usercancreatecontract = $user->hasRight("contrat", "creer"); $usercancreateintervention = $user->hasRight('ficheinter', 'creer'); $usercancreatepurchaseorder = ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 1e6a33e8ae8..bc4d085f8ce 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -108,16 +108,16 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once -$usercanread = $user->rights->commande->lire; -$usercancreate = $user->rights->commande->creer; -$usercandelete = $user->rights->commande->supprimer; +$usercanread = $user->hasRight("commande", "lire"); +$usercancreate = $user->hasRight("commande", "creer"); +$usercandelete = $user->hasRight("commande", "supprimer"); // Advanced permissions $usercanclose = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->close))); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate))); $usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send); -$usercancreatepurchaseorder = ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer); +$usercancreatepurchaseorder = ($user->hasRight("fournisseur", "commande", "creer") || $user->hasRight("supplier_order", "creer")); $permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php $permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d0b0ba331f3..ea2eb805ce5 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -128,11 +128,11 @@ if ($id > 0 || !empty($ref)) { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicecard', 'globalcard')); -$usercanread = $user->rights->facture->lire; -$usercancreate = $user->rights->facture->creer; -$usercanissuepayment = $user->rights->facture->paiement; -$usercandelete = $user->rights->facture->supprimer; -$usercancreatecontract = $user->rights->contrat->creer; +$usercanread = $user->hasRight("facture", "lire"); +$usercancreate = $user->hasRight("facture", "creer"); +$usercanissuepayment = $user->hasRight("facture", "paiement"); +$usercandelete = $user->hasRight("facture", "supprimer"); +$usercancreatecontract = $user->hasRight("contrat", "creer"); $usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->validate))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->send))); $usercanreopen = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->facture->invoice_advance->reopen)));