diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php
index 8fa614bf1e5..75ab7884ea4 100644
--- a/htdocs/user/group/perms.php
+++ b/htdocs/user/group/perms.php
@@ -255,12 +255,18 @@ if ($object->id > 0) {
print '/';
print 'id.'&action=delrights&&token='.newToken().'&entity='.$entity.'&module=allmodules&confirm=yes">'.$langs->trans("None")."";
print '';
+ } else {
+ print '
| ';
}
- print ' | ';
- print ''.$langs->trans("Permissions").' | ';
- if ($user->admin) {
- print ' | ';
- }
+ print ' | ';
+ //print ''.$langs->trans("Permissions").' | ';
+ print ' | ';
+
+ print '';
+ print ''.img_picto('', 'folder-open', 'class="paddingright"').''.$langs->trans("ExpandAll").'';
+ print ' | ';
+ print ''.img_picto('', 'folder', 'class="paddingright"').''.$langs->trans("UndoExpandAll").'';
+ print ' | ';
print ''."\n";
$sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position, r.bydefault";
@@ -275,9 +281,12 @@ if ($object->id > 0) {
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
- $i = 0;
+ $i = 0;$j = 0;
$oldmod = '';
+ $cookietohidegroup = (empty($_COOKIE["DOLUSER_PERMS_HIDE_GRP"]) ? '' : preg_replace('/^,/', '', $_COOKIE["DOLUSER_PERMS_HIDE_GRP"]));
+ $cookietohidegrouparray = explode(',', $cookietohidegroup);
+
while ($i < $num) {
$obj = $db->fetch_object($result);
@@ -289,48 +298,78 @@ if ($object->id > 0) {
$objMod = $modules[$obj->module];
+ if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
+ $ishidden = GETPOST('forbreakperms_'.$obj->module, 'int');
+ } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
+ $ishidden = 1;
+ } else {
+ $ishidden = 0;
+ }
+ $isexpanded = ! $ishidden;
+
// Break found, it's a new module to catch
if (isset($obj->module) && ($oldmod <> $obj->module)) {
$oldmod = $obj->module;
+ $j++;
+ if (GETPOSTISSET('forbreakperms_'.$obj->module)) {
+ $ishidden = GETPOST('forbreakperms_'.$obj->module, 'int');
+ } elseif (in_array($j, $cookietohidegrouparray)) { // If j is among list of hidden group
+ $ishidden = 1;
+ } else {
+ $ishidden = 0;
+ }
+ $isexpanded = ! $ishidden;
// Break detected, we get objMod
$objMod = $modules[$obj->module];
$picto = ($objMod->picto ? $objMod->picto : 'generic');
// Show break line
- print '';
- print '| ';
+ print ' |
';
+ // Picto and label of module
+ print '| ';
print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName();
print '';
print ' | ';
+ // Permission and tick (2 columns)
if ($caneditperms) {
- print '';
- print 'id.'&action=addrights&entity='.$entity.'&module='.$obj->module.'&token='.newToken().'">'.$langs->trans("All")."";
- print '/';
- print 'id.'&action=delrights&entity='.$entity.'&module='.$obj->module.'&token='.newToken().'">'.$langs->trans("None")."";
+ print ' | ';
+ print '';
+ print 'id.'&action=addrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("All")."";
+ print ' / ';
+ print 'id.'&action=delrights&token='.newToken().'&entity='.$entity.'&module='.$obj->module.'&confirm=yes&updatedmodulename='.$obj->module.'">'.$langs->trans("None")."";
+ print '';
+ print ' | ';
+ print '';
print ' | ';
} else {
- print ' | ';
+ print ' | ';
+ print ' | ';
}
- print ' | ';
- print ' | ';
-
- // Permission id
- if ($user->admin) {
- print ' | ';
- }
-
+ // Description of permission (2 columns)
+ print ' | ';
+ print '';
+ print ' ';
+ print img_picto('', 'folder', 'class="marginright"');
+ print ' ';
+ print '';
+ print img_picto('', 'folder-open', 'class="marginright"');
+ print ' ';
+ print ' | '; //Add picto + / - when open en closed
print '
'."\n";
}
print ''."\n";
- print '';
+ print '
';
+
// Picto and label of module
print '| ';
+ print '';
//print img_object('', $picto, 'class="inline-block pictoobjectwidth"').' '.$objMod->getName();
print ' | ';
+ // Permission and tick (2 columns)
if (!empty($permsgroupbyentity[$entity]) && is_array($permsgroupbyentity[$entity])) {
if (in_array($obj->id, $permsgroupbyentity[$entity])) {
// Own permission by group
@@ -360,11 +399,13 @@ if ($object->id > 0) {
//print img_edit_add($langs->trans("Add"));
print img_picto($langs->trans("Add"), 'switch_off');
print '';
+ } else {
+ print ' | ';
}
print ' | ';
}
- // Description of permission
+ // Description of permission (2 columns)
$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)));
print '';
print $permlabel;
@@ -383,6 +424,8 @@ if ($object->id > 0) {
print $form->textwithpicto('', $htmltext);
//print ''.$obj->id.'';
print ' | ';
+ } else {
+ print ' | ';
}
print '
'."\n";
@@ -393,6 +436,82 @@ if ($object->id > 0) {
print '';
print '';
+ print '';
+
+ print '';
print '';
$parameters = array();