dolibarr 19.0.3
list.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2021 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
6 * Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
31if (isModEnabled('categorie')) {
32 require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
33}
34
35// Load translation files required by page
36$langs->loadLangs(array('users', 'companies', 'hrm', 'salaries'));
37
38$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
39$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
40$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
41$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
42$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button
43$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
44$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
45$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
46$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
47$mode = GETPOST("mode", 'aZ');
48
49// Security check (for external users)
50$socid = 0;
51if ($user->socid > 0) {
52 $socid = $user->socid;
53}
54
55// Load variable for pagination
56$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
57$sortfield = GETPOST('sortfield', 'aZ09comma');
58$sortorder = GETPOST('sortorder', 'aZ09comma');
59$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
60if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
61 // If $page is not defined, or '' or -1 or if we click on clear filters
62 $page = 0;
63}
64$offset = $limit * $page;
65$pageprev = $page - 1;
66$pagenext = $page + 1;
67
68// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
69$object = new User($db);
70$extrafields = new ExtraFields($db);
71$diroutputmassaction = $conf->user->dir_output.'/temp/massgeneration/'.$user->id;
72$hookmanager->initHooks(array('userlist'));
73
74// Fetch optionals attributes and labels
75$extrafields->fetch_name_optionals_label($object->table_element);
76
77$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
78
79if (!$sortfield) {
80 $sortfield = "u.login";
81}
82if (!$sortorder) {
83 $sortorder = "ASC";
84}
85
86// Initialize array of search criterias
87$search_all = trim(GETPOST('search_all', 'alphanohtml'));
88$search = array();
89foreach ($object->fields as $key => $val) {
90 if (GETPOST('search_'.$key, 'alpha') !== '') {
91 $search[$key] = GETPOST('search_'.$key, 'alpha');
92 }
93 if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
94 $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
95 $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
96 }
97}
98
99$userstatic = new User($db);
100$companystatic = new Societe($db);
101$form = new Form($db);
102
103// List of fields to search into when doing a "search in all"
104$fieldstosearchall = array(
105 'u.login'=>"Login",
106 'u.lastname'=>"Lastname",
107 'u.firstname'=>"Firstname",
108 'u.accountancy_code'=>"AccountancyCode",
109 'u.office_phone'=>"PhonePro",
110 'u.user_mobile'=>"PhoneMobile",
111 'u.email'=>"EMail",
112 'u.note_public'=>"NotePublic",
113 'u.note_private'=>"NotePrivate"
114);
115if (isModEnabled('api')) {
116 $fieldstosearchall['u.api_key'] = "ApiKey";
117}
118
119$permissiontoreadhr = $user->hasRight('hrm', 'read_personal_information', 'read') || $user->hasRight('hrm', 'write_personal_information', 'write');
120$permissiontowritehr = $user->hasRight('hrm', 'write_personal_information', 'write');
121
122// Definition of fields for list
123$arrayfields = array(
124 'u.rowid'=>array('label'=>"TechnicalID", 'checked'=>-1, 'position'=>5),
125 'u.login'=>array('label'=>"Login", 'checked'=>1, 'position'=>10),
126 'u.lastname'=>array('label'=>"Lastname", 'checked'=>1, 'position'=>15),
127 'u.firstname'=>array('label'=>"Firstname", 'checked'=>1, 'position'=>20),
128 'u.entity'=>array('label'=>"Entity", 'checked'=>1, 'position'=>50, 'enabled'=>(isModEnabled('multicompany') && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE'))),
129 'u.gender'=>array('label'=>"Gender", 'checked'=>0, 'position'=>22),
130 'u.employee'=>array('label'=>"Employee", 'checked'=>($contextpage == 'employeelist' ? 1 : 0), 'position'=>25),
131 'u.fk_user'=>array('label'=>"HierarchicalResponsible", 'checked'=>1, 'position'=>27, 'csslist'=>'maxwidth150'),
132 'u.accountancy_code'=>array('label'=>"AccountancyCode", 'checked'=>0, 'position'=>30),
133 'u.office_phone'=>array('label'=>"PhonePro", 'checked'=>1, 'position'=>31),
134 'u.user_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1, 'position'=>32),
135 'u.email'=>array('label'=>"EMail", 'checked'=>1, 'position'=>35),
136 'u.api_key'=>array('label'=>"ApiKey", 'checked'=>0, 'position'=>40, "enabled"=>(isModEnabled('api') && $user->admin)),
137 'u.fk_soc'=>array('label'=>"Company", 'checked'=>($contextpage == 'employeelist' ? 0 : 1), 'position'=>45),
138 'u.ref_employee'=>array('label'=>"RefEmployee", 'checked'=>-1, 'position'=>50, 'enabled'=>(isModEnabled('hrm') && $permissiontoreadhr)),
139 'u.national_registration_number'=>array('label'=>"NationalRegistrationNumber", 'checked'=>-1, 'position'=>51, 'enabled'=>(isModEnabled('hrm') && $permissiontoreadhr)),
140 'u.job'=>array('label'=>"PostOrFunction", 'checked'=>-1, 'position'=>60),
141 'u.salary'=>array('label'=>"Salary", 'checked'=>-1, 'position'=>80, 'enabled'=>(isModEnabled('salaries') && $user->hasRight("salaries", "readall")), 'isameasure'=>1),
142 'u.datelastlogin'=>array('label'=>"LastConnexion", 'checked'=>1, 'position'=>100),
143 'u.datepreviouslogin'=>array('label'=>"PreviousConnexion", 'checked'=>0, 'position'=>110),
144 'u.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
145 'u.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
146 'u.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
147);
148// Extra fields
149include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php';
150
151$object->fields = dol_sort_array($object->fields, 'position');
152$arrayfields = dol_sort_array($arrayfields, 'position');
153
154// Init search fields
155$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
156$search_user = GETPOST('search_user', 'alpha');
157$search_rowid = GETPOST('search_rowid', 'alpha');
158$search_login = GETPOST('search_login', 'alpha');
159$search_lastname = GETPOST('search_lastname', 'alpha');
160$search_firstname = GETPOST('search_firstname', 'alpha');
161$search_gender = GETPOST('search_gender', 'alpha');
162$search_employee = GETPOST('search_employee', 'alpha');
163$search_accountancy_code = GETPOST('search_accountancy_code', 'alpha');
164$search_phonepro = GETPOST('search_phonepro', 'alpha');
165$search_phonemobile = GETPOST('search_phonemobile', 'alpha');
166$search_email = GETPOST('search_email', 'alpha');
167$search_api_key = GETPOST('search_api_key', 'alphanohtml');
168$search_statut = GETPOST('search_statut', 'intcomma');
169$search_thirdparty = GETPOST('search_thirdparty', 'alpha');
170$search_job = GETPOST('search_job', 'alpha');
171$search_warehouse = GETPOST('search_warehouse', 'alpha');
172$search_supervisor = GETPOST('search_supervisor', 'intcomma');
173$search_categ = GETPOST("search_categ", 'int');
174$searchCategoryUserOperator = 0;
175if (GETPOSTISSET('formfilteraction')) {
176 $searchCategoryUserOperator = GETPOSTINT('search_category_user_operator');
177} elseif (getDolGlobalString('MAIN_SEARCH_CAT_OR_BY_DEFAULT')) {
178 $searchCategoryUserOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
179}
180$searchCategoryUserList = GETPOST('search_category_user_list', 'array');
181$catid = GETPOST('catid', 'int');
182if (!empty($catid) && empty($searchCategoryUserList)) {
183 $searchCategoryUserList = array($catid);
184}
185$catid = GETPOST('catid', 'int');
186if (!empty($catid) && empty($search_categ)) {
187 $search_categ = $catid;
188}
189
190// Default search
191if ($search_statut == '') {
192 $search_statut = '1';
193}
194if ($contextpage == 'employeelist' && !GETPOSTISSET('search_employee')) {
195 $search_employee = 1;
196}
197
198// Define value to know what current user can do on users
199$permissiontoadd = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
200$canreaduser = (!empty($user->admin) || $user->hasRight("user", "user", "read"));
201$canedituser = (!empty($user->admin) || $user->hasRight("user", "user", "write"));
202$candisableuser = (!empty($user->admin) || $user->hasRight("user", "user", "delete"));
203$canreadgroup = $canreaduser;
204$caneditgroup = $canedituser;
205if (getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
206 $canreadgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "read"));
207 $caneditgroup = (!empty($user->admin) || $user->hasRight("user", "group_advance", "write"));
208}
209
210$error = 0;
211
212// Permission to list
213if (isModEnabled('salaries') && $contextpage == 'employeelist' && $search_employee == 1) {
214 if (!$user->hasRight("salaries", "read")) {
216 }
217} else {
218 if (!$user->hasRight("user", "user", "read") && empty($user->admin)) {
220 }
221}
222
223$childids = $user->getAllChildIds(1);
224
225
226/*
227 * Actions
228 */
229
230if (GETPOST('cancel', 'alpha')) {
231 $action = 'list';
232 $massaction = '';
233}
234if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
235 $massaction = '';
236}
237
238$parameters = array();
239$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
240if ($reshook < 0) {
241 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
242}
243
244if (empty($reshook)) {
245 // Selection of new fields
246 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
247
248 // Purge search criteria
249 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
250 $search_user = "";
251 $search_rowid = "";
252 $search_login = "";
253 $search_lastname = "";
254 $search_firstname = "";
255 $search_gender = "";
256 $search_employee = "";
257 $search_accountancy_code = "";
258 $search_phonepro = "";
259 $search_phonemobile = "";
260 $search_email = "";
261 $search_statut = "";
262 $search_thirdparty = "";
263 $search_job = "";
264 $search_warehouse = "";
265 $search_supervisor = "";
266 $search_api_key = "";
267 $search_datelastlogin = "";
268 $search_datepreviouslogin = "";
269 $search_date_creation = "";
270 $search_date_update = "";
271 $search_categ = 0;
272 $toselect = array();
273 $search_array_options = array();
274 }
275 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
276 || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
277 $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
278 }
279
280 // Mass actions
281 $objectclass = 'User';
282 $objectlabel = 'User';
283 $uploaddir = $conf->user->dir_output;
284 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
285
286 // Disable or Enable records
287 if (!$error && ($massaction == 'disable' || $massaction == 'reactivate') && $permissiontoadd) {
288 $objecttmp = new User($db);
289
290 if (!$error) {
291 $db->begin();
292
293 $nbok = 0;
294 foreach ($toselect as $toselectid) {
295 if ($toselectid == $user->id) {
296 setEventMessages($langs->trans($massaction == 0 ? 'CantDisableYourself' : 'CanEnableYourself'), null, 'errors');
297 $error++;
298 break;
299 }
300
301 $result = $objecttmp->fetch($toselectid);
302 if ($result > 0) {
303 if ($objecttmp->admin) {
304 setEventMessages($langs->trans($massaction == 0 ? 'CantDisableAnAdminUserWithMassActions' : 'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null, 'errors');
305 $error++;
306 break;
307 }
308
309 $result = $objecttmp->setstatus($massaction == 'disable' ? 0 : 1);
310 if ($result == 0) {
311 // Nothing is done
312 } elseif ($result < 0) {
313 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
314 $error++;
315 break;
316 } else {
317 $nbok++;
318 }
319 } else {
320 setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
321 $error++;
322 break;
323 }
324 }
325
326 if (!$error && !empty($conf->file->main_limit_users)) {
327 $nb = $object->getNbOfUsers("active");
328 if ($nb >= $conf->file->main_limit_users) {
329 $error++;
330 setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors');
331 }
332 }
333
334 if (!$error) {
335 if ($nbok > 1) {
336 setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
337 } else {
338 setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
339 }
340 $db->commit();
341 } else {
342 $db->rollback();
343 }
344 }
345 }
346}
347
348
349/*
350 * View
351 */
352
353$formother = new FormOther($db);
354$user2 = new User($db);
355
356$now = dol_now();
357
358$help_url = 'EN:Module_Users|FR:Module_Utilisateurs|ES:M&oacute;dulo_Usuarios|DE:Modul_Benutzer';
359if ($contextpage == 'employeelist' && $search_employee == 1) {
360 $title = $langs->trans("Employees");
361} else {
362 $title = $langs->trans("Users");
363}
364$morejs = array();
365$morecss = array();
366$morehtmlright = "";
367
368// Build and execute select
369// --------------------------------------------------------------------
370$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.office_phone, u.user_mobile, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,";
371$sql .= " u.fk_user,";
372$sql .= " u.ref_employee, u.national_registration_number, u.job, u.salary, u.datelastlogin, u.datepreviouslogin,";
373$sql .= " u.datestartvalidity, u.dateendvalidity,";
374$sql .= " u.ldap_sid, u.statut as status, u.entity,";
375$sql .= " u.tms as date_update, u.datec as date_creation,";
376$sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.office_phone as ofice_phone2, u2.user_mobile as user_mobile2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as status2,";
377$sql .= " s.nom as name, s.canvas";
378// Add fields from extrafields
379if (!empty($extrafields->attributes[$object->table_element]['label'])) {
380 foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
381 $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
382 }
383}
384// Add fields from hooks
385$parameters = array();
386$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
387$sql .= $hookmanager->resPrint;
388$sql = preg_replace('/,\s*$/', '', $sql);
389
390$sqlfields = $sql; // $sql fields to remove for count total
391
392$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as u";
393if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
394 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)";
395}
396$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON u.fk_soc = s.rowid";
397$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u2 ON u.fk_user = u2.rowid";
398// Add table from hooks
399$parameters = array();
400$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
401$sql .= $hookmanager->resPrint;
402if ($reshook > 0) {
403 $sql .= $hookmanager->resPrint;
404}
405$sql .= " WHERE u.entity IN (".getEntity($object->element).")";
406if ($socid > 0) {
407 $sql .= " AND u.fk_soc = ".((int) $socid);
408}
409//if ($search_user != '') $sql.=natural_search(array('u.login', 'u.lastname', 'u.firstname'), $search_user);
410if ($search_supervisor > 0) {
411 $sql .= " AND u.fk_user IN (".$db->sanitize($search_supervisor).")";
412}
413if ($search_thirdparty != '') {
414 $sql .= natural_search(array('s.nom'), $search_thirdparty);
415}
416if ($search_warehouse > 0) {
417 $sql .= natural_search(array('u.fk_warehouse'), $search_warehouse);
418}
419if ($search_rowid != '') {
420 $sql .= natural_search("u.rowid", $search_rowid, 1);
421}
422if ($search_login != '') {
423 $sql .= natural_search("u.login", $search_login);
424}
425if ($search_lastname != '') {
426 $sql .= natural_search("u.lastname", $search_lastname);
427}
428if ($search_firstname != '') {
429 $sql .= natural_search("u.firstname", $search_firstname);
430}
431if ($search_gender != '' && $search_gender != '-1') {
432 $sql .= " AND u.gender = '".$db->escape($search_gender)."'"; // Cannot use natural_search as looking for %man% also includes woman
433}
434if (is_numeric($search_employee) && $search_employee >= 0) {
435 $sql .= ' AND u.employee = '.(int) $search_employee;
436}
437if ($search_accountancy_code != '') {
438 $sql .= natural_search("u.accountancy_code", $search_accountancy_code);
439}
440if ($search_phonepro != '') {
441 $sql .= natural_search("u.office_phone", $search_phonepro);
442}
443if ($search_phonemobile != '') {
444 $sql .= natural_search("u.user_mobile", $search_phonemobile);
445}
446if ($search_email != '') {
447 $sql .= natural_search("u.email", $search_email);
448}
449if ($search_api_key != '') {
450 $sql .= natural_search("u.api_key", $search_api_key);
451}
452if ($search_job != '') {
453 $sql .= natural_search(array('u.job'), $search_job);
454}
455if ($search_statut != '' && $search_statut >= 0) {
456 $sql .= " AND u.statut IN (".$db->sanitize($search_statut).")";
457}
458if ($search_all) {
459 $sql .= natural_search(array_keys($fieldstosearchall), $search_all);
460}
461// Search for tag/category ($searchCategoryUserList is an array of ID)
462$searchCategoryUserList = array($search_categ);
463if (!empty($searchCategoryUserList)) {
464 $searchCategoryUserSqlList = array();
465 $listofcategoryid = '';
466 foreach ($searchCategoryUserList as $searchCategoryUser) {
467 if (intval($searchCategoryUser) == -2) {
468 $searchCategoryUserSqlList[] = "NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user)";
469 } elseif (intval($searchCategoryUser) > 0) {
470 if ($searchCategoryUserOperator == 0) {
471 $searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).")";
472 } else {
473 $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryUser);
474 }
475 }
476 }
477 if ($listofcategoryid) {
478 $searchCategoryUserSqlList[] = " EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX."categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
479 }
480 if ($searchCategoryUserOperator == 1) {
481 if (!empty($searchCategoryUserSqlList)) {
482 $sql .= " AND (".implode(' OR ', $searchCategoryUserSqlList).")";
483 }
484 } else {
485 if (!empty($searchCategoryUserSqlList)) {
486 $sql .= " AND (".implode(' AND ', $searchCategoryUserSqlList).")";
487 }
488 }
489}
490if ($search_warehouse > 0) {
491 $sql .= " AND u.fk_warehouse = ".((int) $search_warehouse);
492}
493if (isModEnabled('salaries') && $contextpage == 'employeelist' && !$user->hasRight("salaries", "readall")) {
494 $sql .= " AND u.rowid IN (".$db->sanitize(join(',', $childids)).")";
495}
496// Add where from extra fields
497include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
498// Add where from hooks
499$parameters = array();
500$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
501$sql .= $hookmanager->resPrint;
502
503// Count total nb of records
504$nbtotalofrecords = '';
505if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
506 /* The fast and low memory method to get and count full list converts the sql into a sql count */
507 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
508 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
509 $resql = $db->query($sqlforcount);
510 if ($resql) {
511 $objforcount = $db->fetch_object($resql);
512 $nbtotalofrecords = $objforcount->nbtotalofrecords;
513 } else {
514 dol_print_error($db);
515 }
516
517 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
518 $page = 0;
519 $offset = 0;
520 }
521 $db->free($resql);
522}
523
524// Complete request and execute it with limit
525$sql .= $db->order($sortfield, $sortorder);
526if ($limit) {
527 $sql .= $db->plimit($limit + 1, $offset);
528}
529
530$resql = $db->query($sql);
531if (!$resql) {
532 dol_print_error($db);
533 exit;
534}
535
536$num = $db->num_rows($resql);
537
538// Direct jump if only one record found
539if ($num == 1 && getDolGlobalString('MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
540 $obj = $db->fetch_object($resql);
541 $id = $obj->rowid;
542 header("Location: ".DOL_URL_ROOT.'/user/card.php?id='.$id);
543 exit;
544}
545
546// Output page
547// --------------------------------------------------------------------
548
549llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
550
551$arrayofselected = is_array($toselect) ? $toselect : array();
552
553$param = '';
554if (!empty($mode)) {
555 $param .= '&amp;mode='.urlencode($mode);
556}
557if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
558 $param .= '&amp;contextpage='.urlencode($contextpage);
559}
560if ($limit > 0 && $limit != $conf->liste_limit) {
561 $param .= '&amp;limit='.((int) $limit);
562}
563if ($search_all != '') {
564 $param .= '&amp;search_all='.urlencode($search_all);
565}
566if ($search_user != '') {
567 $param .= "&amp;search_user=".urlencode($search_user);
568}
569if ($search_rowid != '') {
570 $param .= "&amp;search_rowid=".urlencode($search_rowid);
571}
572if ($search_login != '') {
573 $param .= "&amp;search_login=".urlencode($search_login);
574}
575if ($search_lastname != '') {
576 $param .= "&amp;search_lastname=".urlencode($search_lastname);
577}
578if ($search_firstname != '') {
579 $param .= "&amp;search_firstname=".urlencode($search_firstname);
580}
581if ($search_gender != '' && $search_gender != '-1') {
582 $param .= "&amp;search_gender=".urlencode($search_gender);
583}
584if ($search_employee != '' && $search_employee != '-1') {
585 $param .= "&amp;search_employee=".urlencode($search_employee);
586}
587if ($search_accountancy_code != '') {
588 $param .= "&amp;search_accountancy_code=".urlencode($search_accountancy_code);
589}
590if ($search_phonepro != '') {
591 $param .= "&amp;search_phonepro=".urlencode($search_phonepro);
592}
593if ($search_phonemobile != '') {
594 $param .= "&amp;search_phonemobile=".urlencode($search_phonemobile);
595}
596if ($search_email != '') {
597 $param .= "&amp;search_email=".urlencode($search_email);
598}
599if ($search_api_key != '') {
600 $param .= "&amp;search_api_key=".urlencode($search_api_key);
601}
602if ($search_supervisor > 0) {
603 $param .= "&amp;search_supervisor=".urlencode($search_supervisor);
604}
605if ($search_statut != '') {
606 $param .= "&amp;search_statut=".urlencode($search_statut);
607}
608if ($optioncss != '') {
609 $param .= '&amp;optioncss='.urlencode($optioncss);
610}
611if ($search_categ > 0) {
612 $param .= '&amp;search_categ='.urlencode($search_categ);
613}
614if ($search_warehouse > 0) {
615 $param .= '&amp;search_warehouse='.urlencode($search_warehouse);
616}
617// Add $param from extra fields
618include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
619
620// List of mass actions available
621$arrayofmassactions = array();
622if ($permissiontoadd) {
623 $arrayofmassactions['disable'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("DisableUser");
624}
625if ($permissiontoadd) {
626 $arrayofmassactions['reactivate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Reactivate");
627}
628if (isModEnabled('category') && $permissiontoadd) {
629 $arrayofmassactions['preaffecttag'] = img_picto('', 'category', 'class="pictofixedwidth"').$langs->trans("AffectTag");
630}
631if ($permissiontoadd) {
632 $arrayofmassactions['presetsupervisor'] = img_picto('', 'user', 'class="pictofixedwidth"').$langs->trans("SetSupervisor");
633}
634//if ($permissiontodelete) $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
635
636if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete', 'preaffecttag', 'presetsupervisor'))) {
637 $arrayofmassactions = array();
638}
639$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
640
641print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
642if ($optioncss != '') {
643 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
644}
645print '<input type="hidden" name="token" value="'.newToken().'">';
646print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
647print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
648print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
649print '<input type="hidden" name="page" value="'.$page.'">';
650print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
651print '<input type="hidden" name="page_y" value="">';
652print '<input type="hidden" name="mode" value="'.$mode.'">';
653
654$url = DOL_URL_ROOT.'/user/card.php?action=create'.($contextpage == 'employeelist' ? '&search_employee=1' : '').'&leftmenu=';
655if (!empty($socid)) {
656 $url .= '&socid='.urlencode($socid);
657}
658
659$newcardbutton = '';
660$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
661$newcardbutton .= dolGetButtonTitle($langs->trans('HierarchicView'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php?mode=hierarchy'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', (($mode == 'hierarchy') ? 2 : 1), array('morecss'=>'reposition'));
662$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
663$newcardbutton .= dolGetButtonTitleSeparator();
664$newcardbutton .= dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd);
665
666/*$moreparam = array('morecss'=>'btnTitleSelected');
667$morehtmlright = dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
668$moreparam = array('morecss'=>'marginleftonly');
669$morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam);
670*/
671print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $morehtmlright.' '.$newcardbutton, '', $limit, 0, 0, 1);
672
673
674
675// Add code for pre mass action (confirmation or email presend form)
676$topicmail = "SendUserRef";
677$modelmail = "user";
678$objecttmp = new User($db);
679$trackid = 'use'.$object->id;
680include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
681
682if (!empty($catid)) {
683 print "<div id='ways'>";
684 $c = new Categorie($db);
685 $ways = $c->print_all_ways(' &gt; ', 'user/list.php');
686 print " &gt; ".$ways[0]."<br>\n";
687 print "</div><br>";
688}
689
690if ($search_all) {
691 foreach ($fieldstosearchall as $key => $val) {
692 $fieldstosearchall[$key] = $langs->trans($val);
693 }
694 print '<!-- Search done like if USER_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
695 print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>';
696}
697
698$moreforfilter = '';
699/*$moreforfilter.='<div class="divsearchfield">';
700 $moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
701 $moreforfilter.= '</div>';*/
702
703// Filter on categories
704if (isModEnabled('categorie') && $user->hasRight("categorie", "read")) {
705 $moreforfilter .= '<div class="divsearchfield">';
706 $tmptitle = $langs->trans('Category');
707 $moreforfilter .= img_picto($langs->trans("Category"), 'category', 'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1, $tmptitle);
708 $moreforfilter .= '</div>';
709}
710// Filter on warehouse
711if (isModEnabled('stock') && getDolGlobalString('MAIN_DEFAULT_WAREHOUSE_USER')) {
712 require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
713 $formproduct = new FormProduct($db);
714 $moreforfilter .= '<div class="divsearchfield">';
715 $tmptitle = $langs->trans('Warehouse');
716 $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', $tmptitle, 0, 0, $tmptitle);
717 $moreforfilter .= '</div>';
718}
719
720$parameters = array();
721$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
722if (empty($reshook)) {
723 $moreforfilter .= $hookmanager->resPrint;
724} else {
725 $moreforfilter = $hookmanager->resPrint;
726}
727
728if (!empty($moreforfilter)) {
729 print '<div class="liste_titre liste_titre_bydiv centpercent">';
730 print $moreforfilter;
731 print '</div>';
732}
733
734$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
735$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
736$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
737
738print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
739print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
740
741// Fields title search
742// --------------------------------------------------------------------
743print '<tr class="liste_titre_filter">';
744// Action column
745if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
746 print '<td class="liste_titre center maxwidthsearch">';
747 $searchpicto = $form->showFilterButtons('left');
748 print $searchpicto;
749 print '</td>';
750}
751if (!empty($arrayfields['u.rowid']['checked'])) {
752 print '<td class="liste_titre"><input type="text" name="search_rowid" class="maxwidth50" value="'.$search_rowid.'"></td>';
753}
754if (!empty($arrayfields['u.login']['checked'])) {
755 print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
756}
757if (!empty($arrayfields['u.lastname']['checked'])) {
758 print '<td class="liste_titre"><input type="text" name="search_lastname" class="maxwidth50" value="'.$search_lastname.'"></td>';
759}
760if (!empty($arrayfields['u.firstname']['checked'])) {
761 print '<td class="liste_titre"><input type="text" name="search_firstname" class="maxwidth50" value="'.$search_firstname.'"></td>';
762}
763if (!empty($arrayfields['u.gender']['checked'])) {
764 print '<td class="liste_titre center">';
765 $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman"), 'other'=>$langs->trans("Genderother"));
766 print $form->selectarray('search_gender', $arraygender, $search_gender, 1);
767 print '</td>';
768}
769if (!empty($arrayfields['u.employee']['checked'])) {
770 print '<td class="liste_titre">';
771 print $form->selectyesno('search_employee', $search_employee, 1, false, 1);
772 print '</td>';
773}
774// Supervisor
775if (!empty($arrayfields['u.fk_user']['checked'])) {
776 print '<td class="liste_titre">';
777 print $form->select_dolusers($search_supervisor, 'search_supervisor', 1, array(), 0, '', 0, 0, 0, 0, '', 0, '', 'maxwidth125');
778 print '</td>';
779}
780if (!empty($arrayfields['u.accountancy_code']['checked'])) {
781 print '<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.'"></td>';
782}
783if (!empty($arrayfields['u.office_phone']['checked'])) {
784 print '<td class="liste_titre"><input type="text" name="search_phonepro" class="maxwidth50" value="'.$search_phonepro.'"></td>';
785}
786if (!empty($arrayfields['u.user_mobile']['checked'])) {
787 print '<td class="liste_titre"><input type="text" name="search_phonemobile" class="maxwidth50" value="'.$search_phonemobile.'"></td>';
788}
789if (!empty($arrayfields['u.email']['checked'])) {
790 print '<td class="liste_titre"><input type="text" name="search_email" class="maxwidth75" value="'.$search_email.'"></td>';
791}
792if (!empty($arrayfields['u.api_key']['checked'])) {
793 print '<td class="liste_titre"><input type="text" name="search_api_key" class="maxwidth50" value="'.$search_api_key.'"></td>';
794}
795if (!empty($arrayfields['u.fk_soc']['checked'])) {
796 print '<td class="liste_titre"><input type="text" name="search_thirdparty" class="maxwidth75" value="'.$search_thirdparty.'"></td>';
797}
798if (!empty($arrayfields['u.entity']['checked'])) {
799 print '<td class="liste_titre"></td>';
800}
801if (!empty($arrayfields['u.ref_employee']['checked'])) {
802 print '<td class="liste_titre"></td>';
803}
804if (!empty($arrayfields['u.national_registration_number']['checked'])) {
805 print '<td class="liste_titre"></td>';
806}
807if (!empty($arrayfields['u.job']['checked'])) {
808 print '<td class="liste_titre"><input type="text" name="search_job" class="maxwidth75" value="'.$search_job.'"></td>';
809}
810if (!empty($arrayfields['u.salary']['checked'])) {
811 print '<td class="liste_titre"></td>';
812}
813if (!empty($arrayfields['u.datelastlogin']['checked'])) {
814 print '<td class="liste_titre"></td>';
815}
816if (!empty($arrayfields['u.datepreviouslogin']['checked'])) {
817 print '<td class="liste_titre"></td>';
818}
819// Extra fields
820include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
821// Fields from hook
822$parameters = array('arrayfields'=>$arrayfields);
823$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
824print $hookmanager->resPrint;
825if (!empty($arrayfields['u.datec']['checked'])) {
826 // Date creation
827 print '<td class="liste_titre">';
828 print '</td>';
829}
830if (!empty($arrayfields['u.tms']['checked'])) {
831 // Date modification
832 print '<td class="liste_titre">';
833 print '</td>';
834}
835if (!empty($arrayfields['u.statut']['checked'])) {
836 // Status
837 print '<td class="liste_titre center parentonrightofpage">';
838 print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'search_status width100 onrightofpage');
839 print '</td>';
840}
841// Action column
842if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
843 print '<td class="liste_titre maxwidthsearch">';
844 $searchpicto = $form->showFilterButtons();
845 print $searchpicto;
846 print '</td>';
847}
848print '</tr>'."\n";
849
850$totalarray = array();
851$totalarray['nbfield'] = 0;
852
853// Fields title label
854// --------------------------------------------------------------------
855print '<tr class="liste_titre">';
856if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
857 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
858 $totalarray['nbfield']++;
859}
860if (!empty($arrayfields['u.rowid']['checked'])) {
861 print_liste_field_titre($arrayfields['u.rowid']['label'], $_SERVER['PHP_SELF'], "u.rowid", $param, "", "", $sortfield, $sortorder);
862 $totalarray['nbfield']++;
863}
864if (!empty($arrayfields['u.login']['checked'])) {
865 print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER['PHP_SELF'], "u.login", $param, "", "", $sortfield, $sortorder);
866 $totalarray['nbfield']++;
867}
868if (!empty($arrayfields['u.lastname']['checked'])) {
869 print_liste_field_titre("Lastname", $_SERVER['PHP_SELF'], "u.lastname", $param, "", "", $sortfield, $sortorder);
870 $totalarray['nbfield']++;
871}
872if (!empty($arrayfields['u.firstname']['checked'])) {
873 print_liste_field_titre("FirstName", $_SERVER['PHP_SELF'], "u.firstname", $param, "", "", $sortfield, $sortorder);
874 $totalarray['nbfield']++;
875}
876if (!empty($arrayfields['u.gender']['checked'])) {
877 print_liste_field_titre("Gender", $_SERVER['PHP_SELF'], "u.gender", $param, "", "", $sortfield, $sortorder, 'center ');
878 $totalarray['nbfield']++;
879}
880if (!empty($arrayfields['u.employee']['checked'])) {
881 print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder, 'center ');
882 $totalarray['nbfield']++;
883}
884if (!empty($arrayfields['u.fk_user']['checked'])) {
885 print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder);
886 $totalarray['nbfield']++;
887}
888if (!empty($arrayfields['u.accountancy_code']['checked'])) {
889 print_liste_field_titre("AccountancyCode", $_SERVER['PHP_SELF'], "u.accountancy_code", $param, "", "", $sortfield, $sortorder);
890 $totalarray['nbfield']++;
891}
892if (!empty($arrayfields['u.office_phone']['checked'])) {
893 print_liste_field_titre("PhonePro", $_SERVER['PHP_SELF'], "u.office_phone", $param, "", "", $sortfield, $sortorder);
894 $totalarray['nbfield']++;
895}
896if (!empty($arrayfields['u.user_mobile']['checked'])) {
897 print_liste_field_titre("PhoneMobile", $_SERVER['PHP_SELF'], "u.user_mobile", $param, "", "", $sortfield, $sortorder);
898 $totalarray['nbfield']++;
899}
900if (!empty($arrayfields['u.email']['checked'])) {
901 print_liste_field_titre("EMail", $_SERVER['PHP_SELF'], "u.email", $param, "", "", $sortfield, $sortorder);
902 $totalarray['nbfield']++;
903}
904if (!empty($arrayfields['u.api_key']['checked'])) {
905 print_liste_field_titre("ApiKey", $_SERVER['PHP_SELF'], "u.api_key", $param, "", "", $sortfield, $sortorder);
906 $totalarray['nbfield']++;
907}
908if (!empty($arrayfields['u.fk_soc']['checked'])) {
909 print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "u.fk_soc", $param, "", "", $sortfield, $sortorder);
910 $totalarray['nbfield']++;
911}
912if (!empty($arrayfields['u.entity']['checked'])) {
913 print_liste_field_titre($arrayfields['u.entity']['label'], $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder);
914 $totalarray['nbfield']++;
915}
916if (!empty($arrayfields['u.ref_employee']['checked'])) {
917 print_liste_field_titre("RefEmployee", $_SERVER['PHP_SELF'], "u.ref_employee", $param, "", "", $sortfield, $sortorder);
918 $totalarray['nbfield']++;
919}
920if (!empty($arrayfields['u.national_registration_number']['checked'])) {
921 print_liste_field_titre("NationalRegistrationNumber", $_SERVER['PHP_SELF'], "u.national_registration_number", $param, "", "", $sortfield, $sortorder);
922 $totalarray['nbfield']++;
923}
924if (!empty($arrayfields['u.job']['checked'])) {
925 print_liste_field_titre($arrayfields['u.job']['label'], $_SERVER['PHP_SELF'], "u.job", $param, "", "", $sortfield, $sortorder);
926 $totalarray['nbfield']++;
927}
928if (!empty($arrayfields['u.salary']['checked'])) {
929 print_liste_field_titre("Salary", $_SERVER['PHP_SELF'], "u.salary", $param, "", "", $sortfield, $sortorder, 'right ');
930 $totalarray['nbfield']++;
931}
932if (!empty($arrayfields['u.datelastlogin']['checked'])) {
933 print_liste_field_titre("LastConnexion", $_SERVER['PHP_SELF'], "u.datelastlogin", $param, "", '', $sortfield, $sortorder, 'center ');
934 $totalarray['nbfield']++;
935}
936if (!empty($arrayfields['u.datepreviouslogin']['checked'])) {
937 print_liste_field_titre("PreviousConnexion", $_SERVER['PHP_SELF'], "u.datepreviouslogin", $param, "", '', $sortfield, $sortorder, 'center ');
938 $totalarray['nbfield']++;
939}
940// Extra fields
941include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
942// Hook fields
943$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
944$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
945print $hookmanager->resPrint;
946if (!empty($arrayfields['u.datec']['checked'])) {
947 print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "u.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
948 $totalarray['nbfield']++;
949}
950if (!empty($arrayfields['u.tms']['checked'])) {
951 print_liste_field_titre("DateModificationShort", $_SERVER["PHP_SELF"], "u.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
952 $totalarray['nbfield']++;
953}
954if (!empty($arrayfields['u.statut']['checked'])) {
955 print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "u.statut", "", $param, '', $sortfield, $sortorder, 'center ');
956 $totalarray['nbfield']++;
957}
958// Action column
959if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
960 print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
961 $totalarray['nbfield']++;
962}
963print '</tr>'."\n";
964
965
966// Detect if we need a fetch on each output line
967$needToFetchEachLine = 0;
968if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
969 foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
970 if (!is_null($val) && preg_match('/\$object/', $val)) {
971 $needToFetchEachLine++; // There is at least one compute field that use $object
972 }
973 }
974}
975
976
977// Loop on record
978// --------------------------------------------------------------------
979$i = 0;
980$savnbfield = $totalarray['nbfield'];
981$totalarray = array('val'=>array('u.salary'=>0));
982$totalarray['nbfield'] = 0;
983$imaxinloop = ($limit ? min($num, $limit) : $num);
984while ($i < $imaxinloop) {
985 $obj = $db->fetch_object($resql);
986 if (empty($obj)) {
987 break; // Should not happen
988 }
989
990 if (empty($obj->country_code)) {
991 $obj->country_code = ''; // TODO Add join in select with country table to get country_code
992 }
993
994 // Store properties in $object
995 $object->setVarsFromFetchObj($obj);
996
997 $object->id = $obj->rowid;
998 $object->admin = $obj->admin;
999 $object->ref = $obj->rowid;
1000 $object->login = $obj->login;
1001 $object->statut = $obj->status;
1002 $object->status = $obj->status;
1003 $object->office_phone = $obj->office_phone;
1004 $object->user_mobile = $obj->user_mobile;
1005 $object->job = $obj->job;
1006 $object->email = $obj->email;
1007 $object->gender = $obj->gender;
1008 $object->socid = $obj->fk_soc;
1009 $object->firstname = $obj->firstname;
1010 $object->lastname = $obj->lastname;
1011 $object->employee = $obj->employee;
1012 $object->photo = $obj->photo;
1013 $object->datestartvalidity = $db->jdate($obj->datestartvalidity);
1014 $object->dateendvalidity = $db->jdate($obj->dateendvalidity);
1015
1016 $li = $object->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1);
1017
1018 $canreadhrmdata = 0;
1019 if ((isModEnabled('salaries') && $user->hasRight("salaries", "read") && in_array($obj->rowid, $childids))
1020 || (isModEnabled('salaries') && $user->hasRight("salaries", "readall"))
1021 || (isModEnabled('hrm') && $user->hasRight("hrm", "employee", "read"))) {
1022 $canreadhrmdata = 1;
1023 }
1024 $canreadsecretapi = 0;
1025 if ($user->id == $obj->rowid || !empty($user->admin)) { // Current user or admin
1026 $canreadsecretapi = 1;
1027 }
1028
1029 if ($mode == 'kanban') {
1030 if ($i == 0) {
1031 print '<tr class="trkanban"><td colspan="'.$savnbfield.'">';
1032 print '<div class="box-flex-container kanban">';
1033 }
1034
1035 // Output Kanban
1036 $selected = -1;
1037 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1038 $selected = 0;
1039 if (in_array($object->id, $arrayofselected)) {
1040 $selected = 1;
1041 }
1042 }
1043 print $object->getKanbanView('', array('selected' => $selected));
1044 if ($i == ($imaxinloop - 1)) {
1045 print '</div>';
1046 print '</td></tr>';
1047 }
1048 } else {
1049 // Show here line of result
1050 $j = 0;
1051 print '<tr data-rowid="'.$object->id.'" class="oddeven">';
1052 // Action column
1053 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1054 print '<td class="nowrap center">';
1055 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1056 $selected = 0;
1057 if (in_array($object->id, $arrayofselected)) {
1058 $selected = 1;
1059 }
1060 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1061 }
1062 print '</td>';
1063 if (!$i) {
1064 $totalarray['nbfield']++;
1065 }
1066 }
1067 // TechnicalID
1068 if (!empty($arrayfields['u.rowid']['checked'])) {
1069 print '<td class="nowraponall">'.dol_escape_htmltag($obj->rowid).'</td>';
1070 if (!$i) {
1071 $totalarray['nbfield']++;
1072 }
1073 }
1074 // Login
1075 if (!empty($arrayfields['u.login']['checked'])) {
1076 print '<td class="nowraponall tdoverflowmax150">';
1077 print $li;
1078 if (isModEnabled('multicompany') && $obj->admin && !$obj->entity) {
1079 print img_picto($langs->trans("SuperAdministratorDesc"), 'redstar', 'class="valignmiddle paddingright paddingleft"');
1080 } elseif ($obj->admin) {
1081 print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="valignmiddle paddingright paddingleft"');
1082 }
1083 print '</td>';
1084 if (!$i) {
1085 $totalarray['nbfield']++;
1086 }
1087 }
1088 if (!empty($arrayfields['u.lastname']['checked'])) {
1089 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->lastname).'</td>';
1090 if (!$i) {
1091 $totalarray['nbfield']++;
1092 }
1093 }
1094 if (!empty($arrayfields['u.firstname']['checked'])) {
1095 print '<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).'">'.dol_escape_htmltag($obj->firstname).'</td>';
1096 if (!$i) {
1097 $totalarray['nbfield']++;
1098 }
1099 }
1100 if (!empty($arrayfields['u.gender']['checked'])) {
1101 print '<td class="center">';
1102 if ($obj->gender) {
1103 // Preparing gender's display if there is one
1104 $addgendertxt = '';
1105 switch ($obj->gender) {
1106 case 'man':
1107 $addgendertxt .= '<i class="fas fa-mars" title="'.dol_escape_htmltag($langs->trans("Gender".$obj->gender)).'"></i>';
1108 break;
1109 case 'woman':
1110 $addgendertxt .= '<i class="fas fa-venus" title="'.dol_escape_htmltag($langs->trans("Gender".$obj->gender)).'"></i>';
1111 break;
1112 case 'other':
1113 $addgendertxt .= '<i class="fas fa-transgender" title="'.dol_escape_htmltag($langs->trans("Gender".$obj->gender)).'"></i>';
1114 break;
1115 }
1116 print $addgendertxt;
1117 //print $langs->trans("Gender".$obj->gender);
1118 }
1119 print '</td>';
1120 if (!$i) {
1121 $totalarray['nbfield']++;
1122 }
1123 }
1124 // Employee yes/no
1125 if (!empty($arrayfields['u.employee']['checked'])) {
1126 print '<td class="center">'.yn($obj->employee).'</td>';
1127 if (!$i) {
1128 $totalarray['nbfield']++;
1129 }
1130 }
1131
1132 // Supervisor
1133 if (!empty($arrayfields['u.fk_user']['checked'])) {
1134 print '<td class="tdoverflowmax125">';
1135 if ($obj->login2) {
1136 $user2->id = $obj->id2;
1137 $user2->login = $obj->login2;
1138 $user2->lastname = $obj->lastname2;
1139 $user2->firstname = $obj->firstname2;
1140 $user2->gender = $obj->gender2;
1141 $user2->photo = $obj->photo2;
1142 $user2->admin = $obj->admin2;
1143 $user2->office_phone = $obj->office_phone;
1144 $user2->user_mobile = $obj->user_mobile;
1145 $user2->email = $obj->email2;
1146 $user2->socid = $obj->fk_soc2;
1147 $user2->statut = $obj->status2;
1148 $user2->status = $obj->status2;
1149 if (isModEnabled('multicompany') && $obj->admin2 && !$obj->entity2) {
1150 print img_picto($langs->trans("SuperAdministratorDesc"), 'redstar', 'class="valignmiddle paddingright"');
1151 } elseif ($obj->admin2) {
1152 print img_picto($langs->trans("AdministratorDesc"), 'star', 'class="valignmiddle paddingright"');
1153 }
1154 print $user2->getNomUrl(-1, '', 0, 0, 24, 0, '', '', 1);
1155 }
1156 print '</td>';
1157 if (!$i) {
1158 $totalarray['nbfield']++;
1159 }
1160 }
1161
1162 if (!empty($arrayfields['u.accountancy_code']['checked'])) {
1163 print '<td>'.$obj->accountancy_code.'</td>';
1164 if (!$i) {
1165 $totalarray['nbfield']++;
1166 }
1167 }
1168
1169 // Phone
1170 if (!empty($arrayfields['u.office_phone']['checked'])) {
1171 print '<td class="tdoverflowmax125">'.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'phone')."</td>\n";
1172 if (!$i) {
1173 $totalarray['nbfield']++;
1174 }
1175 }
1176 if (!empty($arrayfields['u.user_mobile']['checked'])) {
1177 print '<td class="tdoverflowmax125">'.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid, 'AC_TEL', ' ', 'mobile')."</td>\n";
1178 if (!$i) {
1179 $totalarray['nbfield']++;
1180 }
1181 }
1182 if (!empty($arrayfields['u.email']['checked'])) {
1183 print '<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->fk_soc, 'AC_EMAIL', 0, 0, 1)."</td>\n";
1184 if (!$i) {
1185 $totalarray['nbfield']++;
1186 }
1187 }
1188 if (!empty($arrayfields['u.api_key']['checked'])) {
1189 $api_key = dolDecrypt($obj->api_key);
1190 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($api_key).'">';
1191 if ($api_key) {
1192 if ($canreadsecretapi) {
1193 print '<span class="opacitymedium">';
1194 print showValueWithClipboardCPButton($object->api_key, 1, dol_trunc($api_key, 3)); // TODO Add an option to also reveal the hash, not only copy paste
1195 print '</span>';
1196 } else {
1197 print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
1198 }
1199 }
1200 print '</td>';
1201 if (!$i) {
1202 $totalarray['nbfield']++;
1203 }
1204 }
1205 if (!empty($arrayfields['u.fk_soc']['checked'])) {
1206 print '<td class="tdoverflowmax150">';
1207 if ($obj->fk_soc > 0) {
1208 $companystatic->id = $obj->fk_soc;
1209 $companystatic->name = $obj->name;
1210 $companystatic->canvas = $obj->canvas;
1211 print $companystatic->getNomUrl(1);
1212 } elseif ($obj->ldap_sid) {
1213 print '<span class="opacitymedium">'.$langs->trans("DomainUser").'</span>';
1214 } else {
1215 print '<span class="opacitymedium">'.$langs->trans("InternalUser").'</span>';
1216 }
1217 print '</td>';
1218 if (!$i) {
1219 $totalarray['nbfield']++;
1220 }
1221 }
1222 // Multicompany enabled
1223 if (isModEnabled('multicompany') && is_object($mc) && !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) {
1224 if (!empty($arrayfields['u.entity']['checked'])) {
1225 if (!$obj->entity) {
1226 $labeltouse = $langs->trans("AllEntities");
1227 } else {
1228 $mc->getInfo($obj->entity);
1229 $labeltouse = $mc->label;
1230 }
1231 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltouse).'">';
1232 print $labeltouse;
1233 print '</td>';
1234 if (!$i) {
1235 $totalarray['nbfield']++;
1236 }
1237 }
1238 }
1239
1240 // Ref employee
1241 if (!empty($arrayfields['u.ref_employee']['checked'])) {
1242 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_employee).'">';
1243 print dol_escape_htmltag($obj->ref_employee);
1244 print '</td>';
1245 if (!$i) {
1246 $totalarray['nbfield']++;
1247 }
1248 }
1249 // National number
1250 if (!empty($arrayfields['u.national_registration_number']['checked'])) {
1251 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->national_registration_number).'">';
1252 print dol_escape_htmltag($obj->national_registration_number);
1253 print '</td>';
1254 if (!$i) {
1255 $totalarray['nbfield']++;
1256 }
1257 }
1258 // Job position
1259 if (!empty($arrayfields['u.job']['checked'])) {
1260 print '<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->job).'">';
1261 print dol_escape_htmltag($obj->job);
1262 print '</td>';
1263 if (!$i) {
1264 $totalarray['nbfield']++;
1265 }
1266 }
1267
1268 // Salary
1269 if (!empty($arrayfields['u.salary']['checked'])) {
1270 print '<td class="nowraponall right amount">';
1271 if ($obj->salary) {
1272 if ($canreadhrmdata) {
1273 print price($obj->salary);
1274 } else {
1275 print '<span class="opacitymedium">'.$langs->trans("Hidden").'</span>';
1276 }
1277 }
1278 print '</td>';
1279 if (!$i) {
1280 $totalarray['nbfield']++;
1281 }
1282 if (!$i) {
1283 $totalarray['pos'][$totalarray['nbfield']] = 'u.salary';
1284 }
1285 if (!isset($totalarray['val'])) {
1286 $totalarray['val'] = array();
1287 }
1288 if (!isset($totalarray['val']['u.salary'])) {
1289 $totalarray['val']['u.salary'] = 0;
1290 }
1291 $totalarray['val']['u.salary'] += $obj->salary;
1292 }
1293
1294 // Date last login
1295 if (!empty($arrayfields['u.datelastlogin']['checked'])) {
1296 print '<td class="nowrap center">'.dol_print_date($db->jdate($obj->datelastlogin), "dayhour").'</td>';
1297 if (!$i) {
1298 $totalarray['nbfield']++;
1299 }
1300 }
1301 // Date previous login
1302 if (!empty($arrayfields['u.datepreviouslogin']['checked'])) {
1303 print '<td class="nowrap center">'.dol_print_date($db->jdate($obj->datepreviouslogin), "dayhour").'</td>';
1304 if (!$i) {
1305 $totalarray['nbfield']++;
1306 }
1307 }
1308
1309 // Extra fields
1310 include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
1311 // Fields from hook
1312 $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1313 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
1314 print $hookmanager->resPrint;
1315 // Date creation
1316 if (!empty($arrayfields['u.datec']['checked'])) {
1317 print '<td class="center nowraponall">';
1318 print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
1319 print '</td>';
1320 if (!$i) {
1321 $totalarray['nbfield']++;
1322 }
1323 }
1324 // Date modification
1325 if (!empty($arrayfields['u.tms']['checked'])) {
1326 print '<td class="center nowraponall">';
1327 print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
1328 print '</td>';
1329 if (!$i) {
1330 $totalarray['nbfield']++;
1331 }
1332 }
1333 // Status
1334 if (!empty($arrayfields['u.statut']['checked'])) {
1335 print '<td class="center">'.$object->getLibStatut(5).'</td>';
1336 if (!$i) {
1337 $totalarray['nbfield']++;
1338 }
1339 }
1340 // Action column
1341 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1342 print '<td class="nowrap center">';
1343 if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1344 $selected = 0;
1345 if (in_array($object->id, $arrayofselected)) {
1346 $selected = 1;
1347 }
1348 print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
1349 }
1350 print '</td>';
1351 if (!$i) {
1352 $totalarray['nbfield']++;
1353 }
1354 }
1355
1356 print '</tr>'."\n";
1357 }
1358
1359 $i++;
1360}
1361
1362// Show total line
1363include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1364
1365// If no record found
1366if ($num == 0) {
1367 $colspan = 1;
1368 foreach ($arrayfields as $key => $val) {
1369 if (!empty($val['checked'])) {
1370 $colspan++;
1371 }
1372 }
1373 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1374}
1375
1376
1377$db->free($resql);
1378
1379$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1380$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1381print $hookmanager->resPrint;
1382
1383print '</table>'."\n";
1384print '</div>'."\n";
1385
1386print '</form>'."\n";
1387
1388
1389// End of page
1390llxFooter();
1391$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage categories.
Class to manage standard extra fields.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
Class with static methods for building HTML components related to products Only components common to ...
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a 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)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
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.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
dolDecrypt($chain, $key='')
Decode a string with a symetric encryption.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.