Fix php8.2 warnings

This commit is contained in:
Laurent Destailleur 2023-10-15 18:41:39 +02:00
parent b8c8e903c2
commit c2bdb3be90
44 changed files with 167 additions and 167 deletions

View file

@ -473,12 +473,12 @@ if (getDolGlobalInt('TAKEPOS_ENABLE_SUMUP')) {
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAffiliate");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="'.$conf->global->TAKEPOS_SUMUP_AFFILIATE.'"></input>';
print '<input type="text" name="TAKEPOS_SUMUP_AFFILIATE" value="' . getDolGlobalString('TAKEPOS_SUMUP_AFFILIATE').'"></input>';
print "</td></tr>\n";
print '<tr class="oddeven"><td>';
print $langs->trans("SumupAppId");
print '<td colspan="2">';
print '<input type="text" name="TAKEPOS_SUMUP_APPID" value="'.$conf->global->TAKEPOS_SUMUP_APPID.'"></input>';
print '<input type="text" name="TAKEPOS_SUMUP_APPID" value="' . getDolGlobalString('TAKEPOS_SUMUP_APPID').'"></input>';
print "</td></tr>\n";
print '</table>';

View file

@ -50,7 +50,7 @@ $id = GETPOST('id', 'int');
$search_start = GETPOST('search_start', 'int');
$search_limit = GETPOST('search_limit', 'int');
if (empty($user->rights->takepos->run)) {
if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}

View file

@ -55,7 +55,7 @@ $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is
$newname = GETPOST('newname', 'alpha');
$mode = GETPOST('mode', 'alpha');
if (empty($user->rights->takepos->run)) {
if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}
@ -119,7 +119,7 @@ if ($action == "add") {
$head = '';
$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');
}
$arrayofcss = array('/takepos/css/pos.css.php?a=xxx');

View file

@ -54,7 +54,7 @@ $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place
$idline = GETPOST('idline', 'int');
$action = GETPOST('action', 'aZ09');
if (empty($user->rights->takepos->run)) {
if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}

View file

@ -125,7 +125,7 @@ if (getDolGlobalInt('TAKEPOS_COLOR_THEME') == 1) {
// Title
$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 = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
<meta name="apple-mobile-web-app-capable" content="yes">
@ -1082,7 +1082,7 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) {
<a class="hideonsmartphone" onclick="FullScreen();" title="<?php echo dol_escape_htmltag($langs->trans("ClickFullScreenEscapeToLeave")); ?>"><span class="fa fa-expand-arrows-alt"></span></a>
<?php }?>
</div>
<?php
<?php
}?>
<div class="login_block_user">
<?php

View file

@ -64,7 +64,7 @@ $mobilepage = GETPOST('mobilepage', 'alpha');
// Terminal is stored into $_SESSION["takeposterminal"];
if (empty($user->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 = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
<meta name="apple-mobile-web-app-capable" content="yes">
@ -1651,7 +1651,7 @@ if ($placeid > 0) {
$htmlforlines .= '<td class="right">'.vatrate($line->remise_percent, true).'</td>';
$htmlforlines .= '<td class="right">';
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";

View file

@ -52,7 +52,7 @@ $invoiceid = GETPOST('invoiceid', 'int');
$hookmanager->initHooks(array('takepospay'));
if (empty($user->rights->takepos->run)) {
if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}

View file

@ -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 = '<meta name="apple-mobile-web-app-title" content="TakePOS"/>
<meta name="apple-mobile-web-app-capable" content="yes">

View file

@ -51,7 +51,7 @@ $facid = GETPOST('facid', 'int');
$action = GETPOST('action', 'aZ09');
if (empty($user->rights->takepos->run)) {
if (!$user->hasRight('takepos', 'run')) {
accessforbidden();
}

View file

@ -129,7 +129,7 @@ if (getDolGlobalString('TAKEPOS_HEADER') || getDolGlobalString($constFreeText))
<?php
print $langs->trans('Date')." ".dol_print_date($object->date, 'day').'<br>';
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)));

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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);

View file

@ -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

View file

@ -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);

View file

@ -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

View file

@ -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');

View file

