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