28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
32 $langs->load(
"users");
34 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
35 $search_group =
GETPOST(
'search_group');
36 $optioncss =
GETPOST(
'optioncss',
'alpha');
37 $massaction =
GETPOST(
'massaction',
'alpha');
38 $contextpage =
GETPOST(
'optioncss',
'aZ09');
41 $caneditperms = ($user->admin || $user->rights->user->user->creer);
43 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
44 $caneditperms = ($user->admin || $user->rights->user->group_advance->write);
48 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
49 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
50 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52 if (empty($page) || $page == -1) {
55 $offset = $limit * $page;
56 $pageprev = $page - 1;
57 $pagenext = $page + 1;
67 $fieldstosearchall = array(
72 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
73 if (!$user->rights->user->group_advance->read && !$user->admin) {
79 if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) {
83 if (!$user->rights->user->user->lire && !$user->admin) {
92 if (
GETPOST(
'cancel',
'alpha')) {
93 $action =
'list'; $massaction =
'';
95 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
99 $parameters = array();
100 $reshook = $hookmanager->executeHooks(
'doActions', $parameters);
105 if (empty($reshook)) {
107 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
110 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
112 $search_date_creation =
"";
113 $search_date_update =
"";
114 $search_array_options = array();
126 $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";
127 $sql .=
" FROM ".MAIN_DB_PREFIX.
"usergroup as g";
128 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_user as ugu ON ugu.fk_usergroup = g.rowid";
129 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"usergroup_rights as ugr ON ugr.fk_usergroup = g.rowid";
130 if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global->MULTICOMPANY_TRANSVERSE_MODE || ($user->admin && !$user->entity))) {
131 $sql .=
" WHERE g.entity IS NOT NULL";
133 $sql .=
" WHERE g.entity IN (0,".$conf->entity.
")";
135 if (!empty($search_group)) {
141 $sql .=
" GROUP BY g.rowid, g.nom, g.note, g.entity, g.datec, g.tms";
142 $sql .= $db->order($sortfield, $sortorder);
144 $resql = $db->query($sql);
146 $num = $db->num_rows(
$resql);
148 $nbtotalofrecords = $num;
152 $param =
"&search_group=".urlencode($search_group).
"&sall=".urlencode($sall);
153 if ($optioncss !=
'') {
154 $param .=
'&optioncss='.$optioncss;
157 $text = $langs->trans(
"ListOfGroups");
161 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewGroup'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/user/group/card.php?action=create&leftmenu=');
164 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
165 if ($optioncss !=
'') {
166 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
168 print
'<input type="hidden" name="token" value="'.newToken().
'">';
169 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
170 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
171 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
172 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
174 print_barre_liste($text, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder,
"", $num, $nbtotalofrecords,
'object_group', 0, $newcardbutton,
'', $limit, 0, 0, 1);
177 foreach ($fieldstosearchall as $key => $val) {
178 $fieldstosearchall[$key] = $langs->trans($val);
180 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
188 print
'<div class="div-table-responsive">';
189 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
191 print
'<tr class="liste_titre">';
194 if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
195 print_liste_field_titre(
"Entity", $_SERVER[
"PHP_SELF"],
"g.entity", $param,
"",
'', $sortfield, $sortorder,
'center ');
197 print_liste_field_titre(
"NbOfUsers", $_SERVER[
"PHP_SELF"],
"nb", $param,
"",
'', $sortfield, $sortorder,
'center ');
198 print_liste_field_titre(
"NbOfPermissions", $_SERVER[
"PHP_SELF"],
"nbpermissions", $param,
"",
'', $sortfield, $sortorder,
'center ');
199 print_liste_field_titre(
"DateCreationShort", $_SERVER[
"PHP_SELF"],
"g.datec", $param,
"",
'', $sortfield, $sortorder,
'center ');
200 print_liste_field_titre(
"DateLastModification", $_SERVER[
"PHP_SELF"],
"g.tms", $param,
"",
'', $sortfield, $sortorder,
'center ');
207 $obj = $db->fetch_object(
$resql);
209 $grouptemp->id = $obj->rowid;
210 $grouptemp->name = $obj->name;
211 $grouptemp->note = $obj->note;
213 print
'<tr class="oddeven">';
215 print $grouptemp->getNomUrl(1);
217 print
img_picto($langs->trans(
"GlobalGroup"),
'redstar');
221 if (
isModEnabled(
'multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) {
222 $mc->getInfo($obj->entity);
223 print
'<td class="center">'.dol_escape_htmltag($mc->label).
'</td>';
225 print
'<td class="center">'.$obj->nb.
'</td>';
226 print
'<td class="center">';
227 print
'<a href="'.DOL_URL_ROOT.
'/user/group/perms.php?id='.$obj->rowid.
'">'.$obj->nbpermissions.
'</a>';
229 print
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datec),
"dayhour").
'</td>';
230 print
'<td class="center nowrap">'.dol_print_date($db->jdate($obj->datem),
"dayhour").
'</td>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage user groups.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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...
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->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->rights->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...
isModEnabled($module)
Is Dolibarr module enabled.