29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
36 $langs->loadLangs(array(
'users',
'companies',
'hrm',
'salaries'));
38 $action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
39 $massaction =
GETPOST(
'massaction',
'alpha');
40 $show_files =
GETPOST(
'show_files',
'int');
41 $confirm =
GETPOST(
'confirm',
'alpha');
42 $cancel =
GETPOST(
'cancel',
'alpha');
43 $toselect =
GETPOST(
'toselect',
'array');
44 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userlist';
45 $backtopage =
GETPOST(
'backtopage',
'alpha');
46 $optioncss =
GETPOST(
'optioncss',
'aZ');
47 $mode =
GETPOST(
"mode",
'alpha');
51 if ($user->socid > 0) {
52 $socid = $user->socid;
56 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
57 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
58 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
60 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
64 $offset = $limit * $page;
65 $pageprev = $page - 1;
66 $pagenext = $page + 1;
69 $object =
new User($db);
71 $diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
72 $hookmanager->initHooks(array(
'userlist'));
75 $extrafields->fetch_name_optionals_label($object->table_element);
77 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
80 $sortfield =
"u.login";
87 $search_all =
GETPOST(
'search_all',
'alphanohtml') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml');
89 foreach ($object->fields as $key => $val) {
90 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
91 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
93 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
94 $search[$key.
'_dtstart'] =
dol_mktime(0, 0, 0,
GETPOST(
'search_'.$key.
'_dtstartmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtstartday',
'int'),
GETPOST(
'search_'.$key.
'_dtstartyear',
'int'));
95 $search[$key.
'_dtend'] =
dol_mktime(23, 59, 59,
GETPOST(
'search_'.$key.
'_dtendmonth',
'int'),
GETPOST(
'search_'.$key.
'_dtendday',
'int'),
GETPOST(
'search_'.$key.
'_dtendyear',
'int'));
99 $userstatic =
new User($db);
100 $companystatic =
new Societe($db);
104 $fieldstosearchall = array(
106 'u.lastname'=>
"Lastname",
107 'u.firstname'=>
"Firstname",
108 'u.accountancy_code'=>
"AccountancyCode",
109 'u.office_phone'=>
"PhonePro",
110 'u.user_mobile'=>
"PhoneMobile",
112 'u.note_public'=>
"NotePublic",
113 'u.note_private'=>
"NotePrivate"
115 if (!empty($conf->api->enabled)) {
116 $fieldstosearchall[
'u.api_key'] =
"ApiKey";
120 $arrayfields = array(
121 'u.login'=>array(
'label'=>
"Login",
'checked'=>1,
'position'=>10),
122 'u.lastname'=>array(
'label'=>
"Lastname",
'checked'=>1,
'position'=>15),
123 'u.firstname'=>array(
'label'=>
"Firstname",
'checked'=>1,
'position'=>20),
124 'u.entity'=>array(
'label'=>
"Entity",
'checked'=>1,
'position'=>50,
'enabled'=>(
isModEnabled(
'multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
125 'u.gender'=>array(
'label'=>
"Gender",
'checked'=>0,
'position'=>22),
126 'u.employee'=>array(
'label'=>
"Employee",
'checked'=>($contextpage ==
'employeelist' ? 1 : 0),
'position'=>25),
127 'u.fk_user'=>array(
'label'=>
"HierarchicalResponsible",
'checked'=>1,
'position'=>27),
128 'u.accountancy_code'=>array(
'label'=>
"AccountancyCode",
'checked'=>0,
'position'=>30),
129 'u.office_phone'=>array(
'label'=>
"PhonePro",
'checked'=>1,
'position'=>31),
130 'u.user_mobile'=>array(
'label'=>
"PhoneMobile",
'checked'=>1,
'position'=>32),
131 'u.email'=>array(
'label'=>
"EMail",
'checked'=>1,
'position'=>35),
132 'u.api_key'=>array(
'label'=>
"ApiKey",
'checked'=>0,
'position'=>40,
"enabled"=>(!empty($conf->api->enabled) && $user->admin)),
133 'u.fk_soc'=>array(
'label'=>
"Company",
'checked'=>($contextpage ==
'employeelist' ? 0 : 1),
'position'=>45),
134 'u.job'=>array(
'label'=>
"PostOrFunction",
'checked'=>-1,
'position'=>50),
135 'u.salary'=>array(
'label'=>
"Salary",
'checked'=>1,
'position'=>80,
'enabled'=>(!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))),
136 'u.datelastlogin'=>array(
'label'=>
"LastConnexion",
'checked'=>1,
'position'=>100),
137 'u.datepreviouslogin'=>array(
'label'=>
"PreviousConnexion",
'checked'=>0,
'position'=>110),
138 'u.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500),
139 'u.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500),
140 'u.statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000),
143 include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
149 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
150 $search_user =
GETPOST(
'search_user',
'alpha');
151 $search_login =
GETPOST(
'search_login',
'alpha');
152 $search_lastname =
GETPOST(
'search_lastname',
'alpha');
153 $search_firstname =
GETPOST(
'search_firstname',
'alpha');
154 $search_gender =
GETPOST(
'search_gender',
'alpha');
155 $search_employee =
GETPOST(
'search_employee',
'alpha');
156 $search_accountancy_code =
GETPOST(
'search_accountancy_code',
'alpha');
157 $search_phonepro =
GETPOST(
'search_phonepro',
'alpha');
158 $search_phonemobile =
GETPOST(
'search_phonemobile',
'alpha');
159 $search_email =
GETPOST(
'search_email',
'alpha');
160 $search_api_key =
GETPOST(
'search_api_key',
'alphanohtml');
161 $search_statut =
GETPOST(
'search_statut',
'intcomma');
162 $search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
163 $search_job =
GETPOST(
'search_job',
'alpha');
164 $search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
165 $search_supervisor =
GETPOST(
'search_supervisor',
'intcomma');
166 $search_categ =
GETPOST(
"search_categ",
'int');
167 $searchCategoryUserOperator = 0;
169 $searchCategoryUserOperator =
GETPOSTINT(
'search_category_user_operator');
170 } elseif (!empty($conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT)) {
171 $searchCategoryUserOperator = $conf->global->MAIN_SEARCH_CAT_OR_BY_DEFAULT;
173 $searchCategoryUserList =
GETPOST(
'search_category_user_list',
'array');
174 $catid =
GETPOST(
'catid',
'int');
175 if (!empty($catid) && empty($searchCategoryUserList)) {
176 $searchCategoryUserList = array($catid);
178 $catid =
GETPOST(
'catid',
'int');
179 if (!empty($catid) && empty($search_categ)) {
180 $search_categ = $catid;
184 if ($search_statut ==
'') {
185 $search_statut =
'1';
187 if ($contextpage ==
'employeelist' && !
GETPOSTISSET(
'search_employee')) {
188 $search_employee = 1;
192 $permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
193 $canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
194 $canedituser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
195 $candisableuser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
196 $canreadgroup = $canreaduser;
197 $caneditgroup = $canedituser;
198 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
199 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
200 $caneditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
206 if (
isModEnabled(
'salaries') && $contextpage ==
'employeelist' && $search_employee == 1) {
207 if (!$user->hasRight(
"salaries",
"read")) {
211 if (!$user->hasRight(
"user",
"user",
"read") && empty($user->admin)) {
216 $childids = $user->getAllChildIds(1);
223 if (
GETPOST(
'cancel',
'alpha')) {
227 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
231 $parameters = array();
232 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
237 if (empty($reshook)) {
239 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
242 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
245 $search_lastname =
"";
246 $search_firstname =
"";
248 $search_employee =
"";
249 $search_accountancy_code =
"";
250 $search_phonepro =
"";
251 $search_phonemobile =
"";
254 $search_thirdparty =
"";
256 $search_warehouse =
"";
257 $search_supervisor =
"";
258 $search_api_key =
"";
259 $search_datelastlogin =
"";
260 $search_datepreviouslogin =
"";
261 $search_date_creation =
"";
262 $search_date_update =
"";
265 $search_array_options = array();
267 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
268 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
273 $objectclass =
'User';
274 $objectlabel =
'User';
275 $uploaddir = $conf->user->dir_output;
276 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
279 if (!$error && ($massaction ==
'disable' || $massaction ==
'reactivate') && $permissiontoadd) {
280 $objecttmp =
new User($db);
286 foreach ($toselect as $toselectid) {
287 if ($toselectid == $user->id) {
288 setEventMessages($langs->trans($massaction == 0 ?
'CantDisableYourself' :
'CanEnableYourself'),
null,
'errors');
293 $result = $objecttmp->fetch($toselectid);
295 if ($objecttmp->admin) {
296 setEventMessages($langs->trans($massaction == 0 ?
'CantDisableAnAdminUserWithMassActions' :
'CantEnableAnAdminUserWithMassActions', $objecttmp->login),
null,
'errors');
301 $result = $objecttmp->setstatus($massaction ==
'disable' ? 0 : 1);
304 } elseif ($result < 0) {
318 if (!$error && !empty($conf->file->main_limit_users)) {
319 $nb = $object->getNbOfUsers(
"active");
320 if ($nb >= $conf->file->main_limit_users) {
322 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
346 $user2 =
new User($db);
350 $help_url =
'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
351 if ($contextpage ==
'employeelist' && $search_employee == 1) {
352 $title = $langs->trans(
"Employees");
354 $title = $langs->trans(
"Users");
362 $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,";
363 $sql .=
" u.fk_user,";
364 $sql .=
" u.job, u.salary, u.datelastlogin, u.datepreviouslogin,";
365 $sql .=
" u.ldap_sid, u.statut as status, u.entity,";
366 $sql .=
" u.tms as date_update, u.datec as date_creation,";
367 $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,";
368 $sql .=
" s.nom as name, s.canvas";
370 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
371 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
372 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
376 $parameters = array();
377 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
378 $sql .= preg_replace(
'/^,/',
'', $hookmanager->resPrint);
379 $sql = preg_replace(
'/,\s*$/',
'', $sql);
383 $sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as u";
384 if (isset($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
385 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (u.rowid = ef.fk_object)";
387 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
388 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u2 ON u.fk_user = u2.rowid";
390 $parameters = array();
391 $reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
392 $sql .= $hookmanager->resPrint;
394 $sql .= $hookmanager->resPrint;
396 $sql .=
" WHERE u.entity IN (".getEntity($object->element).
")";
398 $sql .=
" AND u.fk_soc = ".((int) $socid);
401 if ($search_supervisor > 0) {
402 $sql .=
" AND u.fk_user IN (".$db->sanitize($search_supervisor).
")";
404 if ($search_thirdparty !=
'') {
407 if ($search_warehouse > 0) {
408 $sql .=
natural_search(array(
'u.fk_warehouse'), $search_warehouse);
410 if ($search_login !=
'') {
413 if ($search_lastname !=
'') {
416 if ($search_firstname !=
'') {
419 if ($search_gender !=
'' && $search_gender !=
'-1') {
420 $sql .=
" AND u.gender = '".$db->escape($search_gender).
"'";
422 if (is_numeric($search_employee) && $search_employee >= 0) {
423 $sql .=
' AND u.employee = '.(int) $search_employee;
425 if ($search_accountancy_code !=
'') {
426 $sql .=
natural_search(
"u.accountancy_code", $search_accountancy_code);
428 if ($search_phonepro !=
'') {
431 if ($search_phonemobile !=
'') {
434 if ($search_email !=
'') {
437 if ($search_api_key !=
'') {
440 if ($search_job !=
'') {
443 if ($search_statut !=
'' && $search_statut >= 0) {
444 $sql .=
" AND u.statut IN (".$db->sanitize($search_statut).
")";
450 $searchCategoryUserList = array($search_categ);
451 if (!empty($searchCategoryUserList)) {
452 $searchCategoryUserSqlList = array();
453 $listofcategoryid =
'';
454 foreach ($searchCategoryUserList as $searchCategoryUser) {
455 if (intval($searchCategoryUser) == -2) {
456 $searchCategoryUserSqlList[] =
"NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user)";
457 } elseif (intval($searchCategoryUser) > 0) {
458 if ($searchCategoryUserOperator == 0) {
459 $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).
")";
461 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryUser);
465 if ($listofcategoryid) {
466 $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).
"))";
468 if ($searchCategoryUserOperator == 1) {
469 if (!empty($searchCategoryUserSqlList)) {
470 $sql .=
" AND (".implode(
' OR ', $searchCategoryUserSqlList).
")";
473 if (!empty($searchCategoryUserSqlList)) {
474 $sql .=
" AND (".implode(
' AND ', $searchCategoryUserSqlList).
")";
478 if ($search_warehouse > 0) {
479 $sql .=
" AND u.fk_warehouse = ".((int) $search_warehouse);
481 if (
isModEnabled(
'salaries') && $contextpage ==
'employeelist' && !$user->hasRight(
"salaries",
"readall")) {
482 $sql .=
" AND u.rowid IN (".$db->sanitize(join(
',', $childids)).
")";
485 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
487 $parameters = array();
488 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
489 $sql .= $hookmanager->resPrint;
493 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
495 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
496 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
497 $resql = $db->query($sqlforcount);
499 $objforcount = $db->fetch_object(
$resql);
513 $sql .= $db->order($sortfield, $sortorder);
515 $sql .= $db->plimit($limit + 1, $offset);
518 $resql = $db->query($sql);
524 $num = $db->num_rows(
$resql);
527 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
528 $obj = $db->fetch_object(
$resql);
530 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.$id);
539 $arrayofselected = is_array($toselect) ? $toselect : array();
543 $param .=
'&mode='.urlencode($mode);
545 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
546 $param .=
'&contextpage='.urlencode($contextpage);
548 if ($limit > 0 && $limit != $conf->liste_limit) {
549 $param .=
'&limit='.urlencode($limit);
552 $param .=
'&sall='.urlencode($sall);
554 if ($search_user !=
'') {
555 $param .=
"&search_user=".urlencode($search_user);
557 if ($search_login !=
'') {
558 $param .=
"&search_login=".urlencode($search_login);
560 if ($search_lastname !=
'') {
561 $param .=
"&search_lastname=".urlencode($search_lastname);
563 if ($search_firstname !=
'') {
564 $param .=
"&search_firstname=".urlencode($search_firstname);
566 if ($search_gender !=
'' && $search_gender !=
'-1') {
567 $param .=
"&search_gender=".urlencode($search_gender);
569 if ($search_employee !=
'' && $search_employee !=
'-1') {
570 $param .=
"&search_employee=".urlencode($search_employee);
572 if ($search_accountancy_code !=
'') {
573 $param .=
"&search_accountancy_code=".urlencode($search_accountancy_code);
575 if ($search_phonepro !=
'') {
576 $param .=
"&search_phonepro=".urlencode($search_phonepro);
578 if ($search_phonemobile !=
'') {
579 $param .=
"&search_phonemobile=".urlencode($search_phonemobile);
581 if ($search_email !=
'') {
582 $param .=
"&search_email=".urlencode($search_email);
584 if ($search_api_key !=
'') {
585 $param .=
"&search_api_key=".urlencode($search_api_key);
587 if ($search_supervisor > 0) {
588 $param .=
"&search_supervisor=".urlencode($search_supervisor);
590 if ($search_statut !=
'') {
591 $param .=
"&search_statut=".urlencode($search_statut);
593 if ($optioncss !=
'') {
594 $param .=
'&optioncss='.urlencode($optioncss);
596 if ($search_categ > 0) {
597 $param .=
'&search_categ='.urlencode($search_categ);
599 if ($search_warehouse > 0) {
600 $param .=
'&search_warehouse='.urlencode($search_warehouse);
603 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
606 $arrayofmassactions = array();
607 if ($permissiontoadd) {
608 $arrayofmassactions[
'disable'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"DisableUser");
610 if ($permissiontoadd) {
611 $arrayofmassactions[
'reactivate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Reactivate");
614 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
616 if ($permissiontoadd) {
617 $arrayofmassactions[
'presetsupervisor'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"SetSupervisor");
621 if (
GETPOST(
'nomassaction',
'int') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'presetsupervisor'))) {
622 $arrayofmassactions = array();
624 $massactionbutton =
$form->selectMassAction(
'', $arrayofmassactions);
626 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
627 if ($optioncss !=
'') {
628 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
630 print
'<input type="hidden" name="token" value="'.newToken().
'">';
631 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
632 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
633 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
634 print
'<input type="hidden" name="page" value="'.$page.
'">';
635 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
636 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
638 $url = DOL_URL_ROOT.
'/user/card.php?action=create'.($contextpage ==
'employeelist' ?
'&search_employee=1' :
'').
'&leftmenu=';
639 if (!empty($socid)) {
640 $url .=
'&socid='.urlencode($socid);
644 $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'));
645 $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'));
646 $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'));
648 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewUser'),
'',
'fa fa-plus-circle', $url,
'', $permissiontoadd);
655 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num,
$nbtotalofrecords,
'user', 0, $morehtmlright.
' '.$newcardbutton,
'', $limit, 0, 0, 1);
660 $topicmail =
"SendUserRef";
662 $objecttmp =
new User($db);
663 $trackid =
'use'.$object->id;
664 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
666 if (!empty($catid)) {
667 print
"<div id='ways'>";
669 $ways = $c->print_all_ways(
' > ',
'user/list.php');
670 print
" > ".$ways[0].
"<br>\n";
675 foreach ($fieldstosearchall as $key => $val) {
676 $fieldstosearchall[$key] = $langs->trans($val);
678 print
'<!-- Search done like if USER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
679 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
688 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
689 $moreforfilter .=
'<div class="divsearchfield">';
690 $tmptitle = $langs->trans(
'Category');
691 $moreforfilter .=
img_picto($langs->trans(
"Category"),
'category',
'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ,
'search_categ', 1, $tmptitle);
692 $moreforfilter .=
'</div>';
695 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
696 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
698 $moreforfilter .=
'<div class="divsearchfield">';
699 $tmptitle = $langs->trans(
'Warehouse');
700 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
701 $moreforfilter .=
'</div>';
704 $parameters = array();
705 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object);
706 if (empty($reshook)) {
707 $moreforfilter .= $hookmanager->resPrint;
709 $moreforfilter = $hookmanager->resPrint;
712 if (!empty($moreforfilter)) {
713 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
714 print $moreforfilter;
718 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
719 $selectedfields =
$form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
720 $selectedfields .= (count($arrayofmassactions) ?
$form->showCheckAddButtons(
'checkforselect', 1) :
'');
722 print
'<div class="div-table-responsive">';
723 print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
727 print
'<tr class="liste_titre">';
729 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
730 print
'<td class="liste_titre maxwidthsearch">';
731 $searchpicto =
$form->showFilterButtons(
'left');
735 if (!empty($arrayfields[
'u.login'][
'checked'])) {
736 print
'<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.
'"></td>';
738 if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
739 print
'<td class="liste_titre"><input type="text" name="search_lastname" class="maxwidth50" value="'.$search_lastname.
'"></td>';
741 if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
742 print
'<td class="liste_titre"><input type="text" name="search_firstname" class="maxwidth50" value="'.$search_firstname.
'"></td>';
744 if (!empty($arrayfields[
'u.gender'][
'checked'])) {
745 print
'<td class="liste_titre center">';
746 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
747 print
$form->selectarray(
'search_gender', $arraygender, $search_gender, 1);
750 if (!empty($arrayfields[
'u.employee'][
'checked'])) {
751 print
'<td class="liste_titre">';
752 print
$form->selectyesno(
'search_employee', $search_employee, 1,
false, 1);
756 if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
757 print
'<td class="liste_titre">';
758 print
$form->select_dolusers($search_supervisor,
'search_supervisor', 1, array(), 0,
'', 0, 0, 0, 0,
'', 0,
'',
'maxwidth150');
761 if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
762 print
'<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.
'"></td>';
764 if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
765 print
'<td class="liste_titre"><input type="text" name="search_phonepro" class="maxwidth50" value="'.$search_phonepro.
'"></td>';
767 if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
768 print
'<td class="liste_titre"><input type="text" name="search_phonemobile" class="maxwidth50" value="'.$search_phonemobile.
'"></td>';
770 if (!empty($arrayfields[
'u.email'][
'checked'])) {
771 print
'<td class="liste_titre"><input type="text" name="search_email" class="maxwidth75" value="'.$search_email.
'"></td>';
773 if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
774 print
'<td class="liste_titre"><input type="text" name="search_api_key" class="maxwidth50" value="'.$search_api_key.
'"></td>';
776 if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
777 print
'<td class="liste_titre"><input type="text" name="search_thirdparty" class="maxwidth75" value="'.$search_thirdparty.
'"></td>';
779 if (!empty($arrayfields[
'u.entity'][
'checked'])) {
780 print
'<td class="liste_titre"></td>';
782 if (!empty($arrayfields[
'u.job'][
'checked'])) {
783 print
'<td class="liste_titre"><input type="text" name="search_job" class="maxwidth75" value="'.$search_job.
'"></td>';
785 if (!empty($arrayfields[
'u.salary'][
'checked'])) {
786 print
'<td class="liste_titre"></td>';
788 if (!empty($arrayfields[
'u.datelastlogin'][
'checked'])) {
789 print
'<td class="liste_titre"></td>';
791 if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked'])) {
792 print
'<td class="liste_titre"></td>';
795 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
797 $parameters = array(
'arrayfields'=>$arrayfields);
798 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
799 print $hookmanager->resPrint;
800 if (!empty($arrayfields[
'u.datec'][
'checked'])) {
802 print
'<td class="liste_titre">';
805 if (!empty($arrayfields[
'u.tms'][
'checked'])) {
807 print
'<td class="liste_titre">';
810 if (!empty($arrayfields[
'u.statut'][
'checked'])) {
812 print
'<td class="liste_titre center">';
813 print
$form->selectarray(
'search_statut', array(
'-1'=>
'',
'0'=>$langs->trans(
'Disabled'),
'1'=>$langs->trans(
'Enabled')), $search_statut, 0, 0, 0,
'', 0, 0, 0,
'',
'search_status minwidth75imp maxwidth125 onrightofpage');
817 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
818 print
'<td class="liste_titre maxwidthsearch">';
819 $searchpicto =
$form->showFilterButtons();
825 $totalarray = array();
826 $totalarray[
'nbfield'] = 0;
830 print
'<tr class="liste_titre">';
831 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
832 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
833 $totalarray[
'nbfield']++;
835 if (!empty($arrayfields[
'u.login'][
'checked'])) {
836 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
'PHP_SELF'],
"u.login", $param,
"",
"", $sortfield, $sortorder);
837 $totalarray[
'nbfield']++;
839 if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
840 print_liste_field_titre(
"Lastname", $_SERVER[
'PHP_SELF'],
"u.lastname", $param,
"",
"", $sortfield, $sortorder);
841 $totalarray[
'nbfield']++;
843 if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
844 print_liste_field_titre(
"FirstName", $_SERVER[
'PHP_SELF'],
"u.firstname", $param,
"",
"", $sortfield, $sortorder);
845 $totalarray[
'nbfield']++;
847 if (!empty($arrayfields[
'u.gender'][
'checked'])) {
848 print_liste_field_titre(
"Gender", $_SERVER[
'PHP_SELF'],
"u.gender", $param,
"",
"", $sortfield, $sortorder,
'center ');
849 $totalarray[
'nbfield']++;
851 if (!empty($arrayfields[
'u.employee'][
'checked'])) {
852 print_liste_field_titre(
"Employee", $_SERVER[
'PHP_SELF'],
"u.employee", $param,
"",
"", $sortfield, $sortorder,
'center ');
853 $totalarray[
'nbfield']++;
855 if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
856 print_liste_field_titre(
"HierarchicalResponsible", $_SERVER[
'PHP_SELF'],
"u.fk_user", $param,
"",
"", $sortfield, $sortorder);
857 $totalarray[
'nbfield']++;
859 if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
860 print_liste_field_titre(
"AccountancyCode", $_SERVER[
'PHP_SELF'],
"u.accountancy_code", $param,
"",
"", $sortfield, $sortorder);
861 $totalarray[
'nbfield']++;
863 if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
864 print_liste_field_titre(
"PhonePro", $_SERVER[
'PHP_SELF'],
"u.office_phone", $param,
"",
"", $sortfield, $sortorder);
865 $totalarray[
'nbfield']++;
867 if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
868 print_liste_field_titre(
"PhoneMobile", $_SERVER[
'PHP_SELF'],
"u.user_mobile", $param,
"",
"", $sortfield, $sortorder);
869 $totalarray[
'nbfield']++;
871 if (!empty($arrayfields[
'u.email'][
'checked'])) {
873 $totalarray[
'nbfield']++;
875 if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
877 $totalarray[
'nbfield']++;
879 if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
881 $totalarray[
'nbfield']++;
883 if (!empty($arrayfields[
'u.entity'][
'checked'])) {
884 print_liste_field_titre($arrayfields[
'u.entity'][
'label'], $_SERVER[
'PHP_SELF'],
"u.entity", $param,
"",
"", $sortfield, $sortorder);
885 $totalarray[
'nbfield']++;
887 if (!empty($arrayfields[
'u.job'][
'checked'])) {
888 print_liste_field_titre($arrayfields[
'u.job'][
'label'], $_SERVER[
'PHP_SELF'],
"u.job", $param,
"",
"", $sortfield, $sortorder);
889 $totalarray[
'nbfield']++;
891 if (!empty($arrayfields[
'u.salary'][
'checked'])) {
892 print_liste_field_titre(
"Salary", $_SERVER[
'PHP_SELF'],
"u.salary", $param,
"",
"", $sortfield, $sortorder,
'right ');
893 $totalarray[
'nbfield']++;
895 if (!empty($arrayfields[
'u.datelastlogin'][
'checked'])) {
896 print_liste_field_titre(
"LastConnexion", $_SERVER[
'PHP_SELF'],
"u.datelastlogin", $param,
"",
'', $sortfield, $sortorder,
'center ');
897 $totalarray[
'nbfield']++;
899 if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked'])) {
900 print_liste_field_titre(
"PreviousConnexion", $_SERVER[
'PHP_SELF'],
"u.datepreviouslogin", $param,
"",
'', $sortfield, $sortorder,
'center ');
901 $totalarray[
'nbfield']++;
904 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
906 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
907 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
908 print $hookmanager->resPrint;
909 if (!empty($arrayfields[
'u.datec'][
'checked'])) {
910 print_liste_field_titre(
"DateCreationShort", $_SERVER[
"PHP_SELF"],
"u.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
911 $totalarray[
'nbfield']++;
913 if (!empty($arrayfields[
'u.tms'][
'checked'])) {
914 print_liste_field_titre(
"DateModificationShort", $_SERVER[
"PHP_SELF"],
"u.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
915 $totalarray[
'nbfield']++;
917 if (!empty($arrayfields[
'u.statut'][
'checked'])) {
918 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"u.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
919 $totalarray[
'nbfield']++;
922 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
923 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
924 $totalarray[
'nbfield']++;
930 $needToFetchEachLine = 0;
931 if (isset($extrafields->attributes[$object->table_element][
'computed']) && is_array($extrafields->attributes[$object->table_element][
'computed']) && count($extrafields->attributes[$object->table_element][
'computed']) > 0) {
932 foreach ($extrafields->attributes[$object->table_element][
'computed'] as $key => $val) {
933 if (preg_match(
'/\$object/', $val)) {
934 $needToFetchEachLine++;
943 $savnbfield = $totalarray[
'nbfield'];
944 $totalarray[
'nbfield'] = 0;
945 $imaxinloop = ($limit ? min($num, $limit) : $num);
946 while ($i < $imaxinloop) {
947 $obj = $db->fetch_object(
$resql);
952 if (empty($obj->country_code)) $obj->country_code =
'';
955 $object->setVarsFromFetchObj($obj);
957 $object->id = $obj->rowid;
958 $object->admin = $obj->admin;
959 $object->ref = $obj->rowid;
960 $object->login = $obj->login;
961 $object->statut = $obj->status;
962 $object->status = $obj->status;
963 $object->office_phone = $obj->office_phone;
964 $object->user_mobile = $obj->user_mobile;
965 $object->job = $obj->job;
966 $object->email = $obj->email;
967 $object->gender = $obj->gender;
968 $object->socid = $obj->fk_soc;
969 $object->firstname = $obj->firstname;
970 $object->lastname = $obj->lastname;
971 $object->employee = $obj->employee;
972 $object->photo = $obj->photo;
974 $li = $object->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
977 if ((!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"read") && in_array($obj->rowid, $childids))
978 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
979 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
982 $canreadsecretapi = 0;
983 if ($user->id == $obj->rowid || !empty($user->admin)) {
984 $canreadsecretapi = 1;
987 if ($mode ==
'kanban') {
989 print
'<tr><td colspan="'.$savnbfield.
'">';
990 print
'<div class="box-flex-container">';
994 print $object->getKanbanView(
'');
995 if ($i == ($imaxinloop - 1)) {
1002 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1004 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1005 print
'<td class="nowrap center">';
1006 if ($massactionbutton || $massaction) {
1008 if (in_array($object->id, $arrayofselected)) {
1011 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1016 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1017 print
'<td class="nowraponall tdoverflowmax150">';
1019 if (
isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
1020 print
img_picto($langs->trans(
"SuperAdministrator"),
'redstar',
'class="valignmiddle paddingleft"');
1021 } elseif ($obj->admin) {
1022 print
img_picto($langs->trans(
"Administrator"),
'star',
'class="valignmiddle paddingleft"');
1026 $totalarray[
'nbfield']++;
1029 if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
1030 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
1032 $totalarray[
'nbfield']++;
1035 if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
1036 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
1038 $totalarray[
'nbfield']++;
1041 if (!empty($arrayfields[
'u.gender'][
'checked'])) {
1042 print
'<td class="center">';
1046 switch ($obj->gender) {
1048 $addgendertxt .=
'<i class="fas fa-mars" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1051 $addgendertxt .=
'<i class="fas fa-venus" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1054 $addgendertxt .=
'<i class="fas fa-transgender" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1057 print $addgendertxt;
1062 $totalarray[
'nbfield']++;
1066 if (!empty($arrayfields[
'u.employee'][
'checked'])) {
1067 print
'<td class="center">'.yn($obj->employee).
'</td>';
1069 $totalarray[
'nbfield']++;
1074 if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
1076 print
'<td class="nowrap">';
1078 $user2->id = $obj->id2;
1079 $user2->login = $obj->login2;
1080 $user2->lastname = $obj->lastname2;
1081 $user2->firstname = $obj->firstname2;
1082 $user2->gender = $obj->gender2;
1083 $user2->photo = $obj->photo2;
1084 $user2->admin = $obj->admin2;
1085 $user2->office_phone = $obj->office_phone;
1086 $user2->user_mobile = $obj->user_mobile;
1087 $user2->email = $obj->email2;
1088 $user2->socid = $obj->fk_soc2;
1089 $user2->statut = $obj->status2;
1090 $user2->status = $obj->status2;
1091 print $user2->getNomUrl(-1,
'', 0, 0, 24, 0,
'',
'', 1);
1092 if (
isModEnabled(
'multicompany') && $obj->admin2 && !$obj->entity2) {
1093 print
img_picto($langs->trans(
"SuperAdministrator"),
'redstar',
'class="valignmiddle paddingleft"');
1094 } elseif ($obj->admin2) {
1095 print
img_picto($langs->trans(
"Administrator"),
'star',
'class="valignmiddle paddingleft"');
1100 $totalarray[
'nbfield']++;
1104 if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
1105 print
'<td>'.$obj->accountancy_code.
'</td>';
1107 $totalarray[
'nbfield']++;
1112 if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
1113 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'phone').
"</td>\n";
1115 $totalarray[
'nbfield']++;
1118 if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
1119 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'mobile').
"</td>\n";
1121 $totalarray[
'nbfield']++;
1124 if (!empty($arrayfields[
'u.email'][
'checked'])) {
1125 print
'<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->fk_soc,
'AC_EMAIL', 0, 0, 1).
"</td>\n";
1127 $totalarray[
'nbfield']++;
1130 if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
1132 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($api_key).
'">';
1134 if ($canreadsecretapi) {
1135 print
'<span class="opacitymedium">';
1139 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1144 $totalarray[
'nbfield']++;
1147 if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
1148 print
'<td class="tdoverflowmax150">';
1149 if ($obj->fk_soc > 0) {
1150 $companystatic->id = $obj->fk_soc;
1151 $companystatic->name = $obj->name;
1152 $companystatic->canvas = $obj->canvas;
1153 print $companystatic->getNomUrl(1);
1154 } elseif ($obj->ldap_sid) {
1155 print
'<span class="opacitymedium">'.$langs->trans(
"DomainUser").
'</span>';
1157 print
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
1161 $totalarray[
'nbfield']++;
1165 if (
isModEnabled(
'multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
1166 if (!empty($arrayfields[
'u.entity'][
'checked'])) {
1167 if (!$obj->entity) {
1168 $labeltouse = $langs->trans(
"AllEntities");
1170 $mc->getInfo($obj->entity);
1171 $labeltouse = $mc->label;
1173 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltouse).
'">';
1177 $totalarray[
'nbfield']++;
1183 if (!empty($arrayfields[
'u.job'][
'checked'])) {
1184 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->job).
'">';
1188 $totalarray[
'nbfield']++;
1193 if (!empty($arrayfields[
'u.salary'][
'checked'])) {
1194 print
'<td class="nowraponall right amount">';
1196 if ($canreadhrmdata) {
1197 print
price($obj->salary);
1199 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1204 $totalarray[
'nbfield']++;
1209 if (!empty($arrayfields[
'u.datelastlogin'][
'checked'])) {
1210 print
'<td class="nowrap center">'.dol_print_date($db->jdate($obj->datelastlogin),
"dayhour").
'</td>';
1212 $totalarray[
'nbfield']++;
1216 if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked'])) {
1217 print
'<td class="nowrap center">'.dol_print_date($db->jdate($obj->datepreviouslogin),
"dayhour").
'</td>';
1219 $totalarray[
'nbfield']++;
1224 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1226 $parameters = array(
'arrayfields'=>$arrayfields,
'object'=>$object,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1227 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1228 print $hookmanager->resPrint;
1230 if (!empty($arrayfields[
'u.datec'][
'checked'])) {
1231 print
'<td class="center">';
1232 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1235 $totalarray[
'nbfield']++;
1239 if (!empty($arrayfields[
'u.tms'][
'checked'])) {
1240 print
'<td class="center">';
1241 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1244 $totalarray[
'nbfield']++;
1248 if (!empty($arrayfields[
'u.statut'][
'checked'])) {
1249 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
1251 $totalarray[
'nbfield']++;
1255 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1256 print
'<td class="nowrap center">';
1257 if ($massactionbutton || $massaction) {
1259 if (in_array($object->id, $arrayofselected)) {
1262 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1267 $totalarray[
'nbfield']++;
1277 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1282 foreach ($arrayfields as $key => $val) {
1283 if (!empty($val[
'checked'])) {
1287 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1293 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1294 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object);
1295 print $hookmanager->resPrint;
1297 print
'</table>'.
"\n";
1298 print
'</div>'.
"\n";
1300 print
'</form>'.
"\n";
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage categories.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_barre_liste($titre, $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.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
$nbtotalofrecords
Count total nb of records.
dolDecrypt($chain, $key='')
Decode a string with a symetric encryption.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.