32require
'../main.inc.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34if (isModEnabled(
'category')) {
35 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
39$langs->loadLangs(array(
'users',
'companies',
'hrm',
'salaries'));
41$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
42$massaction =
GETPOST(
'massaction',
'alpha');
44$confirm =
GETPOST(
'confirm',
'alpha');
45$cancel =
GETPOST(
'cancel',
'alpha');
46$toselect =
GETPOST(
'toselect',
'array');
47$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
48$backtopage =
GETPOST(
'backtopage',
'alpha');
49$optioncss =
GETPOST(
'optioncss',
'aZ');
54if ($user->socid > 0) {
55 $socid = $user->socid;
60$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
67$offset = $limit * $page;
74$diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
75$hookmanager->initHooks(array(
'userlist'));
78$extrafields->fetch_name_optionals_label(
$object->table_element);
80$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
83 $sortfield =
"u.login";
90$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
92foreach (
$object->fields as $key => $val) {
93 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
94 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
96 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
102$userstatic =
new User($db);
103$companystatic =
new Societe($db);
104$form =
new Form($db);
107$fieldstosearchall = array(
108 'u.login' =>
"Login",
109 'u.lastname' =>
"Lastname",
110 'u.firstname' =>
"Firstname",
111 'u.accountancy_code' =>
"AccountancyCode",
112 'u.office_phone' =>
"PhonePro",
113 'u.user_mobile' =>
"PhoneMobile",
114 'u.email' =>
"EMail",
115 'co.label' =>
"Country",
116 'u.note_public' =>
"NotePublic",
117 'u.note_private' =>
"NotePrivate"
119if (isModEnabled(
'api')) {
120 $fieldstosearchall[
'u.api_key'] =
"ApiKey";
123$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
124$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
128 'u.rowid' => array(
'label' =>
"TechnicalID",
'checked' => -1,
'position' => 5),
129 'u.login' => array(
'label' =>
"Login",
'checked' => 1,
'position' => 10),
130 'u.lastname' => array(
'label' =>
"Lastname",
'checked' => 1,
'position' => 15),
131 'u.firstname' => array(
'label' =>
"Firstname",
'checked' => 1,
'position' => 20),
132 'u.entity' => array(
'label' =>
"Entity",
'checked' => 1,
'position' => 50,
'enabled' => (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE'))),
133 'u.gender' => array(
'label' =>
"Gender",
'checked' => 0,
'position' => 22),
134 'u.employee' => array(
'label' =>
"Employee",
'checked' => ($contextpage ==
'employeelist' ? 1 : 0),
'position' => 25),
135 'u.fk_user' => array(
'label' =>
"HierarchicalResponsible",
'checked' => 1,
'position' => 27,
'csslist' =>
'maxwidth150'),
136 'u.accountancy_code' => array(
'label' =>
"AccountancyCode",
'checked' => 0,
'position' => 30),
137 'u.office_phone' => array(
'label' =>
"PhonePro",
'checked' => 1,
'position' => 31),
138 'u.user_mobile' => array(
'label' =>
"PhoneMobile",
'checked' => 1,
'position' => 32),
139 'u.email' => array(
'label' =>
"EMail",
'checked' => 1,
'position' => 35),
140 'co.label' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 37),
141 'u.api_key' => array(
'label' =>
"ApiKey",
'checked' => 0,
'position' => 40,
"enabled" => (isModEnabled(
'api') && $user->admin)),
142 'u.fk_soc' => array(
'label' =>
"Company",
'checked' => ($contextpage ==
'employeelist' ? 0 : 1),
'position' => 45),
143 'u.ref_employee' => array(
'label' =>
"RefEmployee",
'checked' => -1,
'position' => 50,
'enabled' => (isModEnabled(
'hrm') && $permissiontoreadhr)),
144 'u.national_registration_number' => array(
'label' =>
"NationalRegistrationNumber",
'checked' => -1,
'position' => 51,
'enabled' => (isModEnabled(
'hrm') && $permissiontoreadhr)),
145 'u.job' => array(
'label' =>
"PostOrFunction",
'checked' => -1,
'position' => 60),
146 'u.salary' => array(
'label' =>
"Salary",
'checked' => -1,
'position' => 80,
'enabled' => (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall")),
'isameasure' => 1),
147 'u.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
148 'u.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
149 'u.statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
153 $arrayfields[
'u.datelastlogin'] = array(
'label' =>
"LastConnexion",
'checked' => 1,
'position' => 100);
154 $arrayfields[
'u.datepreviouslogin'] = array(
'label' =>
"PreviousConnexion",
'checked' => 0,
'position' => 110);
158include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
162'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
165$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
166$search_user =
GETPOST(
'search_user',
'alpha');
167$search_rowid =
GETPOST(
'search_rowid',
'alpha');
168$search_login =
GETPOST(
'search_login',
'alpha');
169$search_lastname =
GETPOST(
'search_lastname',
'alpha');
170$search_firstname =
GETPOST(
'search_firstname',
'alpha');
171$search_gender =
GETPOST(
'search_gender',
'alpha');
172$search_employee =
GETPOST(
'search_employee',
'alpha');
173$search_accountancy_code =
GETPOST(
'search_accountancy_code',
'alpha');
174$search_phonepro =
GETPOST(
'search_phonepro',
'alpha');
175$search_phonemobile =
GETPOST(
'search_phonemobile',
'alpha');
176$search_email =
GETPOST(
'search_email',
'alpha');
177$search_country =
GETPOST(
'search_country',
'alpha');
178$search_api_key =
GETPOST(
'search_api_key',
'alphanohtml');
179$search_status =
GETPOST(
'search_status',
'intcomma');
180$search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
181$search_job =
GETPOST(
'search_job',
'alpha');
182$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
183$search_supervisor =
GETPOST(
'search_supervisor',
'intcomma');
184$search_categ =
GETPOST(
"search_categ",
'intcomma');
185$searchCategoryUserOperator = 0;
186if (GETPOSTISSET(
'formfilteraction')) {
187 $searchCategoryUserOperator =
GETPOSTINT(
'search_category_user_operator');
191$searchCategoryUserList =
GETPOST(
'search_category_user_list',
'array');
193if (!empty($catid) && empty($searchCategoryUserList)) {
194 $searchCategoryUserList = array($catid);
197if (!empty($catid) && empty($search_categ)) {
198 $search_categ = $catid;
202if ($search_status ==
'' && empty($search_all)) {
203 $search_status =
'1';
205if ($contextpage ==
'employeelist' && !GETPOSTISSET(
'search_employee')) {
206 $search_employee = 1;
210$permissiontoadd = (isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")));
211$canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
212$canedituser = $permissiontoadd;
213$candisableuser = (isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")));
214$canreadgroup = $canreaduser;
215$caneditgroup = $canedituser;
217 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
218 $caneditgroup = (isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")));
224if (isModEnabled(
'salaries') && $contextpage ==
'employeelist' && $search_employee == 1) {
225 if (!$user->hasRight(
"salaries",
"read")) {
229 if (!$user->hasRight(
"user",
"user",
"read") && empty($user->admin)) {
234$childids = $user->getAllChildIds(1);
241if (
GETPOST(
'cancel',
'alpha')) {
245if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
249$parameters = array(
'arrayfields' => &$arrayfields);
250$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
255if (empty($reshook)) {
257 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
260 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
264 $search_lastname =
"";
265 $search_firstname =
"";
267 $search_employee =
"";
268 $search_accountancy_code =
"";
269 $search_phonepro =
"";
270 $search_phonemobile =
"";
272 $search_country =
"";
274 $search_thirdparty =
"";
276 $search_warehouse =
"";
277 $search_supervisor =
"";
278 $search_api_key =
"";
279 $search_date_creation =
"";
280 $search_date_modification =
"";
283 $search_array_options = array();
285 $search_datelastlogin =
"";
286 $search_datepreviouslogin =
"";
289 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
290 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
295 $objectclass =
'User';
296 $objectlabel =
'User';
297 $uploaddir = $conf->user->dir_output;
298 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
301 if (!$error && ($massaction ==
'disable' || $massaction ==
'reactivate') && $permissiontoadd) {
302 $objecttmp =
new User($db);
308 foreach ($toselect as $toselectid) {
309 if ($toselectid == $user->id) {
310 setEventMessages($langs->trans($massaction == 0 ?
'CantDisableYourself' :
'CanEnableYourself'), null,
'errors');
315 $result = $objecttmp->fetch($toselectid);
317 if ($objecttmp->admin) {
318 setEventMessages($langs->trans($massaction == 0 ?
'CantDisableAnAdminUserWithMassActions' :
'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null,
'errors');
323 $result = $objecttmp->setstatus($massaction ==
'disable' ? 0 : 1);
326 } elseif ($result < 0) {
340 if (!$error && !empty($conf->file->main_limit_users)) {
341 $nb =
$object->getNbOfUsers(
"active");
342 if ($nb >= $conf->file->main_limit_users) {
344 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
364$user2 =
new User($db);
368$help_url =
'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
369if ($contextpage ==
'employeelist' && $search_employee == 1) {
370 $title = $langs->trans(
"Employees");
372 $title = $langs->trans(
"Users");
380$sql =
"SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.office_phone, u.user_mobile, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,";
381$sql .=
" u.fk_user,";
382$sql .=
" u.ref_employee, u.national_registration_number, u.job, u.salary, u.datelastlogin, u.datepreviouslogin,";
383$sql .=
" u.datestartvalidity, u.dateendvalidity,";
384$sql .=
" u.ldap_sid, u.statut as status, u.entity,";
385$sql .=
" u.tms as date_modification, u.datec as date_creation,";
386$sql .=
" u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.lastname as lastname2, u2.admin as admin2, u2.fk_soc as fk_soc2, u2.office_phone as ofice_phone2, u2.user_mobile as user_mobile2, u2.email as email2, u2.gender as gender2, u2.photo as photo2, u2.entity as entity2, u2.statut as status2,";
387$sql .=
" s.nom as name, s.canvas,";
388$sql .=
" co.code as country_code, co.label as country_label";
390if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
391 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
392 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
396$parameters = array();
397$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
398$sql .= $hookmanager->resPrint;
399$sql = preg_replace(
'/,\s*$/',
'', $sql);
403$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as u";
404if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
405 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (u.rowid = ef.fk_object)";
407$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
408$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u2 ON u.fk_user = u2.rowid";
409$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON u.fk_country = co.rowid";
411$parameters = array();
412$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
413$sql .= $hookmanager->resPrint;
415 $sql .= $hookmanager->resPrint;
417$sql .=
" WHERE u.entity IN (".getEntity(
$object->element).
")";
419 $sql .=
" AND u.fk_soc = ".((int) $socid);
422if ($search_supervisor > 0) {
423 $sql .=
" AND u.fk_user IN (".$db->sanitize($search_supervisor).
")";
425if ($search_thirdparty !=
'') {
428if ($search_warehouse > 0) {
429 $sql .=
natural_search(array(
'u.fk_warehouse'), $search_warehouse);
431if ($search_rowid !=
'') {
434if ($search_login !=
'') {
437if ($search_lastname !=
'') {
440if ($search_firstname !=
'') {
443if ($search_gender !=
'' && $search_gender !=
'-1') {
444 $sql .=
" AND u.gender = '".$db->escape($search_gender).
"'";
446if (is_numeric($search_employee) && $search_employee >= 0) {
447 $sql .=
' AND u.employee = '.(int) $search_employee;
449if ($search_accountancy_code !=
'') {
450 $sql .=
natural_search(
"u.accountancy_code", $search_accountancy_code);
452if ($search_phonepro !=
'') {
455if ($search_phonemobile !=
'') {
458if ($search_email !=
'') {
461if ($search_country !=
'') {
462 $sql .=
" AND u.fk_country IN (".$db->sanitize($search_country).
')';
464if ($search_api_key !=
'') {
467if ($search_job !=
'') {
470if ($search_status !=
'' && $search_status >= 0) {
471 $sql .=
" AND u.statut IN (".$db->sanitize($search_status).
")";
474 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
477$searchCategoryUserList = array($search_categ);
478if (!empty($searchCategoryUserList)) {
479 $searchCategoryUserSqlList = array();
480 $listofcategoryid =
'';
481 foreach ($searchCategoryUserList as $searchCategoryUser) {
482 if (intval($searchCategoryUser) == -2) {
483 $searchCategoryUserSqlList[] =
"NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user)";
484 } elseif (intval($searchCategoryUser) > 0) {
485 if ($searchCategoryUserOperator == 0) {
486 $searchCategoryUserSqlList[] =
" EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).
")";
488 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryUser);
492 if ($listofcategoryid) {
493 $searchCategoryUserSqlList[] =
" EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
495 if ($searchCategoryUserOperator == 1) {
496 if (!empty($searchCategoryUserSqlList)) {
497 $sql .=
" AND (".implode(
' OR ', $searchCategoryUserSqlList).
")";
500 if (!empty($searchCategoryUserSqlList)) {
501 $sql .=
" AND (".implode(
' AND ', $searchCategoryUserSqlList).
")";
505if ($search_warehouse > 0) {
506 $sql .=
" AND u.fk_warehouse = ".((int) $search_warehouse);
508if (isModEnabled(
'salaries') && $contextpage ==
'employeelist' && !$user->hasRight(
"salaries",
"readall")) {
509 $sql .=
" AND u.rowid IN (".$db->sanitize(implode(
',', $childids)).
")";
512include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
514$parameters = array();
515$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
516$sql .= $hookmanager->resPrint;
519$nbtotalofrecords =
'';
522 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
523 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
524 $resql = $db->query($sqlforcount);
526 $objforcount = $db->fetch_object($resql);
527 $nbtotalofrecords = $objforcount->nbtotalofrecords;
532 if (($page * $limit) > $nbtotalofrecords) {
540$sql .= $db->order($sortfield, $sortorder);
542 $sql .= $db->plimit($limit + 1, $offset);
545$resql = $db->query($sql);
551$num = $db->num_rows($resql);
554if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
555 $obj = $db->fetch_object($resql);
557 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$id);
564llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-product page-list');
566$arrayofselected = is_array($toselect) ? $toselect : array();
570 $param .=
'&mode='.urlencode($mode);
572if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
573 $param .=
'&contextpage='.urlencode($contextpage);
575if ($limit > 0 && $limit != $conf->liste_limit) {
576 $param .=
'&limit='.((int) $limit);
578if ($optioncss !=
'') {
579 $param .=
'&optioncss='.urlencode($optioncss);
581if ($search_all !=
'') {
582 $param .=
'&search_all='.urlencode($search_all);
584if ($search_user !=
'') {
585 $param .=
"&search_user=".urlencode($search_user);
587if ($search_rowid !=
'') {
588 $param .=
"&search_rowid=".urlencode($search_rowid);
590if ($search_login !=
'') {
591 $param .=
"&search_login=".urlencode($search_login);
593if ($search_lastname !=
'') {
594 $param .=
"&search_lastname=".urlencode($search_lastname);
596if ($search_firstname !=
'') {
597 $param .=
"&search_firstname=".urlencode($search_firstname);
599if ($search_gender !=
'' && $search_gender !=
'-1') {
600 $param .=
"&search_gender=".urlencode($search_gender);
602if ($search_employee !=
'' && $search_employee !=
'-1') {
603 $param .=
"&search_employee=".urlencode($search_employee);
605if ($search_accountancy_code !=
'') {
606 $param .=
"&search_accountancy_code=".urlencode($search_accountancy_code);
608if ($search_phonepro !=
'') {
609 $param .=
"&search_phonepro=".urlencode($search_phonepro);
611if ($search_phonemobile !=
'') {
612 $param .=
"&search_phonemobile=".urlencode($search_phonemobile);
614if ($search_email !=
'') {
615 $param .=
"&search_email=".urlencode($search_email);
617if ($search_country !=
'') {
618 $param .=
"&search_country=".urlencode($search_country);
620if ($search_api_key !=
'') {
621 $param .=
"&search_api_key=".urlencode($search_api_key);
623if ($search_supervisor > 0) {
624 $param .=
"&search_supervisor=".urlencode($search_supervisor);
626if ($search_status !=
'') {
627 $param .=
"&search_status=".urlencode($search_status);
629if ($search_categ > 0) {
630 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
632if ($search_warehouse > 0) {
633 $param .=
'&search_warehouse='.urlencode($search_warehouse);
636include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
639$arrayofmassactions = array();
640if ($permissiontoadd) {
641 $arrayofmassactions[
'disable'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"DisableUser");
643if ($permissiontoadd) {
644 $arrayofmassactions[
'reactivate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Reactivate");
646if (isModEnabled(
'category') && $permissiontoadd) {
647 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
649if ($permissiontoadd) {
650 $arrayofmassactions[
'presetsupervisor'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"SetSupervisor");
654if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'presetsupervisor'))) {
655 $arrayofmassactions = array();
657$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
659print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
660if ($optioncss !=
'') {
661 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
663print
'<input type="hidden" name="token" value="'.newToken().
'">';
664print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
665print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
666print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
667print
'<input type="hidden" name="page" value="'.$page.
'">';
668print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
669print
'<input type="hidden" name="page_y" value="">';
670print
'<input type="hidden" name="mode" value="'.$mode.
'">';
672$url = DOL_URL_ROOT.
'/user/card.php?action=create'.($contextpage ==
'employeelist' ?
'&search_employee=1' :
'').
'&leftmenu=';
674 $url .=
'&socid='.urlencode((
string) ($socid));
678$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars paddingleft imgforviewmode', DOL_URL_ROOT.
'/user/list.php?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss' =>
'reposition'));
679$newcardbutton .=
dolGetButtonTitle($langs->trans(
'HierarchicView'),
'',
'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.
'/user/hierarchy.php?mode=hierarchy'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', (($mode ==
'hierarchy') ? 2 : 1), array(
'morecss' =>
'reposition'));
680$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
682$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewUser'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
689print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'user', 0, $morehtmlright.
' '.$newcardbutton,
'', $limit, 0, 0, 1);
694$topicmail =
"SendUserRef";
696$objecttmp =
new User($db);
697$trackid =
'use'.$object->id;
698include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
701 print
"<div id='ways'>";
703 $ways = $c->print_all_ways(
' > ',
'user/list.php');
704 print
" > ".$ways[0].
"<br>\n";
710 foreach ($fieldstosearchall as $key => $val) {
711 $fieldstosearchall[$key] = $langs->trans($val);
712 $setupstring .= $key.
"=".$val.
";";
714 print
'<!-- Search done like if USER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
715 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
724if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
725 $moreforfilter .=
'<div class="divsearchfield">';
726 $tmptitle = $langs->trans(
'Category');
727 $moreforfilter .=
img_picto($langs->trans(
"Category"),
'category',
'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ,
'search_categ', 1, $tmptitle);
728 $moreforfilter .=
'</div>';
732 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
734 $moreforfilter .=
'<div class="divsearchfield">';
735 $tmptitle = $langs->trans(
'Warehouse');
736 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
737 $moreforfilter .=
'</div>';
740$parameters = array();
741$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
742if (empty($reshook)) {
743 $moreforfilter .= $hookmanager->resPrint;
745 $moreforfilter = $hookmanager->resPrint;
748if (!empty($moreforfilter)) {
749 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
750 print $moreforfilter;
754$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
755$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
756$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
757$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
759print
'<div class="div-table-responsive">';
760print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
764print
'<tr class="liste_titre_filter">';
767 print
'<td class="liste_titre center maxwidthsearch">';
768 $searchpicto = $form->showFilterButtons(
'left');
772if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
773 print
'<td class="liste_titre"><input type="text" name="search_rowid" class="maxwidth50" value="'.$search_rowid.
'"></td>';
775if (!empty($arrayfields[
'u.login'][
'checked'])) {
776 print
'<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.
'"></td>';
778if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
779 print
'<td class="liste_titre"><input type="text" name="search_lastname" class="maxwidth50" value="'.$search_lastname.
'"></td>';
781if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
782 print
'<td class="liste_titre"><input type="text" name="search_firstname" class="maxwidth50" value="'.$search_firstname.
'"></td>';
784if (!empty($arrayfields[
'u.gender'][
'checked'])) {
785 print
'<td class="liste_titre center">';
786 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
787 print $form->selectarray(
'search_gender', $arraygender, $search_gender, 1);
790if (!empty($arrayfields[
'u.employee'][
'checked'])) {
791 print
'<td class="liste_titre">';
792 print $form->selectyesno(
'search_employee', $search_employee, 1,
false, 1);
796if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
797 print
'<td class="liste_titre">';
798 print $form->select_dolusers($search_supervisor,
'search_supervisor', 1, array(), 0,
'', 0, 0, 0, 0,
'', 0,
'',
'maxwidth125');
801if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
802 print
'<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.
'"></td>';
804if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
805 print
'<td class="liste_titre"><input type="text" name="search_phonepro" class="maxwidth50" value="'.$search_phonepro.
'"></td>';
807if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
808 print
'<td class="liste_titre"><input type="text" name="search_phonemobile" class="maxwidth50" value="'.$search_phonemobile.
'"></td>';
810if (!empty($arrayfields[
'u.email'][
'checked'])) {
811 print
'<td class="liste_titre"><input type="text" name="search_email" class="maxwidth75" value="'.$search_email.
'"></td>';
813if (!empty($arrayfields[
'co.label'][
'checked'])) {
814 print
'<td class="liste_titre">';
815 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
818if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
819 print
'<td class="liste_titre"><input type="text" name="search_api_key" class="maxwidth50" value="'.$search_api_key.
'"></td>';
821if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
822 print
'<td class="liste_titre"><input type="text" name="search_thirdparty" class="maxwidth75" value="'.$search_thirdparty.
'"></td>';
824if (!empty($arrayfields[
'u.entity'][
'checked'])) {
825 print
'<td class="liste_titre"></td>';
827if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
828 print
'<td class="liste_titre"></td>';
830if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
831 print
'<td class="liste_titre"></td>';
833if (!empty($arrayfields[
'u.job'][
'checked'])) {
834 print
'<td class="liste_titre"><input type="text" name="search_job" class="maxwidth75" value="'.$search_job.
'"></td>';
836if (!empty($arrayfields[
'u.salary'][
'checked'])) {
837 print
'<td class="liste_titre"></td>';
839if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
840 print
'<td class="liste_titre"></td>';
842if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
843 print
'<td class="liste_titre"></td>';
846include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
848$parameters = array(
'arrayfields' => $arrayfields);
849$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
850print $hookmanager->resPrint;
851if (!empty($arrayfields[
'u.datec'][
'checked'])) {
853 print
'<td class="liste_titre">';
856if (!empty($arrayfields[
'u.tms'][
'checked'])) {
858 print
'<td class="liste_titre">';
861if (!empty($arrayfields[
'u.statut'][
'checked'])) {
863 print
'<td class="liste_titre center parentonrightofpage">';
864 print $form->selectarray(
'search_status', array(
'-1' =>
'',
'0' => $langs->trans(
'Disabled'),
'1' => $langs->trans(
'Enabled')), $search_status, 0, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage');
869 print
'<td class="liste_titre maxwidthsearch">';
870 $searchpicto = $form->showFilterButtons();
876$totalarray = array();
877$totalarray[
'nbfield'] = 0;
881print
'<tr class="liste_titre">';
883 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
884 $totalarray[
'nbfield']++;
886if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
888 print_liste_field_titre($arrayfields[
'u.rowid'][
'label'], $_SERVER[
'PHP_SELF'],
"u.rowid", $param,
"",
"", $sortfield, $sortorder);
889 $totalarray[
'nbfield']++;
891if (!empty($arrayfields[
'u.login'][
'checked'])) {
892 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
'PHP_SELF'],
"u.login", $param,
"",
"", $sortfield, $sortorder);
893 $totalarray[
'nbfield']++;
895if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
896 print_liste_field_titre(
"Lastname", $_SERVER[
'PHP_SELF'],
"u.lastname", $param,
"",
"", $sortfield, $sortorder);
897 $totalarray[
'nbfield']++;
899if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
900 print_liste_field_titre(
"FirstName", $_SERVER[
'PHP_SELF'],
"u.firstname", $param,
"",
"", $sortfield, $sortorder);
901 $totalarray[
'nbfield']++;
903if (!empty($arrayfields[
'u.gender'][
'checked'])) {
904 print_liste_field_titre(
"Gender", $_SERVER[
'PHP_SELF'],
"u.gender", $param,
"",
"", $sortfield, $sortorder,
'center ');
905 $totalarray[
'nbfield']++;
907if (!empty($arrayfields[
'u.employee'][
'checked'])) {
908 print_liste_field_titre(
"Employee", $_SERVER[
'PHP_SELF'],
"u.employee", $param,
"",
"", $sortfield, $sortorder,
'center ');
909 $totalarray[
'nbfield']++;
911if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
912 print_liste_field_titre(
"HierarchicalResponsible", $_SERVER[
'PHP_SELF'],
"u.fk_user", $param,
"",
"", $sortfield, $sortorder);
913 $totalarray[
'nbfield']++;
915if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
916 print_liste_field_titre(
"AccountancyCode", $_SERVER[
'PHP_SELF'],
"u.accountancy_code", $param,
"",
"", $sortfield, $sortorder);
917 $totalarray[
'nbfield']++;
919if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
920 print_liste_field_titre(
"PhonePro", $_SERVER[
'PHP_SELF'],
"u.office_phone", $param,
"",
"", $sortfield, $sortorder);
921 $totalarray[
'nbfield']++;
923if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
924 print_liste_field_titre(
"PhoneMobile", $_SERVER[
'PHP_SELF'],
"u.user_mobile", $param,
"",
"", $sortfield, $sortorder);
925 $totalarray[
'nbfield']++;
927if (!empty($arrayfields[
'u.email'][
'checked'])) {
929 $totalarray[
'nbfield']++;
931if (!empty($arrayfields[
'co.label'][
'checked'])) {
933 $totalarray[
'nbfield']++;
935if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
937 $totalarray[
'nbfield']++;
939if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
941 $totalarray[
'nbfield']++;
943if (!empty($arrayfields[
'u.entity'][
'checked'])) {
944 print_liste_field_titre($arrayfields[
'u.entity'][
'label'], $_SERVER[
'PHP_SELF'],
"u.entity", $param,
"",
"", $sortfield, $sortorder);
945 $totalarray[
'nbfield']++;
947if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
948 print_liste_field_titre(
"RefEmployee", $_SERVER[
'PHP_SELF'],
"u.ref_employee", $param,
"",
"", $sortfield, $sortorder);
949 $totalarray[
'nbfield']++;
951if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
952 print_liste_field_titre(
"NationalRegistrationNumber", $_SERVER[
'PHP_SELF'],
"u.national_registration_number", $param,
"",
"", $sortfield, $sortorder);
953 $totalarray[
'nbfield']++;
955if (!empty($arrayfields[
'u.job'][
'checked'])) {
956 print_liste_field_titre($arrayfields[
'u.job'][
'label'], $_SERVER[
'PHP_SELF'],
"u.job", $param,
"",
"", $sortfield, $sortorder);
957 $totalarray[
'nbfield']++;
959if (!empty($arrayfields[
'u.salary'][
'checked'])) {
960 print_liste_field_titre(
"Salary", $_SERVER[
'PHP_SELF'],
"u.salary", $param,
"",
"", $sortfield, $sortorder,
'right ');
961 $totalarray[
'nbfield']++;
963if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
964 print_liste_field_titre(
"LastConnexion", $_SERVER[
'PHP_SELF'],
"u.datelastlogin", $param,
"",
'', $sortfield, $sortorder,
'center ');
965 $totalarray[
'nbfield']++;
967if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
968 print_liste_field_titre(
"PreviousConnexion", $_SERVER[
'PHP_SELF'],
"u.datepreviouslogin", $param,
"",
'', $sortfield, $sortorder,
'center ');
969 $totalarray[
'nbfield']++;
972include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
974$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
975$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
976print $hookmanager->resPrint;
977if (!empty($arrayfields[
'u.datec'][
'checked'])) {
978 print_liste_field_titre(
"DateCreationShort", $_SERVER[
"PHP_SELF"],
"u.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
979 $totalarray[
'nbfield']++;
981if (!empty($arrayfields[
'u.tms'][
'checked'])) {
982 print_liste_field_titre(
"DateModificationShort", $_SERVER[
"PHP_SELF"],
"u.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
983 $totalarray[
'nbfield']++;
985if (!empty($arrayfields[
'u.statut'][
'checked'])) {
986 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"u.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
987 $totalarray[
'nbfield']++;
991 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
992 $totalarray[
'nbfield']++;
998$needToFetchEachLine = 0;
999if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
1000 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
1001 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
1002 $needToFetchEachLine++;
1011$savnbfield = $totalarray[
'nbfield'];
1012$totalarray = array(
'val' => array(
'u.salary' => 0));
1013$totalarray[
'nbfield'] = 0;
1014$imaxinloop = ($limit ? min($num, $limit) : $num);
1015while ($i < $imaxinloop) {
1016 $obj = $db->fetch_object($resql);
1022 $object->setVarsFromFetchObj($obj);
1028 $object->statut = $obj->status;
1029 $object->status = $obj->status;
1030 $object->office_phone = $obj->office_phone;
1031 $object->user_mobile = $obj->user_mobile;
1034 $object->gender = $obj->gender;
1035 $object->socid = $obj->fk_soc;
1036 $object->firstname = $obj->firstname;
1037 $object->lastname = $obj->lastname;
1038 $object->employee = $obj->employee;
1040 $object->datestartvalidity = $db->jdate($obj->datestartvalidity);
1041 $object->dateendvalidity = $db->jdate($obj->dateendvalidity);
1042 $object->country_code = $obj->country_code;
1043 $object->country = $obj->country_label;
1045 $li =
$object->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1047 $canreadhrmdata = 0;
1048 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($obj->rowid, $childids))
1049 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1050 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1051 $canreadhrmdata = 1;
1053 $canreadsecretapi = 0;
1054 if ($user->id == $obj->rowid || !empty($user->admin)) {
1055 $canreadsecretapi = 1;
1058 if ($mode ==
'kanban') {
1060 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1061 print
'<div class="box-flex-container kanban">';
1066 if ($massactionbutton || $massaction) {
1068 if (in_array(
$object->id, $arrayofselected)) {
1072 print
$object->getKanbanView(
'', array(
'selected' => $selected));
1073 if ($i == ($imaxinloop - 1)) {
1080 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1083 print
'<td class="nowrap center">';
1084 if ($massactionbutton || $massaction) {
1086 if (in_array(
$object->id, $arrayofselected)) {
1089 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1093 $totalarray[
'nbfield']++;
1097 if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
1098 print
'<td class="nowraponall">'.dol_escape_htmltag($obj->rowid).
'</td>';
1100 $totalarray[
'nbfield']++;
1104 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1105 print
'<td class="nowraponall tdoverflowmax150">';
1107 if (isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
1108 print
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar',
'class="valignmiddle paddingright paddingleft"');
1109 } elseif ($obj->admin) {
1110 print
img_picto($langs->trans(
"AdministratorDesc"),
'star',
'class="valignmiddle paddingright paddingleft"');
1114 $totalarray[
'nbfield']++;
1117 if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
1118 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
1120 $totalarray[
'nbfield']++;
1123 if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
1124 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
1126 $totalarray[
'nbfield']++;
1129 if (!empty($arrayfields[
'u.gender'][
'checked'])) {
1130 print
'<td class="center">';
1134 switch ($obj->gender) {
1136 $addgendertxt .=
'<i class="fas fa-mars" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1139 $addgendertxt .=
'<i class="fas fa-venus" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1142 $addgendertxt .=
'<i class="fas fa-transgender" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1145 print $addgendertxt;
1150 $totalarray[
'nbfield']++;
1154 if (!empty($arrayfields[
'u.employee'][
'checked'])) {
1155 print
'<td class="center">'.yn($obj->employee).
'</td>';
1157 $totalarray[
'nbfield']++;
1162 if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
1163 print
'<td class="tdoverflowmax125">';
1165 $user2->id = $obj->id2;
1166 $user2->login = $obj->login2;
1167 $user2->lastname = $obj->lastname2;
1168 $user2->firstname = $obj->firstname2;
1169 $user2->gender = $obj->gender2;
1170 $user2->photo = $obj->photo2;
1171 $user2->admin = $obj->admin2;
1172 $user2->office_phone = $obj->office_phone;
1173 $user2->user_mobile = $obj->user_mobile;
1174 $user2->email = $obj->email2;
1175 $user2->socid = $obj->fk_soc2;
1176 $user2->statut = $obj->status2;
1177 $user2->status = $obj->status2;
1178 if (isModEnabled(
'multicompany') && $obj->admin2 && !$obj->entity2) {
1179 print
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar',
'class="valignmiddle paddingright"');
1180 } elseif ($obj->admin2) {
1181 print
img_picto($langs->trans(
"AdministratorDesc"),
'star',
'class="valignmiddle paddingright"');
1183 print $user2->getNomUrl(-1,
'', 0, 0, 24, 0,
'',
'', 1);
1187 $totalarray[
'nbfield']++;
1191 if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
1192 print
'<td>'.$obj->accountancy_code.
'</td>';
1194 $totalarray[
'nbfield']++;
1199 if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
1200 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'phone').
"</td>\n";
1202 $totalarray[
'nbfield']++;
1206 if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
1207 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'mobile').
"</td>\n";
1209 $totalarray[
'nbfield']++;
1213 if (!empty($arrayfields[
'u.email'][
'checked'])) {
1214 print
'<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->fk_soc, 1, 0, 0, 1).
"</td>\n";
1216 $totalarray[
'nbfield']++;
1220 if (!empty($arrayfields[
'co.label'][
'checked'])) {
1221 print
'<td class="tdoverflowmax150">'.$obj->country_label.
"</td>\n";
1223 $totalarray[
'nbfield']++;
1227 if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
1229 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($api_key).
'">';
1231 if ($canreadsecretapi) {
1232 print
'<span class="opacitymedium">';
1236 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1241 $totalarray[
'nbfield']++;
1245 if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
1246 print
'<td class="tdoverflowmax150">';
1247 if ($obj->fk_soc > 0) {
1248 $companystatic->id = $obj->fk_soc;
1249 $companystatic->name = $obj->name;
1250 $companystatic->canvas = $obj->canvas;
1251 print $companystatic->getNomUrl(1);
1252 } elseif ($obj->ldap_sid) {
1253 print
'<span class="opacitymedium">'.$langs->trans(
"DomainUser").
'</span>';
1255 print
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
1259 $totalarray[
'nbfield']++;
1263 if (isModEnabled(
'multicompany') && is_object($mc) && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE')) {
1264 if (!empty($arrayfields[
'u.entity'][
'checked'])) {
1265 if (!$obj->entity) {
1266 $labeltouse = $langs->trans(
"AllEntities");
1268 $mc->getInfo($obj->entity);
1269 $labeltouse = $mc->label;
1271 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltouse).
'">';
1275 $totalarray[
'nbfield']++;
1281 if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
1282 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_employee).
'">';
1286 $totalarray[
'nbfield']++;
1290 if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
1291 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->national_registration_number).
'">';
1295 $totalarray[
'nbfield']++;
1299 if (!empty($arrayfields[
'u.job'][
'checked'])) {
1300 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->job).
'">';
1304 $totalarray[
'nbfield']++;
1309 if (!empty($arrayfields[
'u.salary'][
'checked'])) {
1310 print
'<td class="nowraponall right amount">';
1312 if ($canreadhrmdata) {
1313 print
price($obj->salary);
1315 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1320 $totalarray[
'nbfield']++;
1323 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'u.salary';
1325 if (!isset($totalarray[
'val'])) {
1326 $totalarray[
'val'] = array();
1328 if (!isset($totalarray[
'val'][
'u.salary'])) {
1329 $totalarray[
'val'][
'u.salary'] = 0;
1331 $totalarray[
'val'][
'u.salary'] += $obj->salary;
1335 if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
1336 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datelastlogin),
"dayhour").
'</td>';
1338 $totalarray[
'nbfield']++;
1342 if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
1343 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datepreviouslogin),
"dayhour").
'</td>';
1345 $totalarray[
'nbfield']++;
1350 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1352 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1353 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1354 print $hookmanager->resPrint;
1356 if (!empty($arrayfields[
'u.datec'][
'checked'])) {
1357 print
'<td class="center nowraponall">';
1358 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1361 $totalarray[
'nbfield']++;
1365 if (!empty($arrayfields[
'u.tms'][
'checked'])) {
1366 print
'<td class="center nowraponall">';
1367 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1370 $totalarray[
'nbfield']++;
1374 if (!empty($arrayfields[
'u.statut'][
'checked'])) {
1375 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
1377 $totalarray[
'nbfield']++;
1382 print
'<td class="nowrap center">';
1383 if ($massactionbutton || $massaction) {
1385 if (in_array(
$object->id, $arrayofselected)) {
1388 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1392 $totalarray[
'nbfield']++;
1403include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1408 foreach ($arrayfields as $key => $val) {
1409 if (!empty($val[
'checked'])) {
1413 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1419$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1420$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1421print $hookmanager->resPrint;
1423print
'</table>'.
"\n";
1426print
'</form>'.
"\n";
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
Class to manage categories.
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.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
dolDecrypt($chain, $key='')
Decode a string with a symmetric encryption.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.