@ -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 '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">';
// 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 '<tr><td>';
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 '</td><td>';
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 '</td></tr>';
// Creation date
@ -1103,7 +1103,7 @@ if ($action == 'create' || $action == 'presend') {
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">';
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 '</td><td class="right"><a class="editfielda" href="'.$url_page_current.'?track_id='.urlencode($object->track_id).'&set=assign_ticket">'.img_edit($langs->trans('Modify'), '').'</a>';
}
print '</td></tr></table>';
@ -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 '<form method="post" name="ticket" enctype="multipart/form-data" action="'.$url_page_current.'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="assign_user">';
@ -1136,7 +1136,7 @@ if ($action == 'create' || $action == 'presend') {
}
print '</tr></table>';
print '</td><td>';
if ($user->rights->ticket->write && $action == 'progression') {
if ($user->hasRight('ticket', 'write') && $action == 'progression') {
print '<form action="'.$url_page_current.'" method="post">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="track_id" value="'.$track_id.'">';
@ -1204,7 +1204,7 @@ if ($action == 'create' || $action == 'presend') {
print '</table>';
print '</td>';
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 '</td>';
print '<td>';
if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
print '<input type="submit" class="button small" name="btn_update_ticket_prop" value="'.$langs->trans("Modify").'" />';
} 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 ' <a class="editfielda" href="card.php?track_id='.$object->track_id.'&set=properties">'.img_edit($langs->trans('Modify')).'</a>';
}
}
print '</td>';
print '</tr>';
if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
if (GETPOST('set', 'alpha') == 'properties' && $user->hasRight('ticket', 'write')) {
print '<tr>';
// Type
print '<td class="titlefield">';
@ -1311,7 +1311,7 @@ if ($action == 'create' || $action == 'presend') {
// Display navbar with links to change ticket status
print '<!-- navbar with status -->';
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, '');
}
}

View file

@ -189,7 +189,7 @@ class ActionsTicket extends CommonHookActions
global $conf, $langs;
print '<!-- initial message of ticket -->'."\n";
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
// MESSAGE
print '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
@ -240,7 +240,7 @@ class ActionsTicket extends CommonHookActions
//print '<div>' . $object->message . '</div>';
}
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
print '<div class="center">';
print ' <input type="submit" class="button button-edit" value="'.$langs->trans('Modify').'">';
print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -251,7 +251,7 @@ class ActionsTicket extends CommonHookActions
print '</table>';
print '</div>';
if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') {
if ($user->hasRight('ticket', 'manage') && $action == 'edit_message_init') {
// MESSAGE
print '</form>';
}

View file

@ -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 .= '<br>'.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : <a href="'.$url_public_ticket.'">'.$object->track_id.'</a><br>';
// 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";

View file

@ -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');

View file

@ -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');

View file

@ -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 .= '<input type="image" alt="'.$langs->trans("Refresh").'" src="'.
$stringtoshow .= '</form>';
$stringtoshow .= '</div>';
if (!empty($user->rights->ticket->read)) {
if ($user->hasRight('ticket', 'read')) {
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre"><th >'.$langs->trans("Statistics").' '.$endyear.' '.img_picto('', 'filter.png', 'id="idsubimgDOLUSERCOOKIE_ticket_by_status" class="linkobject"').'</th></tr>';
@ -304,7 +304,7 @@ if (!empty($user->rights->ticket->read)) {
print '</div>';
}
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 '</div>'."\n";
print '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
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);
}
}

View file

@ -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 .= '</div>';
// 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) {

View file

@ -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');

View file

