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