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