@ -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 {

View file

@ -71,7 +71,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
?>
</td>
</tr>
<?php
<?php
}
if (count($linkedObjectBlock) > 1) {
?>

View file

@ -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 = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -182,7 +182,7 @@ $morehtmlref .= '</a>';
$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 '<div class="fichecenter">';

View file

@ -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<script>";
print 'jQuery(document).ready(function () {
@ -328,7 +328,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -339,7 +339,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
$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 '<div class="fichecenter"><div class="fichehalfleft">';
@ -431,8 +431,8 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
// Sensitive salary/value information
if ((empty($user->socid) && in_array($id, $childids)) // A user can always see salary/value information for its subordinates
|| (isModEnabled('salaries') && !empty($user->rights->salaries->readall))
|| (isModEnabled('hrm') && !empty($user->rights->hrm->employee->read))) {
|| (isModEnabled('salaries') && $user->hasRight('salaries', 'readall'))
|| (isModEnabled('hrm') && $user->hasRight('hrm', 'employee', 'read'))) {
$langs->load("salaries");
// Salary
@ -492,9 +492,9 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) {
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write);
print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'));
print '</td><td>';
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'email', '', null, null, '', 0, '');
print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'), 'email', '', null, null, '', 0, '');
print '</td>';
print '</tr>';
}
@ -503,9 +503,9 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
if ($user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write')) {
print '<tr class="nowrap">';
print '<td>';
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write);
print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'));
print '</td><td>';
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->rights->hrm->write_personal_information->write, 'phone', '', null, null, '', 0, '');
print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->hasRight('user', 'user', 'creer') || $user->hasRight('hrm', 'write_personal_information', 'write'), 'phone', '', null, null, '', 0, '');
print '</td>';
print '</tr>';
}
@ -600,7 +600,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
// Latest payments of salaries
if (isModEnabled('salaries') &&
(($user->rights->salaries->read && (in_array($object->id, $childids) || $object->id == $user->id)) || (!empty($user->rights->salaries->readall)))
(($user->hasRight('salaries', 'read') && (in_array($object->id, $childids) || $object->id == $user->id)) || ($user->hasRight('salaries', 'readall')))
) {
$payment_salary = new PaymentSalary($db);
$salary = new Salary($db);
@ -665,7 +665,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
}
// Latest leave requests
if (isModEnabled('holiday') && ($user->rights->holiday->readall || ($user->rights->holiday->read && $object->id == $user->id))) {
if (isModEnabled('holiday') && ($user->hasRight('holiday', 'readall') || ($user->hasRight('holiday', 'read') && $object->id == $user->id))) {
$holiday = new Holiday($db);
$sql = "SELECT h.rowid, h.statut as status, h.fk_type, h.date_debut, h.date_fin, h.halfday";
@ -722,7 +722,7 @@ if ($action != 'edit' && $action != 'create') { // If not bank account yet, $ac
// Latest expense report
if (isModEnabled('expensereport') &&
($user->rights->expensereport->readall || ($user->rights->expensereport->lire && $object->id == $user->id))
($user->hasRight('expensereport', 'readall') || ($user->hasRight('expensereport', 'lire') && $object->id == $user->id))
) {
$exp = new ExpenseReport($db);
@ -896,7 +896,7 @@ if ($id && ($action == 'edit' || $action == 'create') && $user->hasRight('user',
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin);
//print '<div class="fichecenter">';

View file

@ -734,17 +734,17 @@ if (empty($reshook)) {
if (is_array($ldapusers)) {
foreach ($ldapusers as $key => $attribute) {
$ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME];
$ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME];
$ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN];
$ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA];
$ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD];
$ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED];
$ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE];
$ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX];
$ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE];
$ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL];
$ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
$ldap_lastname = $attribute[getDolGlobalString('LDAP_FIELD_NAME')];
$ldap_firstname = $attribute[getDolGlobalString('LDAP_FIELD_FIRSTNAME')];
$ldap_login = $attribute[getDolGlobalString('LDAP_FIELD_LOGIN')];
$ldap_loginsmb = $attribute[getDolGlobalString('LDAP_FIELD_LOGIN_SAMBA')];
$ldap_pass = $attribute[getDolGlobalString('LDAP_FIELD_PASSWORD')];
$ldap_pass_crypted = $attribute[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')];
$ldap_phone = $attribute[getDolGlobalString('LDAP_FIELD_PHONE')];
$ldap_fax = $attribute[getDolGlobalString('LDAP_FIELD_FAX')];
$ldap_mobile = $attribute[getDolGlobalString('LDAP_FIELD_MOBILE')];
$ldap_mail = $attribute[getDolGlobalString('LDAP_FIELD_MAIL')];
$ldap_sid = $attribute[getDolGlobalString('LDAP_FIELD_SID')];
if (isModEnabled('socialnetworks')) {
$arrayofsocialnetworks = array('skype', 'twitter', 'facebook', 'linkedin');
@ -1420,7 +1420,7 @@ if ($action == 'create' || $action == 'adduserldap') {
$ldap = new Ldap();
$result = $ldap->connect_bind();
if ($result > 0) {
$userSearchFilter = '('.$conf->global->LDAP_FILTER_CONNECTION.'('.$ldap->getUserIdentifier().'='.$object->login.'))';
$userSearchFilter = '(' . getDolGlobalString('LDAP_FILTER_CONNECTION').'('.$ldap->getUserIdentifier().'='.$object->login.'))';
$entries = $ldap->fetch($object->login, $userSearchFilter);
if (!$entries) {
setEventMessages($ldap->error, $ldap->errors, 'errors');

View file

@ -3009,7 +3009,7 @@ class User extends CommonObject
$linkend = '</a>';
//Check user's rights to see an other user
if ((!$user->rights->user->user->lire && $this->id != $user->id)) {
if ((!$user->hasRight('user', 'user', 'lire') && $this->id != $user->id)) {
$option = 'nolink';
}
@ -3172,11 +3172,11 @@ class User extends CommonObject
global $conf;
$dn = '';
if ($mode == 0) {
$dn = $conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN;
$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')]."," . getDolGlobalString('LDAP_USER_DN');
} elseif ($mode == 1) {
$dn = $conf->global->LDAP_USER_DN;
} elseif ($mode == 2) {
$dn = $conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS];
$dn = getDolGlobalString('LDAP_KEY_USERS') . "=".$info[getDolGlobalString('LDAP_KEY_USERS')];
}
return $dn;
}
@ -3237,22 +3237,22 @@ class User extends CommonObject
}
}
if ($this->address && !empty($conf->global->LDAP_FIELD_ADDRESS)) {
$info[$conf->global->LDAP_FIELD_ADDRESS] = $this->address;
$info[getDolGlobalString('LDAP_FIELD_ADDRESS')] = $this->address;
}
if ($this->zip && !empty($conf->global->LDAP_FIELD_ZIP)) {
$info[$conf->global->LDAP_FIELD_ZIP] = $this->zip;
$info[getDolGlobalString('LDAP_FIELD_ZIP')] = $this->zip;
}
if ($this->town && !empty($conf->global->LDAP_FIELD_TOWN)) {
$info[$conf->global->LDAP_FIELD_TOWN] = $this->town;
$info[getDolGlobalString('LDAP_FIELD_TOWN')] = $this->town;
}
if ($this->note_public && !empty($conf->global->LDAP_FIELD_DESCRIPTION)) {
$info[$conf->global->LDAP_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note_public, 2);
$info[getDolGlobalString('LDAP_FIELD_DESCRIPTION')] = dol_string_nohtmltag($this->note_public, 2);
}
if ($this->socid > 0) {
$soc = new Societe($this->db);
$soc->fetch($this->socid);
$info[$conf->global->LDAP_FIELD_COMPANY] = $soc->name;
$info[getDolGlobalString('LDAP_FIELD_COMPANY')] = $soc->name;
if ($soc->client == 1) {
$info["businessCategory"] = "Customers";
}
@ -3267,10 +3267,10 @@ class User extends CommonObject
// When password is modified
if (!empty($this->pass)) {
if (!empty($conf->global->LDAP_FIELD_PASSWORD)) {
$info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
$info[getDolGlobalString('LDAP_FIELD_PASSWORD')] = $this->pass; // this->pass = mot de passe non crypte
}
if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
$info[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')] = dol_hash($this->pass, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
}
} elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') {
// Set LDAP password if possible
@ -3279,16 +3279,16 @@ class User extends CommonObject
// Just for the default MD5 !
if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) {
if ($this->pass_indatabase_crypted && !empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dolGetLdapPasswordHash($this->pass_indatabase_crypted, 'md5frommd5'); // Create OpenLDAP MD5 password from Dolibarr MD5 password
$info[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')] = dolGetLdapPasswordHash($this->pass_indatabase_crypted, 'md5frommd5'); // Create OpenLDAP MD5 password from Dolibarr MD5 password
}
}
} elseif (!empty($this->pass_indatabase)) {
// Use $this->pass_indatabase value if exists
if (!empty($conf->global->LDAP_FIELD_PASSWORD)) {
$info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
$info[getDolGlobalString('LDAP_FIELD_PASSWORD')] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte
}
if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) {
$info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
$info[getDolGlobalString('LDAP_FIELD_PASSWORD_CRYPTED')] = dol_hash($this->pass_indatabase, 'openldap'); // Create OpenLDAP password (see LDAP_PASSWORD_HASH_TYPE)
}
}
}
@ -3321,21 +3321,21 @@ class User extends CommonObject
}
if (!empty($conf->global->LDAP_FIELD_USERID)) {
$info[$conf->global->LDAP_FIELD_USERID] = $this->id;
$info[getDolGlobalString('LDAP_FIELD_USERID')] = $this->id;
}
if (!empty($conf->global->LDAP_FIELD_GROUPID)) {
$usergroup = new UserGroup($this->db);
$groupslist = $usergroup->listGroupsForUser($this->id);
$info[$conf->global->LDAP_FIELD_GROUPID] = '65534';
$info[getDolGlobalString('LDAP_FIELD_GROUPID')] = '65534';
if (!empty($groupslist)) {
foreach ($groupslist as $groupforuser) {
$info[$conf->global->LDAP_FIELD_GROUPID] = $groupforuser->id; //Select first group in list
$info[getDolGlobalString('LDAP_FIELD_GROUPID')] = $groupforuser->id; //Select first group in list
break;
}
}
}
if (!empty($conf->global->LDAP_FIELD_HOMEDIRECTORY) && !empty($conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX)) {
$info[$conf->global->LDAP_FIELD_HOMEDIRECTORY] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login";
$info[getDolGlobalString('LDAP_FIELD_HOMEDIRECTORY')] = "{$conf->global->LDAP_FIELD_HOMEDIRECTORYPREFIX}/$this->login";
}
return $info;

