diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php
index 2560e3bef05..67af97cfe12 100644
--- a/htdocs/comm/index.php
+++ b/htdocs/comm/index.php
@@ -134,7 +134,7 @@ if ($tmp) {
* Draft customer proposals
*/
-if (isModEnabled("propal") && $user->rights->propal->lire) {
+if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@@ -232,7 +232,7 @@ if (isModEnabled("propal") && $user->rights->propal->lire) {
* Draft supplier proposals
*/
-if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
+if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "lire")) {
$sql = "SELECT p.rowid, p.ref, p.total_ht, p.total_tva, p.total_ttc, p.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@@ -427,7 +427,7 @@ if (isModEnabled('commande') && $user->rights->commande->lire) {
* Draft purchase orders
*/
-if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->commande->lire) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
+if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "commande", "lire")) || (isModEnabled("supplier_order") && $user->hasRight("supplier_order", "lire"))) {
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ht, cf.total_tva, cf.total_ttc, cf.fk_statut as status";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
@@ -819,7 +819,7 @@ if (((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERM
/*
* Latest contracts
*/
-if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
+if (isModEnabled('contrat') && $user->hasRight("contrat", "lire") && 0) { // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT
$staticcontrat = new Contrat($db);
$sql = "SELECT s.rowid as socid, s.nom as name, s.name_alias";
@@ -897,7 +897,7 @@ if (isModEnabled('contrat') && $user->rights->contrat->lire && 0) { // TODO A RE
/*
* Opened (validated) proposals
*/
-if (isModEnabled("propal") && $user->rights->propal->lire) {
+if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
$sql = "SELECT p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv";
$sql .= ", s.rowid as socid, s.nom as name, s.name_alias";
$sql .= ", s.code_client, s.code_compta, s.client";
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 786fb1a2ad2..383cf7581e9 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1868,7 +1868,7 @@ if ($action == 'create' && $usercancreate) {
// Incoterms
if (isModEnabled('incoterm')) {
print '
';
- print ''.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->label_incoterms, 1).' ';
+ print ''.$form->textwithpicto($langs->trans("IncotermLabel"), !empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : $soc->fk_incoterms, 1).' ';
print '';
$incoterm_id = GETPOST('incoterm_id');
$incoterm_location = GETPOST('location_incoterms');
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index 4257d1414b1..e6338903f43 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -201,10 +201,10 @@ $arrayfields = array(
'c.multicurrency_total_ttc'=>array('label'=>'MulticurrencyAmountTTC', 'checked'=>0, 'enabled'=>(!isModEnabled("multicurrency") ? 0 : 1), 'position'=>110),
'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>115),
'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>0, 'position'=>116),
- 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
- 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous ? 0 : 1)),
- 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
- 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
+ 'total_pa' => array('label' => (getDolGlobalString('MARGIN_TYPE') == '1' ? 'BuyingPrice' : 'CostPrice'), 'checked' => 0, 'position' => 300, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)),
+ 'total_margin' => array('label' => 'Margin', 'checked' => 0, 'position' => 301, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") ? 0 : 1)),
+ 'total_margin_rate' => array('label' => 'MarginRate', 'checked' => 0, 'position' => 302, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
+ 'total_mark_rate' => array('label' => 'MarkRate', 'checked' => 0, 'position' => 303, 'enabled' => (!isModEnabled('margin') || !$user->hasRight("margins", "liretous") || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
'c.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>120),
'c.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>125),
'c.date_cloture'=>array('label'=>"DateClosing", 'checked'=>0, 'position'=>130),
@@ -298,19 +298,19 @@ if (empty($reshook)) {
// Mass actions
$objectclass = 'Commande';
$objectlabel = 'Orders';
- $permissiontoread = $user->rights->commande->lire;
- $permissiontoadd = $user->rights->commande->creer;
- $permissiontodelete = $user->rights->commande->supprimer;
+ $permissiontoread = $user->hasRight("commande", "lire");
+ $permissiontoadd = $user->hasRight("commande", "creer");
+ $permissiontodelete = $user->hasRight("commande", "supprimer");
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
- $permissiontovalidate = $user->rights->commande->order_advance->validate;
- $permissiontoclose = $user->rights->commande->order_advance->close;
- $permissiontocancel = $user->rights->commande->order_advance->annuler;
- $permissiontosendbymail = $user->rights->commande->order_advance->send;
+ $permissiontovalidate = $user->hasRight("commande", "order_advance", "validate");
+ $permissiontoclose = $user->hasRight("commande", "order_advance", "close");
+ $permissiontocancel = $user->hasRight("commande", "order_advance", "annuler");
+ $permissiontosendbymail = $user->hasRight("commande", "order_advance", "send");
} else {
- $permissiontovalidate = $user->rights->commande->creer;
- $permissiontoclose = $user->rights->commande->creer;
- $permissiontocancel = $user->rights->commande->creer;
- $permissiontosendbymail = $user->rights->commande->creer;
+ $permissiontovalidate = $user->hasRight("commande", "creer");
+ $permissiontoclose = $user->hasRight("commande", "creer");
+ $permissiontocancel = $user->hasRight("commande", "creer");
+ $permissiontosendbymail = $user->hasRight("commande", "creer");
}
$uploaddir = $conf->commande->multidir_output[$conf->entity];
$triggersendname = 'ORDER_SENTBYMAIL';
@@ -1287,7 +1287,7 @@ if ($resql) {
if ($permissiontocancel) {
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
}
- if (isModEnabled('facture') && $user->rights->facture->creer) {
+ if (isModEnabled('facture') && $user->hasRight("facture", "creer")) {
$arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer");
}
if ($permissiontoclose) {
@@ -1394,7 +1394,7 @@ if ($resql) {
$moreforfilter = '';
// If the user can view prospects? sales other than his own
- if ($user->rights->user->user->lire) {
+ if ($user->hasRight("user", "user", "lire")) {
$langs->load("commercial");
$moreforfilter .= '';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
@@ -1402,7 +1402,7 @@ if ($resql) {
$moreforfilter .= '
';
}
// If the user can view other users
- if ($user->rights->user->user->lire) {
+ if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '';
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250 widthcentpercentminusx');
@@ -1410,7 +1410,7 @@ if ($resql) {
}
// If the user can view other products/services than his own
- if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
+ if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$tmptitle = $langs->trans('IncludingProductWithTag');
@@ -1419,7 +1419,7 @@ if ($resql) {
$moreforfilter .= '
';
}
// If Categories are enabled & user has rights to see
- if (isModEnabled('categorie') && $user->rights->categorie->lire) {
+ if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 348897369ee..698f131aa09 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -376,9 +376,9 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter',
if (empty($reshook)) {
$objectclass = 'Facture';
$objectlabel = 'Invoices';
- $permissiontoread = $user->rights->facture->lire;
- $permissiontoadd = $user->rights->facture->creer;
- $permissiontodelete = $user->rights->facture->supprimer;
+ $permissiontoread = $user->hasRight("facture", "lire");
+ $permissiontoadd = $user->hasRight("facture", "creer");
+ $permissiontodelete = $user->hasRight("facture", "supprimer");
$uploaddir = $conf->facture->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -1185,7 +1185,7 @@ if ($resql) {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
- $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->rights->facture->creer);
+ $newcardbutton = dolGetButtonTitle($langs->trans('NewBill'), '', 'fa fa-plus-circle', $url, '', $user->hasRight("facture", "creer"));
}
$i = 0;
@@ -1237,7 +1237,7 @@ if ($resql) {
// If the user can view prospects other than his'
$moreforfilter = '';
- if ($user->rights->user->user->lire) {
+ if ($user->hasRight("user", "user", "lire")) {
$langs->load("commercial");
$moreforfilter .= '
';
$tmptitle = $langs->trans('ThirdPartiesOfSaleRepresentative');
@@ -1245,14 +1245,14 @@ if ($resql) {
$moreforfilter .= '
';
}
// If the user can view prospects other than his'
- if ($user->rights->user->user->lire) {
+ if ($user->hasRight("user", "user", "lire")) {
$moreforfilter .= '
';
$tmptitle = $langs->trans('LinkedToSpecificUsers');
$moreforfilter .= img_picto($tmptitle, 'user', 'class="pictofixedwidth"').$form->select_dolusers($search_user, 'search_user', $tmptitle, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth250');
$moreforfilter .= '
';
}
// Filter on product tags
- if (isModEnabled('categorie') && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire)) {
+ if (isModEnabled('categorie') && $user->hasRight("categorie", "lire") && ($user->hasRight("produit", "lire") || $user->hasRight("service", "lire"))) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$tmptitle = $langs->trans('IncludingProductWithTag');
@@ -1260,7 +1260,7 @@ if ($resql) {
$moreforfilter .= img_picto($tmptitle, 'category', 'class="pictofixedwidth"').$form->selectarray('search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0, '', 0, 0, 0, 0, 'maxwidth250', 1);
$moreforfilter .= '
';
}
- if (isModEnabled('categorie') && $user->rights->categorie->lire) {
+ if (isModEnabled('categorie') && $user->hasRight("categorie", "lire")) {
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$moreforfilter .= '
';
$tmptitle = $langs->trans('CustomersProspectsCategoriesShort');
@@ -2574,8 +2574,8 @@ if ($resql) {
$urlsource .= str_replace('&', '&', $param);
$filedir = $diroutputmassaction;
- $genallowed = $user->rights->facture->lire;
- $delallowed = $user->rights->facture->creer;
+ $genallowed = $user->hasRight("facture", "lire");
+ $delallowed = $user->hasRight("facture", "creer");
$title = '';
print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index c22b1925dbb..f25ae7ca600 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -281,7 +281,7 @@ if (isModEnabled('facture') && !empty($user->rights->facture->lire)) {
// Last modified supplier invoices
-if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->rights->fournisseur->facture->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) {
+if ((isModEnabled('fournisseur') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire")) || (isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) {
$langs->load("boxes");
$facstatic = new FactureFournisseur($db);
@@ -590,7 +590,7 @@ if (isModEnabled('tax') && !empty($user->rights->tax->charges->lire)) {
/*
* Customers orders to be billed
*/
-if (isModEnabled('facture') && isModEnabled('commande') && $user->rights->commande->lire && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
+if (isModEnabled('facture') && isModEnabled('commande') && $user->hasRight("commande", "lire") && empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) {
$commandestatic = new Commande($db);
$langs->load("orders");
diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index e4bf213c4eb..76531832776 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -362,31 +362,31 @@ if ($type == 'directory') {
if ($module == 'medias') {
$useinecm = 6;
$modulepart = 'medias';
- $perm = ($user->rights->website->write || $user->rights->emailing->creer);
+ $perm = ($user->hasRight("website", "write") || $user->hasRight("emailing", "creer"));
$title = 'none';
} elseif ($module == 'ecm') { // DMS/ECM -> manual structure
- if ($user->rights->ecm->read) {
+ if ($user->hasRight("ecm", "read")) {
// Buttons: Preview
$useinecm = 2;
}
- if ($user->rights->ecm->upload) {
+ if ($user->hasRight("ecm", "upload")) {
// Buttons: Preview + Delete
$useinecm = 4;
}
- if ($user->rights->ecm->setup) {
+ if ($user->hasRight("ecm", "setup")) {
// Buttons: Preview + Delete + Edit
$useinecm = 5;
}
- $perm = $user->rights->ecm->upload;
+ $perm = $user->hasRight("ecm", "upload");
$modulepart = 'ecm';
$title = ''; // Use default
} else {
$useinecm = 5;
$modulepart = 'ecm';
- $perm = $user->rights->ecm->upload;
+ $perm = $user->hasRight("ecm", "upload");
$title = ''; // Use default
}
diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php
index 56fa8172bcb..4829b32a72a 100644
--- a/htdocs/core/boxes/box_activity.php
+++ b/htdocs/core/boxes/box_activity.php
@@ -84,7 +84,7 @@ class box_activity extends ModeleBoxes
$totalnb = 0;
$line = 0;
$cachetime = 3600;
- $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->rights->societe->client->voir ? '1' : '0').'.cache';
+ $fileid = '-e'.$conf->entity.'-u'.$user->id.'-s'.$user->socid.'-r'.($user->hasRight("societe", "client", "voir") ? '1' : '0').'.cache';
$now = dol_now();
$nbofperiod = 3;
@@ -102,7 +102,7 @@ class box_activity extends ModeleBoxes
// list the summary of the propals
- if (isModEnabled("propal") && $user->rights->propal->lire) {
+ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
$propalstatic = new Propal($this->db);
@@ -189,7 +189,7 @@ class box_activity extends ModeleBoxes
}
// list the summary of the orders
- if (isModEnabled('commande') && $user->rights->commande->lire) {
+ if (isModEnabled('commande') && $user->hasRight("commande", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
$commandestatic = new Commande($this->db);
@@ -278,7 +278,7 @@ class box_activity extends ModeleBoxes
// list the summary of the bills
- if (isModEnabled('facture') && $user->rights->facture->lire) {
+ if (isModEnabled('facture') && $user->hasRight("facture", "lire")) {
include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$facturestatic = new Facture($this->db);
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index da6339bdaec..b79df73140d 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -5047,9 +5047,9 @@ class Form
$morecss = (!empty($input['morecss']) ? ' '.$input['morecss'] : '');
if ($input['type'] == 'text') {
- $more .= '
'."\n";
+ $more .= '
'."\n";
} elseif ($input['type'] == 'password') {
- $more .= '
'."\n";
+ $more .= '
'."\n";
} elseif ($input['type'] == 'textarea') {
/*$more .= '
'.$input['label'].'
';
$more .= '
";
}
$statstring2 = '';
- if (((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->rights->supplier_order->lire) || (isModEnabled('supplier_invoice') && $user->rights->supplier_invoice->lire)) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
+ if (((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'facture', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled('supplier_order') && $user->hasRight('supplier_order', 'lire')) || (isModEnabled('supplier_invoice') && $user->hasRight('supplier_invoice', 'lire'))) && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS)) {
$statstring2 = "