diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index cc5b600b2a4..93b57a630e1 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -101,14 +101,14 @@ if ($id > 0 || !empty($ref)) {
$result = $object->fetch($id, $ref);
// Define variables to know what current user can do on users
- $canadduser = ($user->admin || $user->rights->user->user->creer);
+ $canadduser = ($user->admin || $user->hasRight("user", "user", "creer"));
// Define variables to know what current user can do on properties of user linked to edited member
if ($object->user_id) {
// $User is the user who edits, $object->user_id is the id of the related user in the edited member
- $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer)
- || (($user->id != $object->user_id) && $user->rights->user->user->creer));
- $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password)
- || (($user->id != $object->user_id) && $user->rights->user->user->password));
+ $caneditfielduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "creer"))
+ || (($user->id != $object->user_id) && $user->hasRight("user", "user", "creer")));
+ $caneditpassworduser = ((($user->id == $object->user_id) && $user->hasRight("user", "self", "password"))
+ || (($user->id != $object->user_id) && $user->hasRight("user", "user", "password")));
}
}
@@ -641,7 +641,7 @@ if ($rowid > 0) {
print '';
if ($action != 'editlogin' && $user->hasRight('adherent', 'creer')) {
print '
';
- if ($user->rights->user->user->creer) {
+ if ($user->hasRight("user", "user", "creer")) {
print 'id.'">'.img_edit($langs->trans('SetLinkToUser'), 1).' ';
}
print ' ';
diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php
index bc825ca3992..64d01817c85 100644
--- a/htdocs/comm/action/class/actioncomm.class.php
+++ b/htdocs/comm/action/class/actioncomm.class.php
@@ -1433,7 +1433,7 @@ class ActionComm extends CommonObject
$response->label = $langs->trans("ActionsToDo");
$response->labelShort = $langs->trans("ActionsToDoShort");
$response->url = DOL_URL_ROOT.'/comm/action/list.php?mode=show_list&actioncode=0&status=todo&mainmenu=agenda';
- if ($user->rights->agenda->allactions->read) {
+ if ($user->hasRight("agenda", "allactions", "read")) {
$response->url .= '&filtert=-1';
}
$response->img = img_object('', "action", 'class="inline-block valigntextmiddle"');
diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php
index 3e8abd587c0..17348048edf 100644
--- a/htdocs/core/boxes/box_bookmarks.php
+++ b/htdocs/core/boxes/box_bookmarks.php
@@ -76,7 +76,7 @@ class box_bookmarks extends ModeleBoxes
'text' => $langs->trans("BoxMyLastBookmarks", $max),
'sublink' => DOL_URL_ROOT.'/bookmarks/list.php',
);
- if ($user->rights->bookmark->creer) {
+ if ($user->hasRight("bookmark", "creer")) {
$this->info_box_head['subpicto'] = 'bookmark';
$this->info_box_head['subtext'] = $langs->trans("BookmarksManagement");
} else {
@@ -121,7 +121,7 @@ class box_bookmarks extends ModeleBoxes
if ($num == 0) {
$mytxt = $langs->trans("NoRecordedBookmarks");
- if ($user->rights->bookmark->creer) {
+ if ($user->hasRight("bookmark", "creer")) {
$mytxt .= ' '.$langs->trans("ClickToAdd");
}
$this->info_box_contents[$line][0] = array(
diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php
index ed9b6560618..25393c6ee56 100644
--- a/htdocs/core/lib/company.lib.php
+++ b/htdocs/core/lib/company.lib.php
@@ -807,11 +807,11 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
$i = -1;
- if (isModEnabled('project') && $user->rights->projet->lire) {
+ if (isModEnabled('project') && $user->hasRight('projet', 'lire')) {
$langs->load("projects");
$newcardbutton = '';
- if (isModEnabled('project') && $user->rights->projet->creer && empty($nocreatelink)) {
+ if (isModEnabled('project') && $user->hasRight('projet', 'creer') && empty($nocreatelink)) {
$newcardbutton .= dolGetButtonTitle($langs->trans('AddProject'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage));
}
@@ -1062,7 +1062,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
$arrayfields = dol_sort_array($arrayfields, 'position');
$newcardbutton = '';
- if ($user->rights->societe->contact->creer) {
+ if ($user->hasRight('societe', 'contact', 'creer')) {
$addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress"));
$newcardbutton .= dolGetButtonTitle($addcontact, '', 'fa fa-plus-circle', DOL_URL_ROOT.'/contact/card.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage));
}
@@ -1363,14 +1363,14 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '', $showuserl
print '';
// Add to agenda
- if (isModEnabled('agenda')&& $user->rights->agenda->myactions->create) {
+ if (isModEnabled('agenda')&& $user->hasRight('agenda', 'myactions', 'create')) {
print '';
print img_object($langs->trans("Event"), "action");
print ' ';
}
// Edit
- if ($user->rights->societe->contact->creer) {
+ if ($user->hasRight('societe', 'contact', 'creer')) {
print '';
print img_edit();
print ' ';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 11ac2edba61..85b36fbc9ee 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -2209,7 +2209,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
if ($object->element == 'societe') {
- if (!empty($conf->use_javascript_ajax) && $user->rights->societe->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
+ if (!empty($conf->use_javascript_ajax) && $user->hasRight('societe', 'creer') && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
$morehtmlstatus .= ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased');
} else {
$morehtmlstatus .= $object->getLibStatut(6);
@@ -3041,7 +3041,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
$newemail .= img_warning($langs->trans("ErrorBadEMail", $email));
}
- if (($cid || $socid) && isModEnabled('agenda') && $user->rights->agenda->myactions->create) {
+ if (($cid || $socid) && isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) {
$type = 'AC_EMAIL';
$link = '';
if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) {
@@ -3484,7 +3484,7 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli
}
//if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
- if (isModEnabled('agenda') && $user->rights->agenda->myactions->create) {
+ if (isModEnabled('agenda') && $user->hasRight("agenda", "myactions", "create")) {
$type = 'AC_TEL';
$link = '';
if ($addlink == 'AC_FAX') {
@@ -11813,7 +11813,7 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = '', $n
//if ($donetodo == 'todo') $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (a.percent = -1 AND a.datep > '".$db->idate($now)."'))";
//elseif ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))";
$tododone = '';
- if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->datep > $now)) {
+ if (($obj->percent >= 0 and $obj->percent < 100) || ($obj->percent == -1 && $obj->dp > $now)) {
$tododone = 'todo';
}
diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php
index f3260d8ea48..90a760e14a1 100644
--- a/htdocs/fourn/card.php
+++ b/htdocs/fourn/card.php
@@ -232,9 +232,9 @@ if ($object->id > 0) {
$langs->load('compta');
print ' ';
print '';
- print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
+ print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->hasRight('societe', 'creer'));
print ' ';
- print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
+ print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->hasRight('societe', 'creer'));
print ' ';
print ' ';
}
@@ -272,7 +272,7 @@ if ($object->id > 0) {
print '';
print $langs->trans('PaymentConditions');
print ' ';
- if (($action != 'editconditions') && $user->rights->societe->creer) {
+ if (($action != 'editconditions') && $user->hasRight('societe', 'creer')) {
print ' id.'">'.img_edit($langs->trans('SetConditions'), 1).' ';
}
print '
';
@@ -290,7 +290,7 @@ if ($object->id > 0) {
print '';
print $langs->trans('PaymentMode');
print ' ';
- if (($action != 'editmode') && $user->rights->societe->creer) {
+ if (($action != 'editmode') && $user->hasRight('societe', 'creer')) {
print ' id.'">'.img_edit($langs->trans('SetMode'), 1).' ';
}
print '
';
@@ -309,7 +309,7 @@ if ($object->id > 0) {
print '';
print $langs->trans('PaymentBankAccount');
print ' ';
- if (($action != 'editbankaccount') && $user->rights->societe->creer) {
+ if (($action != 'editbankaccount') && $user->hasRight('societe', 'creer')) {
print ' id.'">'.img_edit($langs->trans('SetBankAccount'), 1).' ';
}
print '
';
@@ -328,7 +328,7 @@ if ($object->id > 0) {
print '';
@@ -341,7 +341,7 @@ if ($object->id > 0) {
print '';
print $langs->trans("CustomerAbsoluteDiscountShort");
print ' ';
- if ($user->rights->societe->creer && !$user->socid > 0) {
+ if ($user->hasRight('societe', 'creer') && !$user->socid > 0) {
print 'id).'&action=create&token='.newToken().'">'.img_edit($langs->trans("Modify")).' ';
}
print ' ';
@@ -881,7 +881,7 @@ if ($object->id > 0) {
}
}
- if ($user->rights->fournisseur->commande->creer || $user->rights->supplier_order->creer) {
+ if ($user->hasRight('fournisseur', 'commande', 'creer') || $user->hasRight('supplier_order', 'creer')) {
$langs->load("orders");
if ($object->status == 1) {
print dolGetButtonAction('', $langs->trans('AddSupplierOrderShort'), 'default', DOL_URL_ROOT.'/fourn/commande/card.php?action=create&token='.newToken().'&socid='.$object->id, '');
@@ -890,7 +890,7 @@ if ($object->id > 0) {
}
}
- if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
+ if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
if (!empty($orders2invoice) && $orders2invoice > 0) {
if ($object->status == 1) {
// Company is open
@@ -903,7 +903,7 @@ if ($object->id > 0) {
}
}
- if ($user->rights->fournisseur->facture->creer || $user->rights->supplier_invoice->creer) {
+ if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight('supplier_invoice', 'creer')) {
$langs->load("bills");
if ($object->status == 1) {
print dolGetButtonAction('', $langs->trans('AddBill'), 'default', DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id, '');
diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php
index 9c8b4ebee26..9213fc1470d 100644
--- a/htdocs/projet/class/project.class.php
+++ b/htdocs/projet/class/project.class.php
@@ -2123,7 +2123,7 @@ class Project extends CommonObject
$projectsListId = null;
- if (!$user->rights->projet->all->lire) {
+ if (!$user->hasRight("projet", "all", "lire")) {
$response->url = DOL_URL_ROOT.'/projet/list.php?search_status=1&mainmenu=project';
$projectsListId = $this->getProjectsAuthorizedForUser($user, 0, 1);
if (empty($projectsListId)) {
diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php
index ef04862eb71..ff1bdbc07f9 100644
--- a/htdocs/projet/class/task.class.php
+++ b/htdocs/projet/class/task.class.php
@@ -2226,7 +2226,7 @@ class Task extends CommonObjectLine
$response = new WorkboardResponse();
$response->warning_delay = $conf->project->task->warning_delay / 60 / 60 / 24;
$response->label = $langs->trans("OpenedTasks");
- if ($user->rights->projet->all->lire) {
+ if ($user->hasRight("projet", "all", "lire")) {
$response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project';
} else {
$response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project';
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index aea4bb916a5..5d72fed725f 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -138,10 +138,10 @@ if (!empty($canvas)) {
// Permissions
$permissiontoread = $user->hasRight('societe', 'lire');
-$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
$permissiontodelete = $user->hasRight('societe', 'supprimer') || ($permissiontoadd && isset($object->status) && $object->status == 0);
-$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
-$permissiondellink = $user->rights->societe->creer; // Used by the include of actions_dellink.inc.php
+$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
+$permissiondellink = $user->hasRight('societe', 'creer'); // Used by the include of actions_dellink.inc.php
$upload_dir = $conf->societe->multidir_output[isset($object->entity) ? $object->entity : 1];
// Security check
@@ -978,7 +978,7 @@ if (empty($reshook)) {
// Actions to build doc
$id = $socid;
$upload_dir = !empty($conf->societe->multidir_output[$object->entity])?$conf->societe->multidir_output[$object->entity]:$conf->societe->dir_output;
- $permissiontoadd = $user->rights->societe->creer;
+ $permissiontoadd = $user->hasRight('societe', 'creer');
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
@@ -3018,7 +3018,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Third-Party Type
print '';
print '';
@@ -3087,7 +3087,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (isModEnabled('incoterm')) {
print ' ';
print '';
@@ -3151,7 +3151,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
print ' ';
print '';
@@ -3279,7 +3279,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
$filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id;
$urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id;
$genallowed = $user->hasRight('societe', 'lire');
- $delallowed = $user->rights->societe->creer;
+ $delallowed = $user->hasRight('societe', 'creer');
print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang);
}
diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php
index c74b5e68985..a7f9276897a 100644
--- a/htdocs/societe/consumption.php
+++ b/htdocs/societe/consumption.php
@@ -204,13 +204,13 @@ if ($object->fournisseur) {
$obj = $db->fetch_object($resql);
$nbCmdsFourn = $obj->nb;
$thirdTypeArray['supplier'] = $langs->trans("supplier");
- if ((isModEnabled('fournisseur') && $user->rights->fournisseur->facture->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && $user->rights->supplier_invoice->lire)) {
+ if ((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'facture', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
$elementTypeArray['supplier_invoice'] = $langs->transnoentitiesnoconv('SuppliersInvoices');
}
- if ((isModEnabled('fournisseur') && $user->rights->fournisseur->commande->lire && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->rights->supplier_order->lire)) {
+ if ((isModEnabled('fournisseur') && $user->hasRight('fournisseur', 'commande', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire'))) {
$elementTypeArray['supplier_order'] = $langs->transnoentitiesnoconv('SuppliersOrders');
}
- if (isModEnabled('supplier_proposal') && $user->rights->supplier_proposal->lire) {
+ if (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire')) {
$elementTypeArray['supplier_proposal'] = $langs->transnoentitiesnoconv('SupplierProposals');
}
}
@@ -399,6 +399,7 @@ $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPO
$button = ' ';
$total_qty = 0;
+$param = '';
if ($sql_select) {
$resql = $db->query($sql);
diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php
index ccb668f9055..3f6b10c7236 100644
--- a/htdocs/societe/document.php
+++ b/htdocs/societe/document.php
@@ -83,7 +83,7 @@ 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('thirdpartydocument', 'globalcard'));
-$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
// Security check
if ($user->socid > 0) {
@@ -187,8 +187,8 @@ print '';
print dol_get_fiche_end();
$modulepart = 'societe';
-$permissiontoadd = $user->rights->societe->creer;
-$permtoedit = $user->rights->societe->creer;
+$permissiontoadd = $user->hasRight('societe', 'creer');
+$permtoedit = $user->hasRight('societe', 'creer');
$param = '&id='.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 6da7fcf3779..28523fa720c 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -385,7 +385,7 @@ if (empty($reshook)) {
$objectlabel = 'ThirdParty';
$permissiontoread = $user->hasRight('societe', 'lire');
$permissiontodelete = $user->hasRight('societe', 'supprimer');
- $permissiontoadd = $user->rights->societe->creer;
+ $permissiontoadd = $user->hasRight("societe", "creer");
$uploaddir = $conf->societe->dir_output;
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
@@ -922,16 +922,16 @@ $arrayofmassactions = array(
//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
);
//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
-if (isModEnabled('category') && $user->rights->societe->creer) {
+if (isModEnabled('category') && $user->hasRight("societe", "creer")) {
$arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
}
-if ($user->rights->societe->creer) {
+if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['preenable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToEnabled");
}
-if ($user->rights->societe->creer) {
+if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['predisable'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SetToDisabled");
}
-if ($user->rights->societe->creer) {
+if ($user->hasRight("societe", "creer")) {
$arrayofmassactions['presetcommercial'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("AllocateCommercial");
}
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'preenable', 'preclose'))) {
@@ -969,8 +969,8 @@ if ($contextpage != 'poslist') {
if (!empty($socid)) {
$url .= '&socid='.$socid;
}
- $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->rights->societe->creer);
-} elseif ($user->rights->societe->creer) {
+ $newcardbutton = dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url, '', $user->hasRight("societe", "creer"));
+} elseif ($user->hasRight("societe", "creer")) {
$url = DOL_URL_ROOT.'/societe/card.php?action=create&type=t&contextpage=poslist&optioncss=print&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type=t&contextpage=poslist&nomassaction=1&optioncss=print&place='.$place);
$label = 'MenuNewCustomer';
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', $url);
diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php
index a15f96fa1f6..32ec4bbe567 100644
--- a/htdocs/societe/note.php
+++ b/htdocs/societe/note.php
@@ -48,7 +48,7 @@ if ($id > 0) {
}
// Permissions
-$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
+$permissionnote = $user->hasRight('societe', 'creer'); // Used by the include of actions_setnotes.inc.php
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
$hookmanager->initHooks(array('thirdpartynote', 'globalcard'));
diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php
index ba1ead0e068..f299ef2ee82 100644
--- a/htdocs/societe/notify/card.php
+++ b/htdocs/societe/notify/card.php
@@ -306,7 +306,7 @@ if ($result > 0) {
while ($i < $num) {
$obj = $db->fetch_object($resql);
- $contactstatic->id = $obj->contact_id;
+ $contactstatic->id = $obj->contactid;
$contactstatic->lastname = $obj->lastname;
$contactstatic->firstname = $obj->firstname;
diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php
index a7a7cd44972..ae39569a36e 100644
--- a/htdocs/societe/paymentmodes.php
+++ b/htdocs/societe/paymentmodes.php
@@ -80,7 +80,7 @@ $hookmanager->initHooks(array('thirdpartybancard', 'globalcard'));
// Permissions
$permissiontoread = $user->hasRight('societe', 'lire');
-$permissiontoadd = $user->rights->societe->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php
+$permissiontoadd = $user->hasRight('societe', 'creer'); // Used by the include of actions_addupdatedelete.inc.php and actions_builddoc.inc.php
$permissiontoaddupdatepaymentinformation = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $permissiontoadd) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->societe->thirdparty_paymentinformation_advance->write)));
@@ -111,6 +111,7 @@ if ($cancel) {
$action = '';
}
+$morehtmlright = '';
$parameters = array('id'=>$socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) {
diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php
index 125264e14d7..c8d11c9be3b 100644
--- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php
+++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php
@@ -28,7 +28,7 @@ print ' ';
print '';
print $langs->trans('SalesRepresentatives');
print ' ';
-if ($action != 'editsalesrepresentatives' && $user->rights->societe->creer) {
+if ($action != 'editsalesrepresentatives' && $user->hasRight('societe', 'creer')) {
print '';
print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' ';
print ' ';