29 require
'../../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
33 $langs->load(
"users");
35 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
36 $search_group =
GETPOST(
'search_group');
37 $optioncss =
GETPOST(
'optioncss',
'alpha');
38 $massaction =
GETPOST(
'massaction',
'alpha');
39 $contextpage =
GETPOST(
'optioncss',
'aZ09');
42 $caneditperms = ($user->admin || $user->hasRight(
"user",
"user",
"write"));
44 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
45 $caneditperms = ($user->admin || $user->hasRight(
"user",
"group_advance",
"write"));
49 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
50 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
51 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
53 if (empty($page) || $page == -1) {
56 $offset = $limit * $page;
57 $pageprev = $page - 1;
58 $pagenext = $page + 1;
68 $fieldstosearchall = array(
73 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
74 if (!$user->hasRight(
"user",
"group_advance",
"read") && !$user->admin) {
80 if (
isModEnabled(
'multicompany') && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
84 if (!$user->hasRight(
"user",
"user",
"read") && !$user->admin) {
93 if (
GETPOST(
'cancel',
'alpha')) {
94 $action =
'list'; $massaction =
'';
96 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
100 $parameters = array();
101 $reshook = $hookmanager->executeHooks(
'doActions', $parameters);
106 if (empty($reshook)) {
108 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
111 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
113 $search_date_creation =
"";
114 $search_date_update =
"";
115 $search_array_options = array();
124 $title = $langs->trans(
"UserGroups");
128 $sql =
"SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions";
129 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
130 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
131 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
132 if (
isModEnabled(
'multicompany') && $conf->entity == 1 && (
getDolGlobalInt(
'MULTICOMPANY_TRANSVERSE_MODE') || ($user->admin && !$user->entity))) {
133 $sql .=
" WHERE g.entity IS NOT NULL";
135 $sql .=
" WHERE g.entity IN (0,".$conf->entity.
")";
137 if (!empty($search_group)) {
143 $sql .=
" GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
144 $sql .= $db->order($sortfield, $sortorder);
146 $resql = $db->query($sql);
148 $num = $db->num_rows(
$resql);
154 $param =
"&search_group=".urlencode($search_group).
"&sall=".urlencode($sall);
155 if ($optioncss !=
'') {
156 $param .=
'&optioncss='.$optioncss;
159 $text = $langs->trans(
"UserGroups");
163 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewGroup'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/user/group/card.php?action=create&leftmenu=');
166 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
167 if ($optioncss !=
'') {
168 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
170 print
'<input type="hidden" name="token" value="'.newToken().
'">';
171 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
172 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
173 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
174 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
176 print_barre_liste($text, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
"", $num,
$nbtotalofrecords,
'object_group', 0, $newcardbutton,
'', $limit, 0, 0, 1);
179 foreach ($fieldstosearchall as $key => $val) {
180 $fieldstosearchall[$key] = $langs->trans($val);
182 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
190 print
'<div class="div-table-responsive">';
191 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
193 print
'<tr class="liste_titre">';
196 if (
isModEnabled(
'multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
197 print_liste_field_titre(
"Entity", $_SERVER[
"PHP_SELF"],
"g.entity", $param,
"",
'', $sortfield, $sortorder,
'center ');
199 print_liste_field_titre(
"NbOfUsers", $_SERVER[
"PHP_SELF"],
"nb", $param,
"",
'', $sortfield, $sortorder,
'center ');
200 print_liste_field_titre(
"NbOfPermissions", $_SERVER[
"PHP_SELF"],
"nbpermissions", $param,
"",
'', $sortfield, $sortorder,
'center ');
201 print_liste_field_titre(
"DateCreationShort", $_SERVER[
"PHP_SELF"],
"g.datec", $param,
"",
'', $sortfield, $sortorder,
'center ');
202 print_liste_field_titre(
"DateLastModification", $_SERVER[
"PHP_SELF"],
"g.tms", $param,
"",
'', $sortfield, $sortorder,
'center ');
209 $obj = $db->fetch_object(
$resql);
211 $grouptemp->id = $obj->rowid;
212 $grouptemp->name = $obj->name;
213 $grouptemp->note = $obj->note;
215 print
'<tr class="oddeven">';
217 print $grouptemp->getNomUrl(1);
219 print
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
223 if (
isModEnabled(
'multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
224 $mc->getInfo($obj->entity);
225 print
'<td class="center">'.dol_escape_htmltag($mc->label).
'</td>';
227 print
'<td class="center">'.$obj->nb.
'</td>';
228 print
'<td class="center">';
229 print
'<a href="'.DOL_URL_ROOT.
'/user/group/perms.php?id='.$obj->rowid.
'">'.$obj->nbpermissions.
'</a>';
231 print
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec),
"dayhour").
'</td>';
232 print
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem),
"dayhour").
'</td>';
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.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage user groups.
if(isModEnabled('facture') &&!empty($user->rights->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') &&!empty($user->rights->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)) $resql
Social contributions to pay.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
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.
$nbtotalofrecords
Count total nb of records.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.