29 if (!defined(
'CSRFCHECK_WITH_TOKEN')) {
30 define(
'CSRFCHECK_WITH_TOKEN',
'1');
34 require
'../main.inc.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40 $langs->loadLangs(array(
'users',
'admin'));
43 $action =
GETPOST(
'action',
'aZ09');
44 $confirm =
GETPOST(
'confirm',
'alpha');
45 $module =
GETPOST(
'module',
'alpha');
46 $rights =
GETPOST(
'rights',
'int');
47 $updatedmodulename =
GETPOST(
'updatedmodulename',
'alpha');
48 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userperms';
50 if (!isset($id) || empty($id)) {
55 $canreaduser = ($user->admin || $user->hasRight(
"user",
"user",
"read"));
57 $caneditperms = ($user->admin || $user->hasRight(
"user",
"user",
"write"));
59 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
60 $canreaduser = ($user->admin || ($user->hasRight(
"user",
"user",
"read") && $user->hasRight(
"user",
"user_advance",
"readperms")));
61 $caneditselfperms = ($user->id == $id && $user->hasRight(
"user",
"self_advance",
"writeperms"));
62 $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
67 if (isset($user->socid) && $user->socid > 0) {
68 $socid = $user->socid;
70 $feature2 = (($socid && $user->hasRight(
"user",
"self",
"write")) ?
'' :
'user');
72 if ($user->id == $id && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->hasRight(
"user",
"self_advance",
"readperms") && empty($user->admin))) {
76 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
77 if ($user->id <> $id && !$canreaduser) {
81 $object =
new User($db);
82 $object->fetch($id,
'',
'', 1);
85 $entity = $conf->entity;
88 $hookmanager->initHooks(array(
'usercard',
'userperms',
'globalcard'));
96 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
101 if (empty($reshook)) {
102 if ($action ==
'addrights' && $caneditperms && $confirm ==
'yes') {
103 $edituser =
new User($db);
104 $edituser->fetch($object->id);
105 $result = $edituser->addrights($rights, $module,
'', $entity);
111 if ($object->id == $user->id) {
112 $user->clearrights();
114 $menumanager->loadMenu();
117 $object->clearrights();
118 $object->getrights();
121 if ($action ==
'delrights' && $caneditperms && $confirm ==
'yes') {
122 $edituser =
new User($db);
123 $edituser->fetch($object->id);
124 $result = $edituser->delrights($rights, $module,
'', $entity);
130 if ($object->id == $user->id) {
131 $user->clearrights();
133 $menumanager->loadMenu();
136 $object->clearrights();
137 $object->getrights();
148 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
149 $title = $person_name.
" - ".$langs->trans(
'Permissions');
155 $title = $langs->trans(
"User");
165 foreach ($modulesdir as $dir) {
167 if (is_resource($handle)) {
168 while (($file = readdir($handle)) !==
false) {
169 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
170 $modName = substr($file, 0,
dol_strlen($file) - 10);
173 include_once $dir.$file;
174 $objMod =
new $modName($db);
177 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
178 foreach ($objMod->langfiles as $domain) {
179 $langs->load($domain);
183 if ($objMod->rights_class) {
184 $ret = $objMod->insert_permissions(0, $entity);
185 $modules[$objMod->rights_class] = $objMod;
197 $permsuser = array();
199 $sql =
"SELECT DISTINCT ur.fk_id";
200 $sql .=
" FROM ".MAIN_DB_PREFIX.
"user_rights as ur";
201 $sql .=
" WHERE ur.entity = ".((int) $entity);
202 $sql .=
" AND ur.fk_user = ".((int) $object->id);
205 $result = $db->query(
$sql);
207 $num = $db->num_rows($result);
210 $obj = $db->fetch_object($result);
211 array_push($permsuser, $obj->fk_id);
220 $permsgroupbyentity = array();
222 $sql =
"SELECT DISTINCT gr.fk_id, gu.entity";
223 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup_rights as gr,";
224 $sql .=
" ".MAIN_DB_PREFIX.
"usergroup_user as gu";
225 $sql .=
" WHERE 1 = 1";
227 if (!empty($conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
228 if (
isModEnabled(
'multicompany') && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
229 $sql .=
" AND gu.entity IN (0,".$conf->entity.
")";
234 $sql .=
" AND gr.entity = ".((int) $conf->entity);
238 $sql .=
" AND gu.entity IN (0,".$conf->entity.
")";
242 $sql .=
" AND gr.fk_usergroup = gu.fk_usergroup";
243 $sql .=
" AND gu.fk_user = ".((int) $object->id);
246 $result = $db->query(
$sql);
248 $num = $db->num_rows($result);
251 $obj = $db->fetch_object($result);
252 if (!isset($permsgroupbyentity[$obj->entity])) {
253 $permsgroupbyentity[$obj->entity] = array();
255 array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
271 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
272 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
275 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName($object->getFullName($langs).
'.vcf')).
'" class="refid" rel="noopener">';
276 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
277 $morehtmlref .=
'</a>';
279 $urltovirtualcard =
'/user/virtualcard.php?id='.((int) $object->id);
280 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->trans(
"PublicVirtualCardUrl").
' - '.$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
282 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
285 print
'<div class="fichecenter">';
287 print
'<div class="underbanner clearboth"></div>';
288 print
'<table class="border centpercent tableforfield">';
291 print
'<tr><td id="anchorforperms" class="titlefield">'.$langs->trans(
"Login").
'</td>';
292 if (!empty($object->ldap_sid) && $object->statut == 0) {
293 print
'<td class="error">';
294 print $langs->trans(
"LoginAccountDisableInDolibarr");
299 if (property_exists($object,
'admin')) {
300 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
301 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
302 } elseif (!empty($object->admin)) {
303 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
313 $text = $langs->trans(
"Type");
314 print
$form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
316 $type = $langs->trans(
"Internal");
317 if ($object->socid > 0) {
318 $type = $langs->trans(
"External");
320 print
'<span class="badgeneutral">';
322 if ($object->ldap_sid) {
323 print
' ('.$langs->trans(
"DomainUser").
')';
326 print
'</td></tr>'.
"\n";
334 print
info_admin($langs->trans(
"WarningOnlyPermissionOfActivatedModules"));
337 if (!empty($object->socid)) {
341 $parameters = array(
'permsgroupbyentity'=>$permsgroupbyentity);
342 $reshook = $hookmanager->executeHooks(
'insertExtraHeader',
$parameters, $object, $action);
347 $listofexpandedmodules = array();
351 print
'<div class="div-table-responsive-no-min">';
352 print
'<table class="noborder centpercent">';
354 print
'<tr class="liste_titre">';
355 print
'<td>'.$langs->trans(
"Module").
'</td>';
357 print
'<td class="center nowrap">';
358 print
'<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans(
"All")).
'" alt="'.
dol_escape_htmltag($langs->trans(
"All")).
'" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=addrights&token='.
newToken().
'&entity='.$entity.
'&module=allmodules&confirm=yes">'.$langs->trans(
"All").
"</a>";
360 print
'<a class="reposition commonlink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans(
"None")).
'" alt="'.
dol_escape_htmltag($langs->trans(
"None")).
'" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delrights&token='.
newToken().
'&entity='.$entity.
'&module=allmodules&confirm=yes">'.$langs->trans(
"None").
"</a>";
367 print
'<td class="right nowrap" colspan="2">';
368 print
'<a class="showallperms" title="'.dol_escape_htmltag($langs->trans(
"ShowAllPerms")).
'" alt="'.
dol_escape_htmltag($langs->trans(
"ShowAllPerms")).
'" href="#">'.
img_picto(
'',
'folder-open',
'class="paddingright"').
'<span class="hideonsmartphone">'.$langs->trans(
"ExpandAll").
'</span></a>';
370 print
'<a class="hideallperms" title="'.dol_escape_htmltag($langs->trans(
"HideAllPerms")).
'" alt="'.
dol_escape_htmltag($langs->trans(
"HideAllPerms")).
'" href="#">'.
img_picto(
'',
'folder',
'class="paddingright"').
'<span class="hideonsmartphone">'.$langs->trans(
"UndoExpandAll").
'</span></a>';
377 $sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
378 $sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
379 $sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
380 $sql .=
" AND r.entity = ".((int) $entity);
381 $sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
383 $result = $db->query(
$sql);
385 $num = $db->num_rows($result);
390 $obj = $db->fetch_object($result);
393 if (!isset($obj->module) || empty($modules[$obj->module])) {
401 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
405 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
411 $objMod = $modules[$obj->module];
414 if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $obj->module_position < 100000)) {
415 if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
420 $newmoduleposition = $modules[$obj->module]->module_position;
423 $objMod = $modules[$obj->module];
424 if (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $newmoduleposition < 100000) {
425 $newmoduleposition += 100000;
428 $sqlupdate =
'UPDATE '.MAIN_DB_PREFIX.
"rights_def SET module_position = ".((int) $newmoduleposition).
",";
429 $sqlupdate .=
" family_position = ".((int) $familyposition);
430 $sqlupdate .=
" WHERE module_position = ".((int) $obj->module_position).
" AND module = '".$db->escape($obj->module).
"'";
432 $db->query($sqlupdate);
441 $sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
442 $sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
443 $sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
444 $sql .=
" AND r.entity = ".((int) $entity);
445 if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
446 $sql .=
" AND r.perms NOT LIKE '%_advance'";
448 $sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
450 $result = $db->query(
$sql);
452 $num = $db->num_rows($result);
456 $cookietohidegroup = (empty($_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]) ?
'' : preg_replace(
'/^,/',
'', $_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]));
457 $cookietohidegrouparray = explode(
',', $cookietohidegroup);
461 $obj = $db->fetch_object($result);
464 if (empty($modules[$obj->module])) {
472 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
476 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
482 $objMod = $modules[$obj->module];
510 $ishidden =
GETPOST(
'forbreakperms_'.$obj->module,
'int');
511 } elseif (in_array($j, $cookietohidegrouparray)) {
516 $isexpanded = ! $ishidden;
519 $permsgroupbyentitypluszero = array();
520 if (!empty($permsgroupbyentity[0])) {
521 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
523 if (!empty($permsgroupbyentity[$entity])) {
524 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
529 if (isset($obj->module) && ($oldmod <> $obj->module)) {
530 $oldmod = $obj->module;
534 $ishidden =
GETPOST(
'forbreakperms_'.$obj->module,
'int');
535 } elseif (in_array($j, $cookietohidegrouparray)) {
540 $isexpanded = ! $ishidden;
544 $objMod = $modules[$obj->module];
545 $picto = ($objMod->picto ? $objMod->picto :
'generic');
548 print
'<tr class="oddeven trforbreakperms" data-hide-perms="'.$obj->module.
'" data-j="'.$j.
'">';
550 print
'<td class="maxwidthonsmartphone tdoverflowmax150 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'" title="'.
dol_escape_htmltag($objMod->getName()).
'">';
551 print
'<input type="hidden" name="forbreakperms_'.$obj->module.
'" id="idforbreakperms_'.$obj->module.
'" css="cssforfieldishiden" data-j="'.$j.
'" value="'.($isexpanded ?
'0' :
"1").
'">';
552 print
img_object(
'', $picto,
'class="pictoobjectwidth paddingright"').
' '.$objMod->getName();
553 print
'<a name="'.$objMod->getName().
'"></a>';
556 if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) {
558 print
'<td class="center wraponsmartphone">';
559 print
'<span class="permtohide_'.$obj->module.
'" '.(!$isexpanded ?
' style="display:none"' :
'').
'>';
560 print
'<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans(
"All")).
'" alt="'.
dol_escape_htmltag($langs->trans(
"All")).
'" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=addrights&token='.
newToken().
'&entity='.$entity.
'&module='.$obj->module.
'&confirm=yes&updatedmodulename='.$obj->module.
'">'.$langs->trans(
"All").
"</a>";
562 print
'<a class="reposition alink addexpandedmodulesinparamlist" title="'.dol_escape_htmltag($langs->trans(
"None")).
'" alt="'.
dol_escape_htmltag($langs->trans(
"None")).
'" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delrights&token='.
newToken().
'&entity='.$entity.
'&module='.$obj->module.
'&confirm=yes&updatedmodulename='.$obj->module.
'">'.$langs->trans(
"None").
"</a>";
565 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
568 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
569 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
573 print
'<td class="center wraponsmartphone">';
579 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
582 print
'<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
583 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
587 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
588 print
'<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
589 print
'<div class="switchfolderperms folderperms_'.$obj->module.
'"'.($isexpanded ?
' style="display:none;"' :
'').
'>';
590 print
img_picto(
'',
'folder',
'class="marginright"');
592 print
'<div class="switchfolderperms folderopenperms_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none;"' :
'').
'>';
593 print
img_picto(
'',
'folder-open',
'class="marginright"');
599 print
'<!-- '.$obj->module.
'->'.$obj->perms.($obj->subperms ?
'->'.$obj->subperms :
'').
' -->'.
"\n";
600 print
'<tr class="oddeven trtohide_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none"' :
'').
'>';
603 print
'<td class="maxwidthonsmartphone tdoverflowonsmartphone">';
607 if (!empty($object->admin) && !empty($objMod->rights_admin_allowed)) {
609 print
'<td class="center">'.img_picto($langs->trans(
"Administrator"),
'star').
'</td>';
611 print
'<td> </td>';
613 print
'<td class="center nowrap">';
614 if (!$caneditperms) {
615 print
img_picto($langs->trans(
"Active"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium');
619 } elseif (in_array($obj->id, $permsuser)) {
621 print
'<td class="center">';
622 print
'<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=delrights&token='.
newToken().
'&entity='.$entity.
'&rights='.$obj->id.
'&confirm=yes&updatedmodulename='.$obj->module.
'">';
624 print
img_picto($langs->trans(
"Remove"),
'switch_on');
627 print
'<td> </td>';
629 print
'<td class="center nowrap">';
630 if (!$caneditperms) {
631 print
img_picto($langs->trans(
"Active"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium');
635 } elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
636 if (in_array($obj->id, $permsgroupbyentitypluszero)) {
638 print
'<td class="center">';
639 print
$form->textwithtooltip($langs->trans(
"Inherited"), $langs->trans(
"PermissionInheritedFromAGroup"));
642 print
'<td> </td>';
644 print
'<td class="center nowrap">';
645 print
img_picto($langs->trans(
"Active"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium');
651 print
'<td class="center">';
652 print
'<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=addrights&entity='.$entity.
'&rights='.$obj->id.
'&confirm=yes&token='.
newToken().
'&updatedmodulename='.$obj->module.
'">';
654 print
img_picto($langs->trans(
"Add"),
'switch_off');
661 print
'<td> </td>';
666 print
'<td class="center">';
667 print
'<a class="reposition addexpandedmodulesinparamlist" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$object->id.
'&action=addrights&entity='.$entity.
'&rights='.$obj->id.
'&confirm=yes&token='.
newToken().
'&updatedmodulename='.$obj->module.
'">';
669 print
img_picto($langs->trans(
"Add"),
'switch_off');
672 print
'<td> </td>';
674 print
'<td class="center">';
675 if (!$caneditperms) {
676 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'',
false, 0, 0,
'',
'opacitymedium');
683 $permlabel = (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ($langs->trans(
"PermissionAdvanced".$obj->id) != (
"PermissionAdvanced".$obj->id)) ? $langs->trans(
"PermissionAdvanced".$obj->id) : (($langs->trans(
"Permission".$obj->id) != (
"Permission".$obj->id)) ? $langs->trans(
"Permission".$obj->id) : $langs->trans($obj->label)));
685 print
'<td colspan="2">';
690 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
691 if (preg_match(
'/_advance$/', $obj->perms)) {
692 print
' <span class="opacitymedium">('.$langs->trans(
"AdvancedModeOnly").
')</span>';
699 print
'<td class="right">';
700 $htmltext = $langs->trans(
"ID").
': '.$obj->id;
701 $htmltext .=
'<br>'.$langs->trans(
"Permission").
': user->rights->'.$obj->module.
'->'.$obj->perms.($obj->subperms ?
'->'.$obj->subperms :
'');
702 print
$form->textwithpicto(
'', $htmltext);
718 print
'$(".tdforbreakperms:not(.alink)").on("click", function(){
719 console.log("Click on tdforbreakperms");
720 moduletohide = $(this).data("hide-perms");
721 j = $(this).data("j");
722 if ($("#idforbreakperms_"+moduletohide).val() == 1) {
723 console.log("idforbreakperms_"+moduletohide+" has value hidden=1");
724 $(".trtohide_"+moduletohide).show();
725 $(".permtoshow_"+moduletohide).hide();
726 $(".permtohide_"+moduletohide).show();
727 $(".folderperms_"+moduletohide).hide();
728 $(".folderopenperms_"+moduletohide).show();
729 $("#idforbreakperms_"+moduletohide).val("0");
731 console.log("idforbreakperms_"+moduletohide+" has value hidden=0");
732 $(".trtohide_"+moduletohide).hide();
733 $(".folderopenperms_"+moduletohide).hide();
734 $(".folderperms_"+moduletohide).show();
735 $(".permtoshow_"+moduletohide).show();
736 $(".permtohide_"+moduletohide).hide();
737 $("#idforbreakperms_"+moduletohide).val("1");
740 // Now rebuild the value for cookie
742 $(".trforbreakperms").each(function(index) {
743 //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
744 if ($("input[data-j="+(index+1)+"]").val() == 1) {
745 hideuserperm=hideuserperm+","+(index+1);
749 date = new Date(); date.setTime(date.getTime()+(30*86400000));
751 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
752 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
754 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
755 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
761 print
'$(".showallperms").on("click", function(){
762 console.log("Click on showallperms");
764 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
765 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
766 $(".tdforbreakperms").each( function(){
767 moduletohide = $(this).data("hide-perms");
768 //console.log(moduletohide);
769 if ($("#idforbreakperms_"+moduletohide).val() != 0) {
770 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
775 $(".hideallperms").on("click", function(){
776 console.log("Click on hideallperms");
778 $(".tdforbreakperms").each( function(){
779 moduletohide = $(this).data("hide-perms");
780 //console.log(moduletohide);
781 if ($("#idforbreakperms_"+moduletohide).val() != 1) {
782 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
790 print
'.switchfolderperms{
796 $reshook = $hookmanager->executeHooks(
'insertExtraFooter',
$parameters, $object, $action);
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
showModulesExludedForExternal($modules)
Show array with constants to edit.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Dolibarr users.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dolGetModulesDirs($subdir='')
Return list of modules directories.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.