diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php
index 82f1cfa667b..e88104eb865 100644
--- a/htdocs/takepos/admin/setup.php
+++ b/htdocs/takepos/admin/setup.php
@@ -473,12 +473,12 @@ if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
print '
rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
+if (!$user->hasRight('takepos', 'run') && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
accessforbidden();
}
@@ -701,7 +701,7 @@ if (empty($reshook)) {
if ($action == "updateqty") {
foreach ($invoice->lines as $line) {
if ($line->id == $idline) {
- if (!$user->rights->takepos->editlines || (!$user->rights->takepos->editorderedlines && $line->special_code == "4")) {
+ if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) {
dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1);
} else {
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
@@ -730,7 +730,7 @@ if (empty($reshook)) {
dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)));
//echo $langs->trans("CantBeLessThanMinPrice");
} else {
- if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code == "4")) {
+ if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) {
dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1);
} elseif (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') == 1) {
$result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
@@ -767,7 +767,7 @@ if (empty($reshook)) {
$langs->load("products");
dol_htmloutput_errors($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)));
} else {
- if (empty($user->rights->takepos->editlines) || (empty($user->rights->takepos->editorderedlines) && $line->special_code == "4")) {
+ if (!$user->hasRight('takepos', 'editlines') || (!$user->hasRight('takepos', 'editorderedlines') && $line->special_code == "4")) {
dol_htmloutput_errors($langs->trans("NotEnoughPermissions", "TakePos"), null, 1);
} else {
$result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit);
@@ -965,7 +965,7 @@ $form = new Form($db);
if ((getDolGlobalString('TAKEPOS_PHONE_BASIC_LAYOUT') == 1 && $conf->browser->layout == 'phone') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
- $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
+ $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE');
}
$head = '
@@ -1651,7 +1651,7 @@ if ($placeid > 0) {
$htmlforlines .= '
'.vatrate($line->remise_percent, true).' | ';
$htmlforlines .= '
';
- if (isModEnabled('stock') && !empty($user->rights->stock->mouvement->lire)) {
+ if (isModEnabled('stock') && $user->hasRight('stock', 'mouvement', 'lire')) {
$constantforkey = 'CASHDESK_ID_WAREHOUSE'.$_SESSION["takeposterminal"];
if (getDolGlobalString($constantforkey) && $line->fk_product > 0 && empty($conf->global->TAKEPOS_HIDE_STOCK_ON_LINE)) {
$sql = "SELECT e.rowid, e.ref, e.lieu, e.fk_parent, e.statut, ps.reel, ps.rowid as product_stock_id, p.pmp";
diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php
index ea6f092bafb..22d161a4bec 100644
--- a/htdocs/takepos/pay.php
+++ b/htdocs/takepos/pay.php
@@ -52,7 +52,7 @@ $invoiceid = GETPOST('invoiceid', 'int');
$hookmanager->initHooks(array('takepospay'));
-if (empty($user->rights->takepos->run)) {
+if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php
index 77376be9a3f..6c25d573221 100644
--- a/htdocs/takepos/phone.php
+++ b/htdocs/takepos/phone.php
@@ -62,7 +62,7 @@ if ($setterminal > 0) {
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter"));
-if (empty($user->rights->takepos->run) && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
+if (!$user->hasRight('takepos', 'run') && !defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) {
accessforbidden();
}
@@ -75,7 +75,7 @@ if (empty($action)) {
// Code for llxHeader()
$title = 'TakePOS - Dolibarr '.DOL_VERSION;
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
- $title = 'TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE;
+ $title = 'TakePOS - ' . getDolGlobalString('MAIN_APPLICATION_TITLE');
}
$head = '
diff --git a/htdocs/takepos/printbox.php b/htdocs/takepos/printbox.php
index 53c07bcf1d7..02192ba19f2 100644
--- a/htdocs/takepos/printbox.php
+++ b/htdocs/takepos/printbox.php
@@ -51,7 +51,7 @@ $facid = GETPOST('facid', 'int');
$action = GETPOST('action', 'aZ09');
-if (empty($user->rights->takepos->run)) {
+if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php
index b545f449c30..696e8bb5123 100644
--- a/htdocs/takepos/receipt.php
+++ b/htdocs/takepos/receipt.php
@@ -129,7 +129,7 @@ if (getDolGlobalString('TAKEPOS_HEADER') || getDolGlobalString($constFreeText))
trans('Date')." ".dol_print_date($object->date, 'day').' ';
if (!empty($conf->global->TAKEPOS_RECEIPT_NAME)) {
- print $conf->global->TAKEPOS_RECEIPT_NAME." ";
+ print getDolGlobalString('TAKEPOS_RECEIPT_NAME') . " ";
}
if ($object->statut == Facture::STATUS_DRAFT) {
print str_replace(")", "", str_replace("-", " ".$langs->trans('Place')." ", str_replace("(PROV-POS", $langs->trans("Terminal")." ", $object->ref)));
diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php
index 995d18599a3..1a1a5cb7b4e 100644
--- a/htdocs/takepos/reduction.php
+++ b/htdocs/takepos/reduction.php
@@ -46,7 +46,7 @@ $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is
$invoiceid = GETPOST('invoiceid', 'int');
-if (empty($user->rights->takepos->run)) {
+if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
diff --git a/htdocs/takepos/send.php b/htdocs/takepos/send.php
index 7397c962555..8164c4bae96 100644
--- a/htdocs/takepos/send.php
+++ b/htdocs/takepos/send.php
@@ -48,7 +48,7 @@ $facid = GETPOST('facid', 'int');
$action = GETPOST('action', 'aZ09');
$email = GETPOST('email', 'alpha');
-if (empty($user->rights->takepos->run)) {
+if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
diff --git a/htdocs/takepos/smpcb.php b/htdocs/takepos/smpcb.php
index 6ce39d39bf0..2bd67b2487d 100644
--- a/htdocs/takepos/smpcb.php
+++ b/htdocs/takepos/smpcb.php
@@ -37,7 +37,7 @@ if (!defined('NOREQUIREAJAX')) {
// Load Dolibarr environment
require '../main.inc.php';
-if (empty($user->rights->takepos->run)) {
+if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
diff --git a/htdocs/takepos/split.php b/htdocs/takepos/split.php
index c2e9665ebfb..6b6d4cf0b72 100644
--- a/htdocs/takepos/split.php
+++ b/htdocs/takepos/split.php
@@ -47,7 +47,7 @@ $langs->loadLangs(array("main", "bills", "cashdesk", "banks"));
$action = GETPOST('action', 'aZ09');
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0);
-if (empty($user->rights->takepos->run)) {
+if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
diff --git a/htdocs/theme/eldy/manifest.json.php b/htdocs/theme/eldy/manifest.json.php
index 1fe54edfd63..e14d612392a 100644
--- a/htdocs/theme/eldy/manifest.json.php
+++ b/htdocs/theme/eldy/manifest.json.php
@@ -89,7 +89,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
$icon = new stdClass();
$icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL;
if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) {
- $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE;
+ $icon->sizes = getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE') . "x" . getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE');
} else {
$icon->sizes = "512x512";
}
@@ -97,7 +97,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
$manifest->icons[] = $icon;
} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)) {
- $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI;
+ $iconRelativePath = 'logos/thumbs/' . getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI');
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath);
@@ -112,7 +112,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
}
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)) {
- $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL;
+ $iconRelativePath = 'logos/thumbs/' . getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL');
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath);
@@ -127,7 +127,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
}
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
- $iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED;
+ $iconRelativePath = 'logos/' . getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED');
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath);
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index 34b08c28971..5b72a89911e 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -102,7 +102,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$path = ''; // This value may be used in future for external module to overwrite theme
$theme = 'eldy'; // Value of theme
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
- $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES;
+ $path = '/' . getDolGlobalString('MAIN_OVERWRITE_THEME_RES'); $theme = $conf->global->MAIN_OVERWRITE_THEME_RES;
}
// Define image path files and other constants
diff --git a/htdocs/theme/md/manifest.json.php b/htdocs/theme/md/manifest.json.php
index 887fb2f9564..0e1f1ca17e0 100644
--- a/htdocs/theme/md/manifest.json.php
+++ b/htdocs/theme/md/manifest.json.php
@@ -87,7 +87,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
$icon = new stdClass();
$icon->src = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL;
if ($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE) {
- $icon->sizes = $conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE."x".$conf->global->MAIN_MANIFEST_APPLI_LOGO_URL_SIZE;
+ $icon->sizes = getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE') . "x" . getDolGlobalString('MAIN_MANIFEST_APPLI_LOGO_URL_SIZE');
} else {
$icon->sizes = "512x512";
}
@@ -95,7 +95,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
$manifest->icons[] = $icon;
} elseif (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)) {
- $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI;
+ $iconRelativePath = 'logos/thumbs/' . getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI');
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath);
@@ -110,7 +110,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
}
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)) {
- $iconRelativePath = 'logos/thumbs/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL;
+ $iconRelativePath = 'logos/thumbs/' . getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL');
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath);
@@ -125,7 +125,7 @@ if (!empty($conf->global->MAIN_MANIFEST_APPLI_LOGO_URL)) {
}
if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)) {
- $iconRelativePath = 'logos/'.$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED;
+ $iconRelativePath = 'logos/' . getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED');
$iconPath = $conf->mycompany->dir_output.'/'.$iconRelativePath;
if (is_readable($iconPath)) {
$imgSize = getimagesize($iconPath);
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 2072f32e1ee..4c2e6baca46 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -104,7 +104,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$path = ''; // This value may be used in future for external module to overwrite theme
$theme = 'md'; // Value of theme
if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
- $path = '/'.$conf->global->MAIN_OVERWRITE_THEME_RES; $theme = $conf->global->MAIN_OVERWRITE_THEME_RES;
+ $path = '/' . getDolGlobalString('MAIN_OVERWRITE_THEME_RES'); $theme = $conf->global->MAIN_OVERWRITE_THEME_RES;
}
// Define image path files and other constants
diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php
index 39d25c3a215..2b5c0977b30 100644
--- a/htdocs/ticket/agenda.php
+++ b/htdocs/ticket/agenda.php
@@ -99,7 +99,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) {
accessforbidden();
}
@@ -128,7 +128,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
// Set parent company
-if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
+if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 90294c356ca..296da9c019d 100755
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -286,7 +286,7 @@ if (empty($reshook)) {
}
// Auto mark as read if created from backend
- if (!empty($conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND) && $user->rights->ticket->write) {
+ if (!empty($conf->global->TICKET_AUTO_READ_WHEN_CREATED_FROM_BACKEND) && $user->hasRight('ticket', 'write')) {
if ( ! $object->markAsRead($user) > 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
@@ -528,7 +528,7 @@ if (empty($reshook)) {
}
// Set parent company
- if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
+ if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
@@ -538,7 +538,7 @@ if (empty($reshook)) {
}
// Set progress status
- if ($action == 'set_progression' && $user->rights->ticket->write) {
+ if ($action == 'set_progression' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setProgression(GETPOST('progress', 'alpha'));
@@ -549,7 +549,7 @@ if (empty($reshook)) {
}
// Set categories
- if ($action == 'set_categories' && $user->rights->ticket->write) {
+ if ($action == 'set_categories' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCategories(GETPOST('categories', 'array'));
@@ -560,7 +560,7 @@ if (empty($reshook)) {
}
// Set Subject
- if ($action == 'setsubject' && $user->rights->ticket->write) {
+ if ($action == 'setsubject' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'))) {
if ($action == 'setsubject') {
$object->subject = GETPOST('subject', 'alphanohtml');
@@ -583,7 +583,7 @@ if (empty($reshook)) {
}
}
- if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) {
+ if ($action == 'confirm_reopen' && $user->hasRight('ticket', 'manage') && !GETPOST('cancel')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
// prevent browser refresh from reopening ticket several times
if ($object->status == Ticket::STATUS_CLOSED || $object->status == Ticket::STATUS_CANCELED) {
@@ -614,7 +614,7 @@ if (empty($reshook)) {
header("Location: ".$url);
exit();
}
- } elseif ($action == "set_message" && $user->rights->ticket->manage) {
+ } elseif ($action == "set_message" && $user->hasRight('ticket', 'manage')) {
if (!GETPOST('cancel')) {
$object->fetch('', '', GETPOST('track_id', 'alpha'));
//$oldvalue_message = $object->message;
@@ -808,7 +808,7 @@ if ($action == 'create' || $action == 'presend') {
|| $action== 'edit_contrat' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') {
if ($res > 0) {
// or for unauthorized internals users
- if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+ if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) {
accessforbidden('', 0, 1);
}
@@ -879,7 +879,7 @@ if ($action == 'create' || $action == 'presend') {
// Ref
print ' | | '.$langs->trans('Ref').' | ';
// Define a complementary filter for search of next/prev ref.
- if (empty($user->rights->projet->all->lire)) {
+ if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0);
$projectstat->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
@@ -1055,9 +1055,9 @@ if ($action == 'create' || $action == 'presend') {
// Subject
print ' |
| ';
- print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string');
+ print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->hasRight('ticket', 'write') && !$user->socid, 'string');
print ' | ';
- print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string');
+ print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->hasRight('ticket', 'write') && !$user->socid, 'string');
print ' |
';
// Creation date
@@ -1103,7 +1103,7 @@ if ($action == 'create' || $action == 'presend') {
print '
';
print '| ';
print $langs->trans("AssignedTo");
- if (isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) {
+ if (isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set', 'alpha') != "assign_ticket" && $user->hasRight('ticket', 'manage')) {
print ' | '.img_edit($langs->trans('Modify'), '').'';
}
print ' | ';
@@ -1114,7 +1114,7 @@ if ($action == 'create' || $action == 'presend') {
}
// Show user list to assignate one if status is "read"
- if (GETPOST('set', 'alpha') == "assign_ticket" && $object->status < 8 && !$user->socid && $user->rights->ticket->write) {
+ if (GETPOST('set', 'alpha') == "assign_ticket" && $object->status < 8 && !$user->socid && $user->hasRight('ticket', 'write')) {
print ' |
';
print '
';
- if ($user->rights->ticket->write && $action == 'progression') {
+ if ($user->hasRight('ticket', 'write') && $action == 'progression') {
print ' | ';
- if ($user->rights->ticket->write && $action == 'categories') {
+ if ($user->hasRight('ticket', 'write') && $action == 'categories') {
$cate_arbo = $form->select_all_categories(Categorie::TYPE_TICKET, '', 'parent', 64, 0, 1);
if (is_array($cate_arbo)) {
// Categories
@@ -1246,18 +1246,18 @@ if ($action == 'create' || $action == 'presend') {
print $langs->trans('TicketProperties');
print '';
print '
';
- if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
+ if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
print '';
} else {
// Button to edit Properties
- if (isset($object->status) && ($object->status < $object::STATUS_NEED_MORE_INFO || !empty($conf->global->TICKET_ALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED)) && $user->rights->ticket->write) {
+ if (isset($object->status) && ($object->status < $object::STATUS_NEED_MORE_INFO || !empty($conf->global->TICKET_ALLOW_CLASSIFICATION_MODIFICATION_EVEN_IF_CLOSED)) && $user->hasRight('ticket', 'write')) {
print ' '.img_edit($langs->trans('Modify')).'';
}
}
print ' | ';
print '';
- if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
+ if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
print '
';
// Type
print '';
@@ -1311,7 +1311,7 @@ if ($action == 'create' || $action == 'presend') {
// Display navbar with links to change ticket status
print '';
- if (!$user->socid && $user->rights->ticket->write && isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
+ if (!$user->socid && $user->hasRight('ticket', 'write') && isset($object->status) && $object->status < $object::STATUS_CLOSED && GETPOST('set') !== 'properties') {
$actionobject->viewStatusActions($object);
}
@@ -1466,12 +1466,12 @@ if ($action == 'create' || $action == 'presend') {
}
// Close ticket if status is read
- if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
+ if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ticket', 'write')) {
print dolGetButtonAction('', $langs->trans('CloseTicket'), 'default', $_SERVER["PHP_SELF"].'?action=close&token='.newToken().'&track_id='.$object->track_id, '');
}
// Abandon ticket if status is read
- if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->rights->ticket->write) {
+ if (isset($object->status) && $object->status > 0 && $object->status < Ticket::STATUS_CLOSED && $user->hasRight('ticket', 'write')) {
print dolGetButtonAction('', $langs->trans('AbandonTicket'), 'default', $_SERVER["PHP_SELF"].'?action=abandon&token='.newToken().'&track_id='.$object->track_id, '');
}
@@ -1481,7 +1481,7 @@ if ($action == 'create' || $action == 'presend') {
}
// Delete ticket
- if ($user->rights->ticket->delete && !$user->socid) {
+ if ($user->hasRight('ticket', 'delete') && !$user->socid) {
print dolGetButtonAction('', $langs->trans('Delete'), 'delete', $_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&track_id='.$object->track_id, '');
}
}
diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php
index ecbd3b7a265..c419a512516 100644
--- a/htdocs/ticket/class/actions_ticket.class.php
+++ b/htdocs/ticket/class/actions_ticket.class.php
@@ -189,7 +189,7 @@ class ActionsTicket extends CommonHookActions
global $conf, $langs;
print ''."\n";
- if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
+ if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
// MESSAGE
print '';
}
diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php
index 74368f93910..b15b03ca5be 100644
--- a/htdocs/ticket/class/ticket.class.php
+++ b/htdocs/ticket/class/ticket.class.php
@@ -813,7 +813,7 @@ class Ticket extends CommonObject
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)";
}
}
- if (empty($user->rights->societe->client->voir) && !$user->socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
@@ -839,7 +839,7 @@ class Ticket extends CommonObject
}
}
}
- if (empty($user->rights->societe->client->voir) && !$user->socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
} elseif ($user->socid) {
$sql .= " AND t.fk_soc = ".((int) $user->socid);
@@ -2630,9 +2630,9 @@ class Ticket extends CommonObject
if (empty($sendto)) {
if (!empty($conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL)) {
- $sendto[$conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL;
+ $sendto[getDolGlobalString('TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL')] = $conf->global->TICKET_PUBLIC_NOTIFICATION_NEW_MESSAGE_DEFAULT_EMAIL;
} elseif (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
- $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
+ $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
}
@@ -2640,7 +2640,7 @@ class Ticket extends CommonObject
if (!empty($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS) &&
!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)
) {
- $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
+ $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
if (!empty($sendto)) {
@@ -2743,7 +2743,7 @@ class Ticket extends CommonObject
// Add global email address recipient
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
- $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
+ $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
}
@@ -2814,7 +2814,7 @@ class Ticket extends CommonObject
// If public interface is not enable, use link to internal page into mail
$url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ?
- (!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id;
+ (!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? getDolGlobalString('TICKET_URL_PUBLIC_INTERFACE') . '/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id;
$message .= ' '.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$object->track_id.' ';
// Build final message
@@ -2838,7 +2838,7 @@ class Ticket extends CommonObject
// Add global email address recipient
if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !array_key_exists($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) {
if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) {
- $sendto[$conf->global->TICKET_NOTIFICATION_EMAIL_TO] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
+ $sendto[getDolGlobalString('TICKET_NOTIFICATION_EMAIL_TO')] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO;
}
}
@@ -2989,7 +2989,7 @@ class Ticket extends CommonObject
$sql = "SELECT p.rowid, p.ref, p.datec as datec";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
- if (isModEnabled('societe') && empty($user->rights->societe->client->voir) && !$user->socid) {
+ if (isModEnabled('societe') && !$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = " AND";
@@ -3055,7 +3055,7 @@ class Ticket extends CommonObject
$sql = "SELECT count(p.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid";
- if (empty($user->rights->societe->client->voir) && !$user->socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$user->socid) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc";
$sql .= " WHERE sc.fk_user = ".((int) $user->id);
$clause = "AND";
diff --git a/htdocs/ticket/contact.php b/htdocs/ticket/contact.php
index ba678ae2dca..8d2e2780801 100644
--- a/htdocs/ticket/contact.php
+++ b/htdocs/ticket/contact.php
@@ -72,7 +72,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) {
accessforbidden();
}
@@ -83,7 +83,7 @@ $permissiontoadd = $user->rights->ticket->write;
* Actions
*/
-if ($action == 'addcontact' && $user->rights->ticket->write) {
+if ($action == 'addcontact' && $user->hasRight('ticket', 'write')) {
$result = $object->fetch($id, '', $track_id);
if ($result > 0 && ($id > 0 || (!empty($track_id)))) {
@@ -131,7 +131,7 @@ if ($action == 'addcontact' && $user->rights->ticket->write) {
}
// bascule du statut d'un contact
-if ($action == 'swapstatut' && $user->rights->ticket->write) {
+if ($action == 'swapstatut' && $user->hasRight('ticket', 'write')) {
if ($object->fetch($id, '', $track_id)) {
$result = $object->swapContactStatus($ligne);
} else {
@@ -140,7 +140,7 @@ if ($action == 'swapstatut' && $user->rights->ticket->write) {
}
// Efface un contact
-if ($action == 'deletecontact' && $user->rights->ticket->write) {
+if ($action == 'deletecontact' && $user->hasRight('ticket', 'write')) {
if ($object->fetch($id, '', $track_id)) {
$internal_contacts = $object->listeContact(-1, 'internal', 0, 'SUPPORTTEC');
foreach ($internal_contacts as $key => $contact) {
@@ -162,7 +162,7 @@ if ($action == 'deletecontact' && $user->rights->ticket->write) {
}
// Set parent company
-if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
+if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php
index 23e0b00882c..4154bb9c512 100644
--- a/htdocs/ticket/document.php
+++ b/htdocs/ticket/document.php
@@ -87,7 +87,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id && empty($user->rights->ticket->manage)) {
+if (!$user->socid && !empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id && !$user->hasRight('ticket', 'manage')) {
accessforbidden();
}
@@ -101,7 +101,7 @@ $permissiontoadd = $user->rights->ticket->write; // Used by the include of actio
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
// Set parent company
-if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
+if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php
index 35e11b9f1f5..61e35df8ba8 100644
--- a/htdocs/ticket/index.php
+++ b/htdocs/ticket/index.php
@@ -65,7 +65,7 @@ $object = new Ticket($db);
// Security check
//$result = restrictedArea($user, 'ticket|knowledgemanagement', 0, '', '', '', '');
-if (empty($user->rights->ticket->read) && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
+if (!$user->hasRight('ticket', 'read') && !$user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) {
accessforbidden('Not enought permissions');
}
@@ -156,13 +156,13 @@ $tick = array(
$sql = "SELECT t.fk_statut, COUNT(t.fk_statut) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
-if (empty($user->rights->societe->client->voir) && !$socid) {
+if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ' WHERE t.entity IN ('.getEntity('ticket').')';
$sql .= dolSqlDateFilter('datec', 0, 0, $endyear);
-if (empty($user->rights->societe->client->voir) && !$socid) {
+if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@@ -171,7 +171,7 @@ if ($user->socid > 0) {
$sql .= " AND t.fk_soc= ".((int) $user->socid);
} else {
// For internals users,
- if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) {
+ if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->hasRight('ticket', 'manage')) {
$sql .= " AND t.fk_user_assign = ".((int) $user->id);
}
}
@@ -249,7 +249,7 @@ $stringtoshow .= '';
print '';
print '| '.$langs->trans("Statistics").' '.$endyear.' '.img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"').' | ';
@@ -304,7 +304,7 @@ if (!empty($user->rights->ticket->read)) {
print '';
}
-if (!empty($user->rights->ticket->read)) {
+if ($user->hasRight('ticket', 'read')) {
// Build graphic number of object
$data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
@@ -317,7 +317,7 @@ print ''."\n";
print '';
-if (!empty($user->rights->ticket->read)) {
+if ($user->hasRight('ticket', 'read')) {
/*
* Latest unread tickets
*/
@@ -332,13 +332,13 @@ if (!empty($user->rights->ticket->read)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code";
- if (empty($user->rights->societe->client->voir) && !$socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ' WHERE t.entity IN ('.getEntity('ticket').')';
$sql .= " AND t.fk_statut=0";
- if (empty($user->rights->societe->client->voir) && !$socid) {
+ if (!$user->hasRight('societe', 'client', 'voir') && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@@ -346,7 +346,7 @@ if (!empty($user->rights->ticket->read)) {
$sql .= " AND t.fk_soc= ".((int) $user->socid);
} else {
// Restricted to assigned user only
- if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->rights->ticket->manage) {
+ if (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && !$user->hasRight('ticket', 'manage')) {
$sql .= " AND t.fk_user_assign = ".((int) $user->id);
}
}
diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php
index b661717aaa0..fad412493e4 100644
--- a/htdocs/ticket/list.php
+++ b/htdocs/ticket/list.php
@@ -159,7 +159,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
// Security check
-if (!$user->rights->ticket->read) {
+if (!$user->hasRight('ticket', 'read')) {
accessforbidden();
}
// restrict view to current user's company
@@ -602,7 +602,7 @@ if ($projectid > 0 || $project_ref) {
$morehtmlref .= ' ';
// Define a complementary filter for search of next/prev ref.
- if (empty($user->rights->projet->all->lire)) {
+ if (!$user->hasRight('projet', 'all', 'lire')) {
$objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0);
$object->next_prev_filter = "rowid IN (".$db->sanitize(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")";
}
@@ -763,7 +763,7 @@ if (!empty($socid)) {
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
-$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->rights->ticket->write);
+$newcardbutton .= dolGetButtonTitle($langs->trans('NewTicket'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('ticket', 'write'));
$picto = 'ticket';
if ($socid > 0) {
diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php
index e0926da74f0..8b0edb7cb3a 100644
--- a/htdocs/ticket/messaging.php
+++ b/htdocs/ticket/messaging.php
@@ -96,7 +96,7 @@ if ($user->socid > 0 && ($object->fk_soc != $user->socid)) {
accessforbidden();
}
// or for unauthorized internals users
-if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) {
+if (!$user->socid && (!empty($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) && $object->fk_user_assign != $user->id) && !$user->hasRight('ticket', 'manage')) {
accessforbidden();
}
@@ -125,7 +125,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
}
// Set parent company
-if ($action == 'set_thirdparty' && $user->rights->ticket->write) {
+if ($action == 'set_thirdparty' && $user->hasRight('ticket', 'write')) {
if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) {
$result = $object->setCustomer(GETPOST('editcustomer', 'int'));
$url = $_SERVER["PHP_SELF"].'?track_id='.GETPOST('track_id', 'alpha');
diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php
index afc2a685048..b3646be56f1 100644
--- a/htdocs/ticket/stats/index.php
+++ b/htdocs/ticket/stats/index.php
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
-if (!$user->rights->ticket->read) {
+if (!$user->hasRight('ticket', 'read')) {
accessforbidden();
}
@@ -83,7 +83,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear);
// $data = array(array('Lib',val1,val2,val3),...)
-if (empty($user->rights->societe->client->voir) || $user->socid) {
+if (!$user->hasRight('societe', 'client', 'voir') || $user->socid) {
$filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png';
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png';
} else {
diff --git a/htdocs/ticket/tpl/linkedobjectblock.tpl.php b/htdocs/ticket/tpl/linkedobjectblock.tpl.php
index 4ba36894379..20da40aa358 100644
--- a/htdocs/ticket/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/ticket/tpl/linkedobjectblock.tpl.php
@@ -71,7 +71,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
?>
- 1) {
?>
diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php
index e8dc4e5ece8..82d38eea755 100644
--- a/htdocs/user/agenda_extsites.php
+++ b/htdocs/user/agenda_extsites.php
@@ -71,7 +71,7 @@ $feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user')
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
// If user is not user that read and no permission to read other users, we stop
-if (($object->id != $user->id) && (!$user->rights->user->user->lire)) {
+if (($object->id != $user->id) && (!$user->hasRight('user', 'user', 'lire'))) {
accessforbidden();
}
@@ -171,7 +171,7 @@ print dol_get_fiche_head($head, 'extsites', $langs->trans("User"), -1, 'user');
$linkback = '';
-if ($user->rights->user->user->lire || $user->admin) {
+if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
$linkback = ''.$langs->trans("BackToList").'';
}
@@ -182,7 +182,7 @@ $morehtmlref .= '';
$urltovirtualcard = '/user/virtualcard.php?id='.((int) $object->id);
$morehtmlref .= dolButtonToOpenUrlInDialogPopup('publicvirtualcard', $langs->trans("PublicVirtualCardUrl").' - '.$object->getFullName($langs), img_picto($langs->trans("PublicVirtualCardUrl"), 'card', 'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard, '', 'nohover');
-dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin, 'rowid', 'ref', $morehtmlref);
+dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref);
print '';
diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php
index 2c5ce279be8..61408f562e2 100644
--- a/htdocs/user/bank.php
+++ b/htdocs/user/bank.php
@@ -95,13 +95,13 @@ $ok = false;
if ($user->id == $id) {
$ok = true; // A user can always read its own card
}
-if (!empty($user->rights->salaries->read)) {
+if ($user->hasRight('salaries', 'read')) {
$ok = true;
}
-if (!empty($user->rights->hrm->read)) {
+if ($user->hasRight('hrm', 'read')) {
$ok = true;
}
-if (!empty($user->rights->expensereport->lire) && ($user->id == $object->id || $user->rights->expensereport->readall)) {
+if ($user->hasRight('expensereport', 'lire') && ($user->id == $object->id || $user->hasRight('expensereport', 'readall'))) {
$ok = true;
}
if (!$ok) {
@@ -278,7 +278,7 @@ llxHeader('', $title, $help_url);
$head = user_prepare_head($object);
-if ($id && $bankid && $action == 'edit' && ($user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write)) {
+if ($id && $bankid && $action == 'edit' && ($user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'))) {
if ($conf->use_javascript_ajax) {
print "\n |