View file

@ -895,13 +895,13 @@ class UserGroup extends CommonObject
global $conf;
$dn = '';
if ($mode == 0) {
$dn = $conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_GROUP_DN;
$dn = getDolGlobalString('LDAP_KEY_GROUPS') . "=".$info[getDolGlobalString('LDAP_KEY_GROUPS')]."," . getDolGlobalString('LDAP_GROUP_DN');
}
if ($mode == 1) {
$dn = $conf->global->LDAP_GROUP_DN;
}
if ($mode == 2) {
$dn = $conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS];
$dn = getDolGlobalString('LDAP_KEY_GROUPS') . "=".$info[getDolGlobalString('LDAP_KEY_GROUPS')];
}
return $dn;
}
@ -926,11 +926,11 @@ class UserGroup extends CommonObject
// Champs
if ($this->name && !empty($conf->global->LDAP_GROUP_FIELD_FULLNAME)) {
$info[$conf->global->LDAP_GROUP_FIELD_FULLNAME] = $this->name;
$info[getDolGlobalString('LDAP_GROUP_FIELD_FULLNAME')] = $this->name;
}
//if ($this->name && !empty($conf->global->LDAP_GROUP_FIELD_NAME)) $info[$conf->global->LDAP_GROUP_FIELD_NAME] = $this->name;
if ($this->note && !empty($conf->global->LDAP_GROUP_FIELD_DESCRIPTION)) {
$info[$conf->global->LDAP_GROUP_FIELD_DESCRIPTION] = dol_string_nohtmltag($this->note, 2);
$info[getDolGlobalString('LDAP_GROUP_FIELD_DESCRIPTION')] = dol_string_nohtmltag($this->note, 2);
}
if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)) {
$valueofldapfield = array();
@ -940,10 +940,10 @@ class UserGroup extends CommonObject
$info2 = $muser->_load_ldap_info();
$valueofldapfield[] = $muser->_load_ldap_dn($info2);
}
$info[$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS] = (!empty($valueofldapfield) ? $valueofldapfield : '');
$info[getDolGlobalString('LDAP_GROUP_FIELD_GROUPMEMBERS')] = (!empty($valueofldapfield) ? $valueofldapfield : '');
}
if (!empty($conf->global->LDAP_GROUP_FIELD_GROUPID)) {
$info[$conf->global->LDAP_GROUP_FIELD_GROUPID] = $this->id;
$info[getDolGlobalString('LDAP_GROUP_FIELD_GROUPID')] = $this->id;
}
return $info;
}

