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