diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php
index 1765e9a84c1..d00340a1322 100644
--- a/htdocs/bom/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php
@@ -64,7 +64,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
print '';
echo '
'.dol_print_date($objectlink->date_creation, 'day').' | ';
echo '';
- if ($user->rights->commande->lire) {
+ if ($user->hasRight('commande', 'lire')) {
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
}
diff --git a/htdocs/bookcal/availabilities_agenda.php b/htdocs/bookcal/availabilities_agenda.php
index b4b848f17ed..16673d6b8a3 100644
--- a/htdocs/bookcal/availabilities_agenda.php
+++ b/htdocs/bookcal/availabilities_agenda.php
@@ -88,8 +88,8 @@ if ($id > 0 || !empty($ref)) {
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->bookcal->availabilities->read;
- $permissiontoadd = $user->rights->bookcal->availabilities->write;
+ $permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
+ $permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@@ -100,7 +100,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/availabilities_card.php b/htdocs/bookcal/availabilities_card.php
index 7736229319d..ca9fd3bf8db 100644
--- a/htdocs/bookcal/availabilities_card.php
+++ b/htdocs/bookcal/availabilities_card.php
@@ -77,11 +77,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->bookcal->availabilities->read;
- $permissiontoadd = $user->rights->bookcal->availabilities->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
- $permissiontodelete = $user->rights->bookcal->availabilities->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
- $permissionnote = $user->rights->bookcal->availabilities->write; // Used by the include of actions_setnotes.inc.php
- $permissiondellink = $user->rights->bookcal->availabilities->write; // Used by the include of actions_dellink.inc.php
+ $permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
+ $permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+ $permissiontodelete = $user->hasRight('bookcal', 'availabilities', 'delete') || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
+ $permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
+ $permissiondellink = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_dellink.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@@ -97,7 +97,7 @@ $upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/availabilities_contact.php b/htdocs/bookcal/availabilities_contact.php
index 58bbc4826a4..8dfa04288f7 100644
--- a/htdocs/bookcal/availabilities_contact.php
+++ b/htdocs/bookcal/availabilities_contact.php
@@ -53,8 +53,8 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be includ
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->bookcal->availabilities->read;
- $permission = $user->rights->bookcal->availabilities->write;
+ $permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
+ $permission = $user->hasRight('bookcal', 'availabilities', 'write');
} else {
$permissiontoread = 1;
$permission = 1;
@@ -65,7 +65,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/availabilities_document.php b/htdocs/bookcal/availabilities_document.php
index 721f304d9d8..96700096ee6 100644
--- a/htdocs/bookcal/availabilities_document.php
+++ b/htdocs/bookcal/availabilities_document.php
@@ -78,8 +78,8 @@ if ($id > 0 || !empty($ref)) {
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->bookcal->availabilities->read;
- $permissiontoadd = $user->rights->bookcal->availabilities->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
+ $permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
+ $permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@@ -90,7 +90,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
@@ -192,9 +192,9 @@ if ($object->id) {
print dol_get_fiche_end();
$modulepart = 'bookcal';
- //$permissiontoadd = $user->rights->bookcal->availabilities->write;
+ //$permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
$permissiontoadd = 1;
- //$permtoedit = $user->rights->bookcal->availabilities->write;
+ //$permtoedit = $user->hasRight('bookcal', 'availabilities', 'write');
$permtoedit = 1;
$param = '&id='.$object->id;
diff --git a/htdocs/bookcal/availabilities_list.php b/htdocs/bookcal/availabilities_list.php
index 69594d45133..7c0ef05a02d 100644
--- a/htdocs/bookcal/availabilities_list.php
+++ b/htdocs/bookcal/availabilities_list.php
@@ -132,9 +132,9 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->bookcal->availabilities->read;
- $permissiontoadd = $user->rights->bookcal->availabilities->write;
- $permissiontodelete = $user->rights->bookcal->availabilities->delete;
+ $permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
+ $permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
+ $permissiontodelete = $user->hasRight('bookcal', 'availabilities', 'delete');
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@@ -147,7 +147,7 @@ if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled');
+if (!isModEnabled('bookcal')) accessforbidden('Module not enabled');
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/availabilities_note.php b/htdocs/bookcal/availabilities_note.php
index 0717e618864..27cdbbce880 100644
--- a/htdocs/bookcal/availabilities_note.php
+++ b/htdocs/bookcal/availabilities_note.php
@@ -56,9 +56,9 @@ if ($id > 0 || !empty($ref)) {
// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
$enablepermissioncheck = 0;
if ($enablepermissioncheck) {
- $permissiontoread = $user->rights->bookcal->availabilities->read;
- $permissiontoadd = $user->rights->bookcal->availabilities->write;
- $permissionnote = $user->rights->bookcal->availabilities->write; // Used by the include of actions_setnotes.inc.php
+ $permissiontoread = $user->hasRight('bookcal', 'availabilities', 'read');
+ $permissiontoadd = $user->hasRight('bookcal', 'availabilities', 'write');
+ $permissionnote = $user->hasRight('bookcal', 'availabilities', 'write'); // Used by the include of actions_setnotes.inc.php
} else {
$permissiontoread = 1;
$permissiontoadd = 1;
@@ -70,7 +70,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/bookcalindex.php b/htdocs/bookcal/bookcalindex.php
index b268c3b811e..b76c8e9972d 100644
--- a/htdocs/bookcal/bookcalindex.php
+++ b/htdocs/bookcal/bookcalindex.php
@@ -71,7 +71,7 @@ print '';
// BEGIN MODULEBUILDER DRAFT MYOBJECT
// Draft MyObject
-if ($user->rights->bookcal->availabilities->read && !empty($conf->bookcal->enabled)) {
+if ($user->hasRight('bookcal', 'availabilities', 'read') && isModEnabled('bookcal')) {
$langs->load("orders");
$sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
@@ -143,8 +143,7 @@ $max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
// Last modified myobject
-if (! empty($conf->bookcal->enabled))
-{
+if (isModEnabled('bookcal')) {
$sql = "SELECT rowid, `ref`, fk_soc, fk_project, description, note_public, note_private, date_creation, tms, fk_user_creat, fk_user_modif, last_main_doc, import_key, model_pdf, status, firstname, lastname, email, `start`, duration";
$sql .= " FROM ". MAIN_DB_PREFIX . 'bookcal_booking';
print "here2";
diff --git a/htdocs/bookcal/booking_agenda.php b/htdocs/bookcal/booking_agenda.php
index 10452e6640f..b171b953b42 100644
--- a/htdocs/bookcal/booking_agenda.php
+++ b/htdocs/bookcal/booking_agenda.php
@@ -100,7 +100,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/booking_card.php b/htdocs/bookcal/booking_card.php
index 8ce99806e2a..623bf142e60 100644
--- a/htdocs/bookcal/booking_card.php
+++ b/htdocs/bookcal/booking_card.php
@@ -97,7 +97,7 @@ $upload_dir = $conf->bookcal->multidir_output[isset($object->entity) ? $object->
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/booking_contact.php b/htdocs/bookcal/booking_contact.php
index e315b320cad..ceec965f5b2 100644
--- a/htdocs/bookcal/booking_contact.php
+++ b/htdocs/bookcal/booking_contact.php
@@ -65,7 +65,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/booking_document.php b/htdocs/bookcal/booking_document.php
index d4147051716..aadcb0f14c9 100644
--- a/htdocs/bookcal/booking_document.php
+++ b/htdocs/bookcal/booking_document.php
@@ -90,7 +90,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/booking_list.php b/htdocs/bookcal/booking_list.php
index ad72f61de65..618e8e9bb0e 100644
--- a/htdocs/bookcal/booking_list.php
+++ b/htdocs/bookcal/booking_list.php
@@ -147,7 +147,7 @@ if ($user->socid > 0) accessforbidden();
//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden('Module not enabled');
+if (!isModEnabled('bookcal')) accessforbidden('Module not enabled');
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/booking_note.php b/htdocs/bookcal/booking_note.php
index c1f2146ec57..5b00686fc27 100644
--- a/htdocs/bookcal/booking_note.php
+++ b/htdocs/bookcal/booking_note.php
@@ -70,7 +70,7 @@ if ($enablepermissioncheck) {
//if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
-if (empty($conf->bookcal->enabled)) accessforbidden();
+if (!isModEnabled('bookcal')) accessforbidden();
if (!$permissiontoread) accessforbidden();
diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php
index 6b4502e3364..c7e86a9f589 100644
--- a/htdocs/bookcal/class/availabilities.class.php
+++ b/htdocs/bookcal/class/availabilities.class.php
@@ -201,7 +201,7 @@ class Availabilities extends CommonObject
}
// Example to show how to set values of fields definition dynamically
- /*if ($user->rights->bookcal->availabilities->read) {
+ /*if ($user->hasRight('bookcal', 'availabilities', 'read')) {
$this->fields['myfield']['visible'] = 1;
$this->fields['myfield']['noteditable'] = 0;
}*/
@@ -516,7 +516,7 @@ class Availabilities extends CommonObject
return 0;
}
- /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->write))
+ /*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->hasRight('bookcal', 'availabilities', 'write'))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bookcal->availabilities->availabilities_advance->validate))))
{
$this->error='NotEnoughPermissions';
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 86325cf8e37..1c72f0ef4ff 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -332,14 +332,14 @@ class Commande extends CommonOrder
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>155),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'PDFTemplate', 'enabled'=>1, 'visible'=>0, 'position'=>160),
//'facture' =>array('type'=>'tinyint(4)', 'label'=>'ParentInvoice', 'enabled'=>1, 'visible'=>-1, 'position'=>165),
- 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'$conf->banque->enabled', 'visible'=>-1, 'position'=>170),
+ 'fk_account' =>array('type'=>'integer', 'label'=>'BankAccount', 'enabled'=>'isModEnabled("banque")', 'visible'=>-1, 'position'=>170),
'fk_currency' =>array('type'=>'varchar(3)', 'label'=>'MulticurrencyID', 'enabled'=>1, 'visible'=>-1, 'position'=>175),
'fk_cond_reglement' =>array('type'=>'integer', 'label'=>'PaymentTerm', 'enabled'=>1, 'visible'=>-1, 'position'=>180),
'deposit_percent' =>array('type'=>'varchar(63)', 'label'=>'DepositPercent', 'enabled'=>1, 'visible'=>-1, 'position'=>181),
'fk_mode_reglement' =>array('type'=>'integer', 'label'=>'PaymentMode', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
'date_livraison' =>array('type'=>'date', 'label'=>'DateDeliveryPlanned', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
'fk_shipping_method' =>array('type'=>'integer', 'label'=>'ShippingMethod', 'enabled'=>1, 'visible'=>-1, 'position'=>195),
- 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'$conf->stock->enabled', 'visible'=>-1, 'position'=>200),
+ 'fk_warehouse' =>array('type'=>'integer:Entrepot:product/stock/class/entrepot.class.php', 'label'=>'Fk warehouse', 'enabled'=>'isModEnabled("stock")', 'visible'=>-1, 'position'=>200),
'fk_availability' =>array('type'=>'integer', 'label'=>'Availability', 'enabled'=>1, 'visible'=>-1, 'position'=>205),
'fk_input_reason' =>array('type'=>'integer', 'label'=>'InputReason', 'enabled'=>1, 'visible'=>-1, 'position'=>210),
//'fk_delivery_address' =>array('type'=>'integer', 'label'=>'DeliveryAddress', 'enabled'=>1, 'visible'=>-1, 'position'=>215),
@@ -2463,7 +2463,7 @@ class Commande extends CommonOrder
{
$remise = trim($remise) ?trim($remise) : 0;
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@@ -2531,7 +2531,7 @@ class Commande extends CommonOrder
$remise = price2num($remise);
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@@ -2591,7 +2591,7 @@ class Commande extends CommonOrder
public function set_date($user, $date, $notrigger = 0)
{
// phpcs:enable
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@@ -2663,7 +2663,7 @@ class Commande extends CommonOrder
*/
public function setDeliveryDate($user, $delivery_date, $notrigger = 0)
{
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@@ -2922,7 +2922,7 @@ class Commande extends CommonOrder
public function set_ref_client($user, $ref_client, $notrigger = 0)
{
// phpcs:enable
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
$error = 0;
$this->db->begin();
@@ -3174,17 +3174,17 @@ class Commande extends CommonOrder
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
- $total_ht = $tabprice[0];
+ $total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
$total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10];
- $pu_ht = $tabprice[3];
+ $pu_ht = $tabprice[3];
$pu_tva = $tabprice[4];
$pu_ttc = $tabprice[5];
// MultiCurrency
- $multicurrency_total_ht = $tabprice[16];
+ $multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php
index a6a1fde3851..323ef0aefa6 100644
--- a/htdocs/commande/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php
@@ -55,7 +55,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo ' '.$objectlink->ref_client.' | ';
echo ' '.dol_print_date($objectlink->date, 'day').' | ';
echo ' ';
- if ($user->rights->commande->lire) {
+ if ($user->hasRight('commande', 'lire')) {
$total = $total + $objectlink->total_ht;
echo price($objectlink->total_ht);
}
diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php
index 294c55da4c0..e2765f37adc 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -2116,7 +2116,7 @@ if ($action == 'create') {
if (isModEnabled('commande') && $object->statut > 0 && $object->nbofservicesclosed < $nbofservices) {
$langs->load("orders");
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
print dolGetButtonAction($langs->trans('CreateOrder'), '', 'default', DOL_URL_ROOT.'/commande/card.php?action=create&token='.newToken().'&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->thirdparty->id, '', true, $params);
} else {
$params['attr']['title'] = $langs->trans("NotEnoughPermissions");
diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php
index f5764c8a575..f0534728aad 100644
--- a/htdocs/core/boxes/box_commandes.php
+++ b/htdocs/core/boxes/box_commandes.php
@@ -85,7 +85,7 @@ class box_commandes extends ModeleBoxes
$this->info_box_head = array('text' => $langs->trans("BoxTitleLast".(!empty($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) ? "" : "Modified")."CustomerOrders", $max));
- if ($user->rights->commande->lire) {
+ if ($user->hasRight('commande', 'lire')) {
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php
index 0d8f41bc6ea..47b10fa5749 100644
--- a/htdocs/core/boxes/box_graph_orders_permonth.php
+++ b/htdocs/core/boxes/box_graph_orders_permonth.php
@@ -103,7 +103,7 @@ class box_graph_orders_permonth extends ModeleBoxes
$prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user
}
- if ($user->rights->commande->lire) {
+ if ($user->hasRight('commande', 'lire')) {
$langs->load("orders");
$param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year';
diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php
index c61249877a3..325559882d8 100644
--- a/htdocs/expedition/shipment.php
+++ b/htdocs/expedition/shipment.php
@@ -517,7 +517,7 @@ if ($id > 0 || !empty($ref)) {
print '| ';
print $langs->trans('IncotermLabel');
print ' | | ';
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
print ''.img_edit().'';
} else {
print ' ';
diff --git a/htdocs/fichinter/document.php b/htdocs/fichinter/document.php
index 3b4721d63a0..52d1019d755 100644
--- a/htdocs/fichinter/document.php
+++ b/htdocs/fichinter/document.php
@@ -127,7 +127,7 @@ if ($object->id) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
$morehtmlref .= ' : ';
diff --git a/htdocs/fichinter/info.php b/htdocs/fichinter/info.php
index da1af1d613b..77e31705790 100644
--- a/htdocs/fichinter/info.php
+++ b/htdocs/fichinter/info.php
@@ -82,7 +82,7 @@ $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
$morehtmlref .= ' : ';
diff --git a/htdocs/fichinter/note.php b/htdocs/fichinter/note.php
index 93bd60e519b..f80f08a44bc 100644
--- a/htdocs/fichinter/note.php
+++ b/htdocs/fichinter/note.php
@@ -92,7 +92,7 @@ if ($id > 0 || !empty($ref)) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
$morehtmlref .= ' : ';
diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php
index 1df4f70c063..d5854fdc702 100644
--- a/htdocs/product/stats/commande.php
+++ b/htdocs/product/stats/commande.php
@@ -136,7 +136,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_end();
- if ($user->rights->commande->lire) {
+ if ($user->hasRight('commande', 'lire')) {
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client, c.rowid, d.total_ht as total_ht, c.ref,";
$sql .= " c.ref_client,";
$sql .= " c.date_commande, c.fk_statut as statut, c.facture, c.rowid as commandeid, d.rowid, d.qty";
diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php
index f69b82727f0..d1631d94d94 100644
--- a/htdocs/resource/element_resource.php
+++ b/htdocs/resource/element_resource.php
@@ -541,7 +541,7 @@ if (!$ret) {
if (isModEnabled('project')) {
$langs->load("projects");
$morehtmlref .= ' '.$langs->trans('Project').' ';
- if ($user->rights->commande->creer) {
+ if ($user->hasRight('commande', 'creer')) {
if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
$morehtmlref .= ' : ';
|
| |