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