View file

@ -102,7 +102,7 @@ if ($id > 0) {
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -113,7 +113,7 @@ if ($id > 0) {
$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 '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
@ -130,7 +130,7 @@ if ($id > 0) {
$langs->load("errors");
print '<span class="error">'.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).'</span>';
} else {
print '<br>'.$form->textwithpicto('<span class="opacitymedium">'.$langs->trans("KeepEmptyToUseDefault").'</span>:<br>'.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc"));
print '<br>'.$form->textwithpicto('<span class="opacitymedium">'.$langs->trans("KeepEmptyToUseDefault").'</span>:<br>' . getDolGlobalString('CLICKTODIAL_URL'), $langs->trans("ClickToDialUrlDesc"));
}
print '</td>';
print '</tr>';

View file

@ -103,7 +103,7 @@ print dol_get_fiche_head($head, 'ldap', $langs->trans("Group"), -1, 'group');
$linkback = '<a href="'.DOL_URL_ROOT.'/user/group/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, (!empty($user->rights->user->user->lire) || !empty($user->admin)));
dol_banner_tab($object, 'id', $linkback, ($user->hasRight('user', 'user', 'lire') || !empty($user->admin)));
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View file

@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userhome'; // To manage different context of search
if (!$user->rights->user->user->lire && !$user->admin) {
if (!$user->hasRight('user', 'user', 'lire') && !$user->admin) {
// Redirection vers la page de l'utilisateur
header("Location: card.php?id=".$user->id);
exit;

View file

@ -55,7 +55,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) && empty($user->rights->user->user->lire)) {
if (($object->id != $user->id) && !$user->hasRight('user', 'user', 'lire')) {
accessforbidden();
}
@ -80,7 +80,7 @@ print dol_get_fiche_head($head, 'info', $title, -1, 'user');
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
@ -91,7 +91,7 @@ $morehtmlref .= '</a>';
$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);
$object->info($id); // This overwrite ->ref with login instead of id

View file

@ -102,11 +102,11 @@ print dol_get_fiche_head($head, 'ldap', $title, -1, 'user');
$linkback = '';
if (!empty($user->rights->user->user->lire) || !empty($user->admin)) {
if ($user->hasRight('user', 'user', 'lire') || !empty($user->admin)) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}
dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View file

@ -166,7 +166,7 @@ if ($result > 0) {
$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, '', 0, '', '', 0, '');
dol_banner_tab($object, 'id', $linkback, $user->hasRight('user', 'user', 'lire') || $user->admin, 'rowid', 'ref', $morehtmlref, '', 0, '', '', 0, '');
print '<div class="fichecenter">';

View file

@ -342,7 +342,7 @@ if ($action == 'edit') {
print '<td>';
$s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
print $s ? $s.' ' : '';
print (getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
print (getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
print '</td>';
print '<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "");
print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
@ -378,7 +378,7 @@ if ($action == 'edit') {
// Max size of lists
print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
print '<td>' . getDolGlobalString('MAIN_SIZE_LISTE_LIMIT').'</td>';
print '<td class="nowrap" width="20%"><input class="oddeven" name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "");
print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
print '> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
@ -447,7 +447,7 @@ if ($action == 'edit') {
print '<td>';
$s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
print ($s ? $s.' ' : '');
print (getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
print (getDolGlobalString('MAIN_LANG_DEFAULT') == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_" . getDolGlobalString('MAIN_LANG_DEFAULT')));
print '</td>';
print '<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
print '<td>';

View file

@ -57,7 +57,7 @@ $feature2 = (($socid && $user->hasRight('user', 'self', 'creer')) ? '' : 'user')
$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
// If user is not the user that read and has no permission to read other users, we stop
if (($object->id != $user->id) && empty($user->rights->user->user->lire)) {
if (($object->id != $user->id) && !$user->hasRight('user', 'user', 'lire')) {
accessforbidden();
}
@ -111,7 +111,7 @@ $title = $langs->trans("User");
$linkback = '';
if ($user->rights->user->user->lire || $user->admin) {
if ($user->hasRight('user', 'user', 'lire') || $user->admin) {
$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
}

View file

@ -815,7 +815,7 @@ class ProductCombination
if ($forced_refvar === false) {
if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR.$prodattrval->ref;
$newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR') . $prodattrval->ref;
} else {
$newproduct->ref .= '_'.$prodattrval->ref;
}

View file

@ -406,7 +406,7 @@ llxHeader("", $title);
if (!empty($id) || !empty($ref)) {
$showbarcode = isModEnabled('barcode');
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight('barcode', 'lire_advance')) {
$showbarcode = 0;
}