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