31if (!defined(
'CSRFCHECK_WITH_TOKEN')) {
32 define(
'CSRFCHECK_WITH_TOKEN',
'1');
36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
42$langs->loadLangs(array(
'users',
'admin'));
45$action =
GETPOST(
'action',
'aZ09');
46$confirm =
GETPOST(
'confirm',
'alpha');
47$module =
GETPOST(
'module',
'alpha');
49$updatedmodulename =
GETPOST(
'updatedmodulename',
'alpha');
50$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userperms';
52if (!isset($id) || empty($id)) {
57$canreaduser = ($user->admin || $user->hasRight(
"user",
"user",
"read"));
59$caneditperms = ($user->admin || $user->hasRight(
"user",
"user",
"write"));
62 $canreaduser = ($user->admin || ($user->hasRight(
"user",
"user",
"read") && $user->hasRight(
"user",
"user_advance",
"readperms")));
63 $caneditselfperms = ($user->id ==
$id && $user->hasRight(
"user",
"self_advance",
"writeperms"));
64 $caneditperms = (($caneditperms || $caneditselfperms) ? 1 : 0);
69if (isset($user->socid) && $user->socid > 0) {
70 $socid = $user->socid;
72$feature2 = (($socid && $user->hasRight(
"user",
"self",
"write")) ?
'' :
'user');
74if ($user->id == $id && (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && !$user->hasRight(
"user",
"self_advance",
"readperms") && empty($user->admin))) {
79$hookmanager->initHooks(array(
'usercard',
'userperms',
'globalcard'));
81$result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
82if ($user->id != $id && !$canreaduser) {
90$entity = $conf->entity;
96$parameters = array(
'socid' => $socid);
97$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
102if (empty($reshook)) {
103 if ($action ==
'addrights' && $caneditperms && $confirm ==
'yes') {
104 $edituser =
new User($db);
106 $result = $edituser->addrights($rights, $module,
'', $entity);
112 if (
$object->id == $user->id) {
113 $user->clearrights();
116 $menumanager->loadMenu();
123 if ($action ==
'delrights' && $caneditperms && $confirm ==
'yes') {
124 $edituser =
new User($db);
126 $result = $edituser->delrights($rights, $module,
'', $entity);
132 if (
$object->id == $user->id) {
133 $user->clearrights();
136 $menumanager->loadMenu();
149$form =
new Form($db);
152$title = $person_name.
" - ".$langs->trans(
'Permissions');
154llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card_perms');
158$title = $langs->trans(
"User");
168foreach ($modulesdir as $dir) {
170 if (is_resource($handle)) {
171 while (($file = readdir($handle)) !==
false) {
172 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
173 $modName = substr($file, 0,
dol_strlen($file) - 10);
176 include_once $dir.$file;
177 $objMod =
new $modName($db);
178 '@phan-var-force DolibarrModules $objMod';
181 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
182 foreach ($objMod->langfiles as $domain) {
183 $langs->load($domain);
187 if ($objMod->rights_class) {
188 $ret = $objMod->insert_permissions(0, $entity);
189 $modules[$objMod->rights_class] = $objMod;
200'@phan-var-force DolibarrModules[] $modules';
205$sql =
"SELECT DISTINCT ur.fk_id";
206$sql .=
" FROM ".MAIN_DB_PREFIX.
"user_rights as ur";
207$sql .=
" WHERE ur.entity = ".((int) $entity);
208$sql .=
" AND ur.fk_user = ".((int)
$object->id);
211$result = $db->query($sql);
213 $num = $db->num_rows($result);
216 $obj = $db->fetch_object($result);
217 array_push($permsuser, $obj->fk_id);
226$permsgroupbyentity = array();
228$sql =
"SELECT DISTINCT gr.fk_id, gu.entity";
229$sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup_rights as gr,";
230$sql .=
" ".MAIN_DB_PREFIX.
"usergroup_user as gu";
231$sql .=
" WHERE gr.entity = ".((int) $entity);
235$sql .=
" AND gu.entity IN (0,".$conf->entity.
")";
236$sql .=
" AND gr.fk_usergroup = gu.fk_usergroup";
237$sql .=
" AND gu.fk_user = ".((int)
$object->id);
240$result = $db->query($sql);
242 $num = $db->num_rows($result);
245 $obj = $db->fetch_object($result);
246 if (!isset($permsgroupbyentity[$obj->entity])) {
247 $permsgroupbyentity[$obj->entity] = array();
249 array_push($permsgroupbyentity[$obj->entity], $obj->fk_id);
265if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
266 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
269$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">';
270$morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
271$morehtmlref .=
'</a>';
273$urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
274$morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
276dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
279print
'<div class="fichecenter">';
281print
'<div class="underbanner clearboth"></div>';
282print
'<table class="border centpercent tableforfield">';
285print
'<tr><td id="anchorforperms" class="titlefield">'.$langs->trans(
"Login").
'</td>';
287 print
'<td class="error">';
288 print $langs->trans(
"LoginAccountDisableInDolibarr");
293 if (property_exists(
$object,
'admin')) {
294 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
295 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
296 } elseif (!empty(
$object->admin)) {
297 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
307$text = $langs->trans(
"Type");
308print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
310$type = $langs->trans(
"Internal");
312 $type = $langs->trans(
"External");
314print
'<span class="badgeneutral">';
317 print
' ('.$langs->trans(
"DomainUser").
')';
320print
'</td></tr>'.
"\n";
328 print
info_admin($langs->trans(
"WarningOnlyPermissionOfActivatedModules"));
335$parameters = array(
'permsgroupbyentity' => $permsgroupbyentity);
336$reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
341$listofexpandedmodules = array();
345print
'<div class="div-table-responsive-no-min">';
346print
'<table class="noborder centpercent">';
348print
'<tr class="liste_titre">';
349print
'<td>'.$langs->trans(
"Module").
'</td>';
351 print
'<td class="center nowrap">';
352 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>";
354 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>";
361print
'<td class="right nowrap" colspan="2">';
362print
'<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>';
364print
'<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>';
371$sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
372$sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
373$sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
374$sql .=
" AND r.entity = ".((int) $entity);
375$sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
377$result = $db->query($sql);
379 $num = $db->num_rows($result);
384 $obj = $db->fetch_object($result);
387 if (!isset($obj->module) || empty($modules[$obj->module])) {
393 if (isModEnabled(
"reception")) {
395 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
399 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
405 $objMod = $modules[$obj->module];
408 if (empty($obj->module_position) || (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $obj->module_position < 100000)) {
409 if (is_object($modules[$obj->module]) && ($modules[$obj->module]->module_position > 0)) {
414 $newmoduleposition = $modules[$obj->module]->module_position;
417 $objMod = $modules[$obj->module];
418 if (is_object($objMod) && $objMod->isCoreOrExternalModule() ==
'external' && $newmoduleposition < 100000) {
419 $newmoduleposition += 100000;
422 $sqlupdate =
'UPDATE '.MAIN_DB_PREFIX.
"rights_def SET module_position = ".((int) $newmoduleposition).
",";
423 $sqlupdate .=
" family_position = ".((int) $familyposition);
424 $sqlupdate .=
" WHERE module_position = ".((int) $obj->module_position).
" AND module = '".$db->escape($obj->module).
"'";
426 $db->query($sqlupdate);
435$sql =
"SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
436$sql .=
" FROM ".MAIN_DB_PREFIX.
"rights_def as r";
437$sql .=
" WHERE r.libelle NOT LIKE 'tou%'";
438$sql .=
" AND r.entity = ".((int) $entity);
440 $sql .=
" AND r.perms NOT LIKE '%_advance'";
442$sql .=
" ORDER BY r.family_position, r.module_position, r.module, r.id";
444$result = $db->query($sql);
446 $num = $db->num_rows($result);
451 $cookietohidegroup = (empty($_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]) ?
'' : preg_replace(
'/^,/',
'', $_COOKIE[
"DOLUSER_PERMS_HIDE_GRP"]));
452 $cookietohidegrouparray = explode(
',', $cookietohidegroup);
456 $obj = $db->fetch_object($result);
459 if (empty($modules[$obj->module])) {
465 if (isModEnabled(
"reception")) {
467 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande' && $obj->subperms ==
'receptionner') {
471 if ($obj->module ==
'fournisseur' && $obj->perms ==
'commande_advance' && $obj->subperms ==
'check') {
477 $objMod = $modules[$obj->module];
504 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
505 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
506 } elseif (in_array($j, $cookietohidegrouparray)) {
511 $isexpanded = ! $ishidden;
514 $permsgroupbyentitypluszero = array();
515 if (!empty($permsgroupbyentity[0])) {
516 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[0]);
518 if (!empty($permsgroupbyentity[$entity])) {
519 $permsgroupbyentitypluszero = array_merge($permsgroupbyentitypluszero, $permsgroupbyentity[$entity]);
524 if (isset($obj->module) && ($oldmod != $obj->module)) {
525 $oldmod = $obj->module;
528 if (GETPOSTISSET(
'forbreakperms_'.$obj->module)) {
529 $ishidden =
GETPOSTINT(
'forbreakperms_'.$obj->module);
530 } elseif (in_array($j, $cookietohidegrouparray)) {
535 $isexpanded = ! $ishidden;
539 $objMod = $modules[$obj->module];
540 $picto = ($objMod->picto ? $objMod->picto :
'generic');
543 print
'<tr class="oddeven trforbreakperms" data-hide-perms="'.$obj->module.
'" data-j="'.$j.
'">';
545 print
'<td class="maxwidthonsmartphone tdoverflowmax150 tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'" title="'.
dol_escape_htmltag($objMod->getName()).
'">';
546 print
'<input type="hidden" name="forbreakperms_'.$obj->module.
'" id="idforbreakperms_'.$obj->module.
'" css="cssforfieldishiden" data-j="'.$j.
'" value="'.($isexpanded ?
'0' :
"1").
'">';
547 print
img_object(
'', $picto,
'class="pictoobjectwidth paddingright"').
' '.$objMod->getName();
548 print
'<a name="'.$objMod->getName().
'"></a>';
551 if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty(
$object->admin)) {
553 print
'<td class="center wraponsmartphone">';
554 print
'<span class="permtohide_'.$obj->module.
'" '.(!$isexpanded ?
' style="display:none"' :
'').
'>';
555 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>";
557 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>";
560 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
563 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
564 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
568 print
'<td class="center wraponsmartphone">';
574 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
577 print
'<td class="right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"></td>';
578 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
582 print
'<td class="tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'"> </td>';
583 print
'<td class="maxwidthonsmartphone right tdforbreakperms" data-hide-perms="'.dol_escape_htmltag($obj->module).
'">';
584 print
'<div class="switchfolderperms folderperms_'.$obj->module.
'"'.($isexpanded ?
' style="display:none;"' :
'').
'>';
585 print
img_picto(
'',
'folder',
'class="marginright"');
587 print
'<div class="switchfolderperms folderopenperms_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none;"' :
'').
'>';
588 print
img_picto(
'',
'folder-open',
'class="marginright"');
594 print
'<!-- '.$obj->module.
'->'.$obj->perms.($obj->subperms ?
'->'.$obj->subperms :
'').
' -->'.
"\n";
595 print
'<tr class="oddeven trtohide_'.$obj->module.
'"'.(!$isexpanded ?
' style="display:none"' :
'').
'>';
598 print
'<td class="maxwidthonsmartphone tdoverflowmax200">';
602 if (!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) {
603 print
'<!-- perm is a perm allowed to any admin -->';
605 print
'<td class="center">'.img_picto($langs->trans(
"AdministratorDesc"),
'star').
'</td>';
607 print
'<td class="center nowrap">';
608 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
613 } elseif (in_array($obj->id, $permsuser)) {
614 print
'<!-- user has perm -->';
616 print
'<td class="center">';
617 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.
'">';
619 print
img_picto($langs->trans(
"Remove"),
'switch_on');
622 print
'<td class="center nowrap">';
623 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
628 } elseif (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero)) {
629 print
'<!-- permsgroupbyentitypluszero -->';
630 if (in_array($obj->id, $permsgroupbyentitypluszero)) {
631 print
'<td class="center nowrap">';
632 print
img_picto($langs->trans(
"Active"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium');
636 print $form->textwithtooltip($langs->trans(
"Inherited"), $langs->trans(
"PermissionInheritedFromAGroup"));
641 print
'<td class="center nowrap">';
642 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.
'">';
644 print
img_picto($langs->trans(
"Add"),
'switch_off');
647 print
'<td class="center nowrap">';
648 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
656 print
'<!-- do not own permission -->';
658 print
'<td class="center">';
659 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.
'">';
661 print
img_picto($langs->trans(
"Add"),
'switch_off');
665 print
img_picto($langs->trans(
"Disabled"),
'switch_off',
'', 0, 0, 0,
'',
'opacitymedium');
668 print
'<td class="center">';
673 $permlabel = (
getDolGlobalString(
'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)));
675 print
'<td colspan="2">';
681 if (in_array($idtouse, array(121, 122, 125, 126))) {
684 if ($langs->trans(
"Permission".$idtouse.
'b') !=
"Permission".$idtouse.
'b') {
685 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$idtouse.
'b').
'</span>';
687 if ($langs->trans(
"Permission".$obj->id.
'c') !=
"Permission".$obj->id.
'c') {
688 print
'<br><span class="opacitymedium">'.$langs->trans(
"Permission".$obj->id.
'c').
'</span>';
691 if (preg_match(
'/_advance$/', $obj->perms)) {
692 print
' <span class="opacitymedium">('.$langs->trans(
"AdvancedModeOnly").
')</span>';
696 if ($obj->module ==
'user' && $obj->perms ==
'user' && $obj->subperms ==
'password') {
697 if ((!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) ||
698 in_array($obj->id, $permsuser) ||
699 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
700 print
' '.img_warning($langs->trans(
"AllowPasswordResetBySendingANewPassByEmail"));
704 if ($obj->module ==
'user' && $obj->perms ==
'user' && ($obj->subperms ==
'creer' || $obj->subperms ==
'create')) {
705 if ((!empty(
$object->admin) && !empty($objMod->rights_admin_allowed)) ||
706 in_array($obj->id, $permsuser) ||
707 (isset($permsgroupbyentitypluszero) && is_array($permsgroupbyentitypluszero) && in_array($obj->id, $permsgroupbyentitypluszero))) {
708 print
' '.img_warning($langs->trans(
"AllowAnyPrivileges"));
712 if ($obj->module ==
'banque' && $obj->perms ==
'lire') {
713 if (isModEnabled(
"accounting") &&
$object->hasRight(
'accounting',
'chartofaccount')) {
714 print
' '.img_warning($langs->trans(
"WarningReadBankAlsoAllowedIfUserHasPermission"));
722 print
'<td class="right">';
723 $htmltext = $langs->trans(
"ID").
': '.$obj->id;
724 $htmltext .=
'<br>'.$langs->trans(
"Permission").
': user->hasRight(\''.
dol_escape_htmltag($obj->module).
'\', \
''.dol_escape_htmltag($obj->perms).
'\''.($obj->subperms ?
', \''.dol_escape_htmltag($obj->subperms).
'\'' :
'').
')';
725 print $form->textwithpicto(
'', $htmltext);
741print
'$(".tdforbreakperms:not(.alink)").on("click", function(){
742 console.log("Click on tdforbreakperms");
743 moduletohide = $(this).data("hide-perms");
744 j = $(this).data("j");
745 if ($("#idforbreakperms_"+moduletohide).val() == 1) {
746 console.log("idforbreakperms_"+moduletohide+" has value hidden=1");
747 $(".trtohide_"+moduletohide).show();
748 $(".permtoshow_"+moduletohide).hide();
749 $(".permtohide_"+moduletohide).show();
750 $(".folderperms_"+moduletohide).hide();
751 $(".folderopenperms_"+moduletohide).show();
752 $("#idforbreakperms_"+moduletohide).val("0");
754 console.log("idforbreakperms_"+moduletohide+" has value hidden=0");
755 $(".trtohide_"+moduletohide).hide();
756 $(".folderopenperms_"+moduletohide).hide();
757 $(".folderperms_"+moduletohide).show();
758 $(".permtoshow_"+moduletohide).show();
759 $(".permtohide_"+moduletohide).hide();
760 $("#idforbreakperms_"+moduletohide).val("1");
763 // Now rebuild the value for cookie
765 $(".trforbreakperms").each(function(index) {
766 //console.log( index + ": " + $( this ).data("j") + " " + $( this ).data("hide-perms") + " " + $("input[data-j="+(index+1)+"]").val());
767 if ($("input[data-j="+(index+1)+"]").val() == 1) {
768 hideuserperm=hideuserperm+","+(index+1);
772 date = new Date(); date.setTime(date.getTime()+(30*86400000));
774 console.log("set cookie DOLUSER_PERMS_HIDE_GRP="+hideuserperm);
775 document.cookie = "DOLUSER_PERMS_HIDE_GRP=" + hideuserperm + "; expires=" + date.toGMTString() + "; path=/ ";
777 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP");
778 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
784print
'$(".showallperms").on("click", function(){
785 console.log("Click on showallperms");
787 console.log("delete cookie DOLUSER_PERMS_HIDE_GRP from showallperms click");
788 document.cookie = "DOLUSER_PERMS_HIDE_GRP=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/ ";
789 $(".tdforbreakperms").each( function(){
790 moduletohide = $(this).data("hide-perms");
791 //console.log(moduletohide);
792 if ($("#idforbreakperms_"+moduletohide).val() != 0) {
793 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
798$(".hideallperms").on("click", function(){
799 console.log("Click on hideallperms");
801 $(".tdforbreakperms").each( function(){
802 moduletohide = $(this).data("hide-perms");
803 //console.log(moduletohide);
804 if ($("#idforbreakperms_"+moduletohide).val() != 1) {
805 $(this).trigger("click"); // emulate the click, so the cooki will be resaved
813print
'.switchfolderperms{
818$parameters = array();
819$reshook = $hookmanager->executeHooks(
'insertExtraFooter', $parameters,
$object, $action);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage Dolibarr users.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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.