33require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
47$langs->loadLangs(array(
'users',
'companies',
'hrm',
'salaries'));
49$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
50$massaction =
GETPOST(
'massaction',
'alpha');
52$confirm =
GETPOST(
'confirm',
'alpha');
53$cancel =
GETPOST(
'cancel',
'alpha');
54$toselect =
GETPOST(
'toselect',
'array:int');
55$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
56$backtopage =
GETPOST(
'backtopage',
'alpha');
57$optioncss =
GETPOST(
'optioncss',
'aZ');
62if ($user->socid > 0) {
63 $socid = $user->socid;
68$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
69$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
71if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
75$offset = $limit * $page;
82$diroutputmassaction = $conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
83$hookmanager->initHooks(array(
'userlist'));
86$extrafields->fetch_name_optionals_label(
$object->table_element);
88$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
91 $sortfield =
"u.login";
98$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
100foreach (
$object->fields as $key => $val) {
101 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
102 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
104 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
110$userstatic =
new User($db);
111$companystatic =
new Societe($db);
112$form =
new Form($db);
115$fieldstosearchall = array(
116 'u.login' =>
"Login",
117 'u.lastname' =>
"Lastname",
118 'u.firstname' =>
"Firstname",
119 'u.accountancy_code' =>
"AccountancyCode",
120 'u.office_phone' =>
"PhonePro",
121 'u.user_mobile' =>
"PhoneMobile",
122 'u.email' =>
"EMail",
123 'co.label' =>
"Country",
124 'u.note_public' =>
"NotePublic",
125 'u.note_private' =>
"NotePrivate"
128 $fieldstosearchall[
'u.api_key'] =
"ApiKey";
131$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
132$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
136 'u.rowid' => array(
'label' =>
"TechnicalID",
'checked' =>
'-1',
'position' => 5),
137 'u.login' => array(
'label' =>
"Login",
'checked' =>
'1',
'position' => 10),
138 'u.lastname' => array(
'label' =>
"Lastname",
'checked' =>
'1',
'position' => 15),
139 'u.firstname' => array(
'label' =>
"Firstname",
'checked' =>
'1',
'position' => 20),
140 'u.entity' => array(
'label' =>
"Entity",
'checked' =>
'1',
'position' => 50,
'enabled' => (
string) (
int) (
isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE'))),
141 'u.gender' => array(
'label' =>
"Gender",
'checked' =>
'0',
'position' => 22),
142 'u.employee' => array(
'label' =>
"Employee",
'checked' => ($contextpage ==
'employeelist' ?
'1' :
'0'),
'position' => 25),
143 'u.fk_user' => array(
'label' =>
"HierarchicalResponsible",
'checked' =>
'1',
'position' => 27,
'csslist' =>
'maxwidth150'),
144 'u.accountancy_code' => array(
'label' =>
"AccountancyCode",
'checked' =>
'0',
'position' => 30),
145 'u.office_phone' => array(
'label' =>
"PhonePro",
'checked' =>
'1',
'position' => 31),
146 'u.user_mobile' => array(
'label' =>
"PhoneMobile",
'checked' =>
'1',
'position' => 32),
147 'u.email' => array(
'label' =>
"EMail",
'checked' =>
'1',
'position' => 35),
148 'co.label' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 37),
149 'u.api_key' => array(
'label' =>
"ApiKey",
'checked' =>
'0',
'position' => 40,
"enabled" => (string) (int) (
isModEnabled(
'api') && $user->admin)),
150 'u.fk_soc' => array(
'label' =>
"Company",
'checked' => ($contextpage ==
'employeelist' ?
'0' :
'1'),
'position' => 45),
151 'u.ref_employee' => array(
'label' =>
"RefEmployee",
'checked' =>
'-1',
'position' => 50,
'enabled' => (string) (int) (
isModEnabled(
'hrm') && $permissiontoreadhr)),
152 'u.national_registration_number' => array(
'label' =>
"NationalRegistrationNumber",
'checked' =>
'-1',
'position' => 51,
'enabled' => (string) (int) (
isModEnabled(
'hrm') && $permissiontoreadhr)),
153 'u.job' => array(
'label' =>
"PostOrFunction",
'checked' =>
'-1',
'position' => 60),
154 'u.salary' => array(
'label' =>
"Salary",
'checked' =>
'-1',
'position' => 80,
'enabled' => (string) (int) (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall")),
'isameasure' => 1),
155 'u.thm' => array(
'label' =>
"THM",
'langs' =>
'salaries',
'checked' =>
'-1',
'position' => 82,
'enabled' =>
'1',
'isameasure' => 1),
156 'u.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 500),
157 'date_modification' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 500),
158 'u.import_key' => array(
'label' =>
"ImportId",
'checked' =>
'-1',
'position' => 800,
'enabled' =>
'1'),
159 'u.statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
163 $arrayfields[
'u.datelastlogin'] = array(
'label' =>
"LastConnexion",
'checked' =>
'1',
'position' => 100);
164 $arrayfields[
'u.datepreviouslogin'] = array(
'label' =>
"PreviousConnexion",
'checked' =>
'0',
'position' => 110);
168include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
174$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
175$search_user =
GETPOST(
'search_user',
'alpha');
176$search_rowid =
GETPOST(
'search_rowid',
'alpha');
177$search_login =
GETPOST(
'search_login',
'alpha');
178$search_lastname =
GETPOST(
'search_lastname',
'alpha');
179$search_firstname =
GETPOST(
'search_firstname',
'alpha');
180$search_gender =
GETPOST(
'search_gender',
'alpha');
181$search_employee =
GETPOST(
'search_employee',
'alpha');
182$search_accountancy_code =
GETPOST(
'search_accountancy_code',
'alpha');
183$search_phonepro =
GETPOST(
'search_phonepro',
'alpha');
184$search_phonemobile =
GETPOST(
'search_phonemobile',
'alpha');
185$search_email =
GETPOST(
'search_email',
'alpha');
186$search_country =
GETPOST(
'search_country',
'alpha');
187$search_api_key =
GETPOST(
'search_api_key',
'alphanohtml');
188$search_status =
GETPOST(
'search_status',
'intcomma');
189$search_thirdparty =
GETPOST(
'search_thirdparty',
'alpha');
190$search_job =
GETPOST(
'search_job',
'alpha');
191$search_warehouse =
GETPOST(
'search_warehouse',
'alpha');
192$search_supervisor =
GETPOST(
'search_supervisor',
'intcomma');
193$search_categ =
GETPOST(
"search_categ",
'intcomma');
194$search_datelastlogin =
GETPOSTDATE(
'search_datelastlogin',
'',
'tzuserrel');
195$search_datepreviouslogin =
GETPOSTDATE(
'search_datepreviouslogin',
'',
'tzuserrel');
197$searchCategoryUserOperator = 0;
198if (GETPOSTISSET(
'formfilteraction')) {
199 $searchCategoryUserOperator =
GETPOSTINT(
'search_category_user_operator');
203$searchCategoryUserList =
GETPOST(
'search_category_user_list',
'array:int');
205if (!empty($catid) && empty($searchCategoryUserList)) {
206 $searchCategoryUserList = array($catid);
209if (!empty($catid) && empty($search_categ)) {
210 $search_categ = $catid;
214if ($search_status ==
'' && empty($search_all)) {
215 $search_status =
'1';
217if ($contextpage ==
'employeelist' && !GETPOSTISSET(
'search_employee')) {
218 $search_employee = 1;
222$permissiontoadd = (
isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")));
223$canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
224$canedituser = $permissiontoadd;
225$candisableuser = (
isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")));
226$canreadgroup = $canreaduser;
227$caneditgroup = $canedituser;
229 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
230 $caneditgroup = (
isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")));
236if (
isModEnabled(
'salaries') && $contextpage ==
'employeelist' && $search_employee == 1) {
237 if (!$user->hasRight(
"salaries",
"read")) {
241 if (!$user->hasRight(
"user",
"user",
"read") && empty($user->admin)) {
246$childids = $user->getAllChildIds(1);
253if (
GETPOST(
'cancel',
'alpha')) {
257if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
261$parameters = array(
'arrayfields' => &$arrayfields);
262$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
267if (empty($reshook)) {
269 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
272 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
276 $search_lastname =
"";
277 $search_firstname =
"";
279 $search_employee =
"";
280 $search_accountancy_code =
"";
281 $search_phonepro =
"";
282 $search_phonemobile =
"";
284 $search_country =
"";
286 $search_thirdparty =
"";
288 $search_warehouse =
"";
289 $search_supervisor =
"";
290 $search_api_key =
"";
294 $search_array_options = array();
296 $search_datelastlogin =
"";
297 $search_datepreviouslogin =
"";
300 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
301 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
306 $objectclass =
'User';
307 $objectlabel =
'User';
308 $uploaddir = $conf->user->dir_output;
313 if (!$error && ($massaction ==
'disable' || $massaction ==
'reactivate') && $permissiontoadd) {
314 $objecttmp =
new User($db);
319 foreach ($toselect as $toselectid) {
320 if ($toselectid == $user->id) {
321 setEventMessages($langs->trans($massaction ==
'disable' ?
'CantDisableYourself' :
'CanEnableYourself'), null,
'errors');
326 $result = $objecttmp->fetch($toselectid);
328 if ($objecttmp->admin) {
329 setEventMessages($langs->trans($massaction ==
'disable' ?
'CantDisableAnAdminUserWithMassActions' :
'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null,
'errors');
334 $result = $objecttmp->setstatus($massaction ==
'disable' ? 0 : 1);
337 } elseif ($result < 0) {
351 if (!$error && !empty($conf->file->main_limit_users)) {
352 $nb =
$object->getNbOfUsers(
"active");
353 if ($nb >= $conf->file->main_limit_users) {
355 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
370 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
379$user2 =
new User($db);
381$help_url =
'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
382if ($contextpage ==
'employeelist' && $search_employee == 1) {
383 $title = $langs->trans(
"Employees");
385 $title = $langs->trans(
"Users");
393$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,";
394$sql .=
" u.fk_user,";
395$sql .=
" u.ref_employee, u.national_registration_number, u.job, u.salary, u.thm, u.datelastlogin, u.datepreviouslogin,";
396$sql .=
" u.datestartvalidity, u.dateendvalidity,";
397$sql .=
" u.ldap_sid, u.statut as status, u.entity, u.import_key,";
398$sql .=
" GREATEST(u.tms, ef.tms) as date_modification, u.datec as date_creation,";
399$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,";
400$sql .=
" s.nom as name, s.canvas,";
401$sql .=
" co.code as country_code, co.label as country_label";
403if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
404 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
405 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
409$parameters = array();
410$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
411$sql .= $hookmanager->resPrint;
412$sql = preg_replace(
'/,\s*$/',
'', $sql);
416$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as u";
417$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (u.rowid = ef.fk_object)";
418$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
419$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u2 ON u.fk_user = u2.rowid";
420$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON u.fk_country = co.rowid";
422$parameters = array();
423$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
424$sql .= $hookmanager->resPrint;
426 $sql .= $hookmanager->resPrint;
428$sql .=
" WHERE u.entity IN (".getEntity(
$object->element).
")";
430 $sql .=
" AND u.fk_soc = ".((int) $socid);
433if ($search_supervisor > 0) {
434 $sql .=
" AND u.fk_user IN (".$db->sanitize($search_supervisor).
")";
436if ($search_thirdparty !=
'') {
439if ($search_warehouse > 0) {
440 $sql .=
natural_search(array(
'u.fk_warehouse'), $search_warehouse);
442if ($search_rowid !=
'') {
445if ($search_login !=
'') {
448if ($search_lastname !=
'') {
451if ($search_firstname !=
'') {
454if ($search_gender !=
'' && $search_gender !=
'-1') {
455 $sql .=
" AND u.gender = '".$db->escape($search_gender).
"'";
457if (is_numeric($search_employee) && $search_employee >= 0) {
458 $sql .=
' AND u.employee = '.(int) $search_employee;
460if ($search_accountancy_code !=
'') {
461 $sql .=
natural_search(
"u.accountancy_code", $search_accountancy_code);
463if ($search_phonepro !=
'') {
466if ($search_phonemobile !=
'') {
469if ($search_email !=
'') {
472if ($search_country !=
'') {
473 $sql .=
" AND u.fk_country IN (".$db->sanitize($search_country).
')';
475if ($search_api_key !=
'') {
478if ($search_job !=
'') {
481if ($search_status !=
'' && $search_status >= 0) {
482 $sql .=
" AND u.statut IN (".$db->sanitize($search_status).
")";
485 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
488$searchCategoryUserList = array($search_categ);
489if (!empty($searchCategoryUserList)) {
490 $searchCategoryUserSqlList = array();
491 $listofcategoryid =
'';
492 foreach ($searchCategoryUserList as $searchCategoryUser) {
493 if (intval($searchCategoryUser) == -2) {
494 $searchCategoryUserSqlList[] =
"NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user)";
495 } elseif (intval($searchCategoryUser) > 0) {
496 if ($searchCategoryUserOperator == 0) {
497 $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).
")";
499 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryUser);
503 if ($listofcategoryid) {
504 $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).
"))";
506 if ($searchCategoryUserOperator == 1) {
507 if (!empty($searchCategoryUserSqlList)) {
508 $sql .=
" AND (".implode(
' OR ', $searchCategoryUserSqlList).
")";
511 if (!empty($searchCategoryUserSqlList)) {
512 $sql .=
" AND (".implode(
' AND ', $searchCategoryUserSqlList).
")";
516if ($search_warehouse > 0) {
517 $sql .=
" AND u.fk_warehouse = ".((int) $search_warehouse);
519if (
isModEnabled(
'salaries') && $contextpage ==
'employeelist' && !$user->hasRight(
"salaries",
"readall")) {
520 $sql .=
" AND u.rowid IN (".$db->sanitize(implode(
',', $childids)).
")";
523include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
525$parameters = array();
526$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
527$sql .= $hookmanager->resPrint;
530$nbtotalofrecords =
'';
533 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
534 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
535 $resql = $db->query($sqlforcount);
537 $objforcount = $db->fetch_object($resql);
538 $nbtotalofrecords = $objforcount->nbtotalofrecords;
543 if (($page * $limit) > (
int) $nbtotalofrecords) {
551$sql .= $db->order($sortfield, $sortorder);
553 $sql .= $db->plimit($limit + 1, $offset);
556$resql = $db->query($sql);
562$num = $db->num_rows($resql);
565if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
566 $obj = $db->fetch_object($resql);
568 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$id);
575llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-user page-list');
577$arrayofselected = is_array($toselect) ? $toselect : array();
581 $param .=
'&mode='.urlencode($mode);
583if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
584 $param .=
'&contextpage='.urlencode($contextpage);
586if ($limit > 0 && $limit != $conf->liste_limit) {
587 $param .=
'&limit='.((int) $limit);
589if ($optioncss !=
'') {
590 $param .=
'&optioncss='.urlencode($optioncss);
592if ($search_all !=
'') {
593 $param .=
'&search_all='.urlencode($search_all);
595if ($search_user !=
'') {
596 $param .=
"&search_user=".urlencode($search_user);
598if ($search_rowid !=
'') {
599 $param .=
"&search_rowid=".urlencode($search_rowid);
601if ($search_login !=
'') {
602 $param .=
"&search_login=".urlencode($search_login);
604if ($search_lastname !=
'') {
605 $param .=
"&search_lastname=".urlencode($search_lastname);
607if ($search_firstname !=
'') {
608 $param .=
"&search_firstname=".urlencode($search_firstname);
610if ($search_gender !=
'' && $search_gender !=
'-1') {
611 $param .=
"&search_gender=".urlencode($search_gender);
613if ($search_employee !=
'' && $search_employee !=
'-1') {
614 $param .=
"&search_employee=".urlencode($search_employee);
616if ($search_accountancy_code !=
'') {
617 $param .=
"&search_accountancy_code=".urlencode($search_accountancy_code);
619if ($search_phonepro !=
'') {
620 $param .=
"&search_phonepro=".urlencode($search_phonepro);
622if ($search_phonemobile !=
'') {
623 $param .=
"&search_phonemobile=".urlencode($search_phonemobile);
625if ($search_email !=
'') {
626 $param .=
"&search_email=".urlencode($search_email);
628if ($search_country !=
'') {
629 $param .=
"&search_country=".urlencode($search_country);
631if ($search_api_key !=
'') {
632 $param .=
"&search_api_key=".urlencode($search_api_key);
634if ($search_supervisor > 0) {
635 $param .=
"&search_supervisor=".urlencode($search_supervisor);
637if ($search_status !=
'') {
638 $param .=
"&search_status=".urlencode($search_status);
640if ($search_categ > 0) {
641 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
643if ($search_warehouse > 0) {
644 $param .=
'&search_warehouse='.urlencode($search_warehouse);
647include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
650$arrayofmassactions = array();
651if ($permissiontoadd) {
652 $arrayofmassactions[
'disable'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"DisableUser");
654if ($permissiontoadd) {
655 $arrayofmassactions[
'reactivate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Reactivate");
658 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
660if ($permissiontoadd) {
661 $arrayofmassactions[
'presetsupervisor'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"SetSupervisor");
665if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'presetsupervisor'))) {
666 $arrayofmassactions = array();
668$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
670print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
671if ($optioncss !=
'') {
672 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
674print
'<input type="hidden" name="token" value="'.newToken().
'">';
675print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
676print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
677print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
678print
'<input type="hidden" name="page" value="'.$page.
'">';
679print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
680print
'<input type="hidden" name="page_y" value="">';
681print
'<input type="hidden" name="mode" value="'.$mode.
'">';
683$url = DOL_URL_ROOT.
'/user/card.php?action=create'.($contextpage ==
'employeelist' ?
'&search_employee=1' :
'').
'&leftmenu=';
685 $url .=
'&socid='.urlencode((
string) ($socid));
689$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'));
690$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'));
691$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'));
693$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewUser'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
700print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'user', 0, $morehtmlright.
' '.$newcardbutton,
'', $limit, 0, 0, 1);
705$topicmail =
"SendUserRef";
707$objecttmp =
new User($db);
708$trackid =
'use'.$object->id;
709include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
712 print
"<div id='ways'>";
714 $ways =
$c->print_all_ways(
'auto',
'user/list.php');
715 print
" > ".$ways[0].
"<br>\n";
721 foreach ($fieldstosearchall as $key => $val) {
722 $fieldstosearchall[$key] = $langs->trans($val);
723 $setupstring .= $key.
"=".$val.
";";
725 print
'<!-- Search done like if USER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
726 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
735if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
736 $moreforfilter .=
'<div class="divsearchfield">';
737 $tmptitle = $langs->trans(
'Category');
738 $moreforfilter .=
img_picto($langs->trans(
"Category"),
'category',
'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ,
'search_categ', 1, $tmptitle);
739 $moreforfilter .=
'</div>';
743 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
745 $moreforfilter .=
'<div class="divsearchfield">';
746 $tmptitle = $langs->trans(
'Warehouse');
747 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle);
748 $moreforfilter .=
'</div>';
751$parameters = array();
752$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
753if (empty($reshook)) {
754 $moreforfilter .= $hookmanager->resPrint;
756 $moreforfilter = $hookmanager->resPrint;
759if (!empty($moreforfilter)) {
760 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
761 print $moreforfilter;
765$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
766$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
767$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
768$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
770print
'<div class="div-table-responsive">';
771print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
775print
'<tr class="liste_titre_filter">';
778 print
'<td class="liste_titre center maxwidthsearch">';
779 $searchpicto = $form->showFilterButtons(
'left');
783if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
784 print
'<td class="liste_titre"><input type="text" name="search_rowid" class="maxwidth50" value="'.$search_rowid.
'"></td>';
786if (!empty($arrayfields[
'u.login'][
'checked'])) {
787 print
'<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.
'"></td>';
789if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
790 print
'<td class="liste_titre"><input type="text" name="search_lastname" class="maxwidth50" value="'.$search_lastname.
'"></td>';
792if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
793 print
'<td class="liste_titre"><input type="text" name="search_firstname" class="maxwidth50" value="'.$search_firstname.
'"></td>';
795if (!empty($arrayfields[
'u.gender'][
'checked'])) {
796 print
'<td class="liste_titre center">';
797 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
798 print $form->selectarray(
'search_gender', $arraygender, $search_gender, 1);
801if (!empty($arrayfields[
'u.employee'][
'checked'])) {
802 print
'<td class="liste_titre">';
803 print $form->selectyesno(
'search_employee', $search_employee, 1,
false, 1);
807if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
808 print
'<td class="liste_titre">';
809 print $form->select_dolusers($search_supervisor,
'search_supervisor', 1, array(), 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth125');
812if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
813 print
'<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.
'"></td>';
815if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
816 print
'<td class="liste_titre"><input type="text" name="search_phonepro" class="maxwidth50" value="'.$search_phonepro.
'"></td>';
818if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
819 print
'<td class="liste_titre"><input type="text" name="search_phonemobile" class="maxwidth50" value="'.$search_phonemobile.
'"></td>';
821if (!empty($arrayfields[
'u.email'][
'checked'])) {
822 print
'<td class="liste_titre"><input type="text" name="search_email" class="maxwidth75" value="'.$search_email.
'"></td>';
824if (!empty($arrayfields[
'co.label'][
'checked'])) {
825 print
'<td class="liste_titre">';
826 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
829if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
830 print
'<td class="liste_titre"><input type="text" name="search_api_key" class="maxwidth50" value="'.$search_api_key.
'"></td>';
832if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
833 print
'<td class="liste_titre"><input type="text" name="search_thirdparty" class="maxwidth75" value="'.$search_thirdparty.
'"></td>';
835if (!empty($arrayfields[
'u.entity'][
'checked'])) {
836 print
'<td class="liste_titre"></td>';
838if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
839 print
'<td class="liste_titre"></td>';
841if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
842 print
'<td class="liste_titre"></td>';
844if (!empty($arrayfields[
'u.job'][
'checked'])) {
845 print
'<td class="liste_titre"><input type="text" name="search_job" class="maxwidth75" value="'.$search_job.
'"></td>';
847if (!empty($arrayfields[
'u.salary'][
'checked'])) {
848 print
'<td class="liste_titre"></td>';
850if (!empty($arrayfields[
'u.thm'][
'checked'])) {
851 print
'<td class="liste_titre"></td>';
853if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
854 print
'<td class="liste_titre"></td>';
856if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
857 print
'<td class="liste_titre"></td>';
860include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
862$parameters = array(
'arrayfields' => $arrayfields);
863$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
864print $hookmanager->resPrint;
865if (!empty($arrayfields[
'u.datec'][
'checked'])) {
867 print
'<td class="liste_titre">';
870if (!empty($arrayfields[
'date_modification'][
'checked'])) {
872 print
'<td class="liste_titre">';
875if (!empty($arrayfields[
'u.import_key'][
'checked'])) {
877 print
'<td class="liste_titre">';
880if (!empty($arrayfields[
'u.statut'][
'checked'])) {
882 print
'<td class="liste_titre center parentonrightofpage">';
883 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');
888 print
'<td class="liste_titre maxwidthsearch">';
889 $searchpicto = $form->showFilterButtons();
900print
'<tr class="liste_titre">';
902 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
905if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
907 print_liste_field_titre($arrayfields[
'u.rowid'][
'label'], $_SERVER[
'PHP_SELF'],
"u.rowid",
"", $param,
"", $sortfield, $sortorder);
910if (!empty($arrayfields[
'u.login'][
'checked'])) {
911 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
'PHP_SELF'],
"u.login",
"", $param,
"", $sortfield, $sortorder);
914if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
915 print_liste_field_titre(
"Lastname", $_SERVER[
'PHP_SELF'],
"u.lastname",
"", $param,
"", $sortfield, $sortorder);
918if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
919 print_liste_field_titre(
"FirstName", $_SERVER[
'PHP_SELF'],
"u.firstname",
"", $param,
"", $sortfield, $sortorder);
922if (!empty($arrayfields[
'u.gender'][
'checked'])) {
923 print_liste_field_titre(
"Gender", $_SERVER[
'PHP_SELF'],
"u.gender",
"", $param,
"", $sortfield, $sortorder,
'center ');
926if (!empty($arrayfields[
'u.employee'][
'checked'])) {
927 print_liste_field_titre(
"Employee", $_SERVER[
'PHP_SELF'],
"u.employee",
"", $param,
"", $sortfield, $sortorder,
'center ');
930if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
931 print_liste_field_titre(
"HierarchicalResponsible", $_SERVER[
'PHP_SELF'],
"u.fk_user",
"", $param,
"", $sortfield, $sortorder);
934if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
935 print_liste_field_titre(
"AccountancyCode", $_SERVER[
'PHP_SELF'],
"u.accountancy_code",
"", $param,
"", $sortfield, $sortorder);
938if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
939 print_liste_field_titre(
"PhonePro", $_SERVER[
'PHP_SELF'],
"u.office_phone",
"", $param,
"", $sortfield, $sortorder);
942if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
943 print_liste_field_titre(
"PhoneMobile", $_SERVER[
'PHP_SELF'],
"u.user_mobile",
"", $param,
"", $sortfield, $sortorder);
946if (!empty($arrayfields[
'u.email'][
'checked'])) {
950if (!empty($arrayfields[
'co.label'][
'checked'])) {
954if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
958if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
962if (!empty($arrayfields[
'u.entity'][
'checked'])) {
963 print_liste_field_titre($arrayfields[
'u.entity'][
'label'], $_SERVER[
'PHP_SELF'],
"u.entity",
"", $param,
"", $sortfield, $sortorder);
966if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
967 print_liste_field_titre(
"RefEmployee", $_SERVER[
'PHP_SELF'],
"u.ref_employee",
"", $param,
"", $sortfield, $sortorder);
970if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
971 print_liste_field_titre(
"NationalRegistrationNumber", $_SERVER[
'PHP_SELF'],
"u.national_registration_number",
"", $param,
"", $sortfield, $sortorder);
974if (!empty($arrayfields[
'u.job'][
'checked'])) {
975 print_liste_field_titre($arrayfields[
'u.job'][
'label'], $_SERVER[
'PHP_SELF'],
"u.job",
"", $param,
"", $sortfield, $sortorder);
978if (!empty($arrayfields[
'u.salary'][
'checked'])) {
979 print_liste_field_titre(
"Salary", $_SERVER[
'PHP_SELF'],
"u.salary",
"", $param,
"", $sortfield, $sortorder,
'right ');
982if (!empty($arrayfields[
'u.thm'][
'checked'])) {
983 print_liste_field_titre(
"THM", $_SERVER[
'PHP_SELF'],
"u.thm",
'', $param,
"", $sortfield, $sortorder,
'right ');
986if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
987 print_liste_field_titre(
"LastConnexion", $_SERVER[
'PHP_SELF'],
"u.datelastlogin",
"", $param,
'', $sortfield, $sortorder,
'center ');
990if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
991 print_liste_field_titre(
"PreviousConnexion", $_SERVER[
'PHP_SELF'],
"u.datepreviouslogin",
"", $param,
'', $sortfield, $sortorder,
'center ');
995include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
997$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
998$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
999print $hookmanager->resPrint;
1000if (!empty($arrayfields[
'u.datec'][
'checked'])) {
1001 print_liste_field_titre(
"DateCreationShort", $_SERVER[
"PHP_SELF"],
"u.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1004if (!empty($arrayfields[
'date_modification'][
'checked'])) {
1005 print_liste_field_titre(
"DateModificationShort", $_SERVER[
"PHP_SELF"],
"date_modification",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1008if (!empty($arrayfields[
'import_key'][
'checked'])) {
1009 print_liste_field_titre(
"ImportId", $_SERVER[
"PHP_SELF"],
"u.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1012if (!empty($arrayfields[
'u.import_key'][
'checked'])) {
1013 print_liste_field_titre(
"ImportId", $_SERVER[
"PHP_SELF"],
"u.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1016if (!empty($arrayfields[
'u.statut'][
'checked'])) {
1017 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"u.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1022 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1029$needToFetchEachLine = 0;
1030if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
1031 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
1032 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
1033 $needToFetchEachLine++;
1043$totalarray = array(
'val' => array(
'u.salary' => 0));
1045$imaxinloop = ($limit ? min($num, $limit) : $num);
1046while ($i < $imaxinloop) {
1047 $obj = $db->fetch_object($resql);
1053 $object->setVarsFromFetchObj($obj);
1057 $object->ref = (string) $obj->rowid;
1059 $object->statut = $obj->status;
1060 $object->status = $obj->status;
1061 $object->office_phone = $obj->office_phone;
1062 $object->user_mobile = $obj->user_mobile;
1065 $object->gender = $obj->gender;
1066 $object->socid = $obj->fk_soc;
1067 $object->firstname = $obj->firstname;
1068 $object->lastname = $obj->lastname;
1069 $object->employee = $obj->employee;
1071 $object->datestartvalidity = $db->jdate($obj->datestartvalidity);
1072 $object->dateendvalidity = $db->jdate($obj->dateendvalidity);
1073 $object->country_code = $obj->country_code;
1074 $object->country = $obj->country_label;
1076 $li =
$object->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1078 $canreadhrmdata = 0;
1079 if ((
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($obj->rowid, $childids))
1080 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1081 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1082 $canreadhrmdata = 1;
1084 $canreadsecretapi = 0;
1085 if ($user->id == $obj->rowid || !empty($user->admin)) {
1086 $canreadsecretapi = 1;
1089 if ($mode ==
'kanban') {
1091 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1092 print
'<div class="box-flex-container kanban">';
1097 if ($massactionbutton || $massaction) {
1099 if (in_array(
$object->id, $arrayofselected)) {
1103 print
$object->getKanbanView(
'', array(
'selected' => $selected));
1104 if ($i == ($imaxinloop - 1)) {
1111 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select">';
1114 print
'<td class="nowrap center">';
1115 if ($massactionbutton || $massaction) {
1117 if (in_array(
$object->id, $arrayofselected)) {
1120 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1128 if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
1129 print
'<td class="nowraponall">'.dolPrintHTML((
string) $obj->rowid).
'</td>';
1135 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1136 print
'<td class="nowraponall tdoverflowmax150">';
1138 if (
isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
1139 print
img_picto($langs->trans(
"SuperAdministratorDesc"),
'superadmin',
'class="valignmiddle paddingright paddingleft"');
1140 } elseif ($obj->admin) {
1141 print
img_picto($langs->trans(
"AdministratorDesc"),
'admin',
'class="valignmiddle paddingright paddingleft"');
1149 if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
1150 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
1156 if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
1157 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
1163 if (!empty($arrayfields[
'u.gender'][
'checked'])) {
1164 print
'<td class="center">';
1168 switch ($obj->gender) {
1170 $addgendertxt .=
'<i class="fas fa-mars" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1173 $addgendertxt .=
'<i class="fas fa-venus" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1176 $addgendertxt .=
'<i class="fas fa-transgender" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1179 print $addgendertxt;
1188 if (!empty($arrayfields[
'u.employee'][
'checked'])) {
1189 print
'<td class="center">'.yn($obj->employee).
'</td>';
1196 if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
1197 print
'<td class="tdoverflowmax125">';
1199 $user2->id = $obj->id2;
1200 $user2->login = $obj->login2;
1201 $user2->lastname = $obj->lastname2;
1202 $user2->firstname = $obj->firstname2;
1203 $user2->gender = $obj->gender2;
1204 $user2->photo = $obj->photo2;
1205 $user2->admin = $obj->admin2;
1206 $user2->office_phone = $obj->office_phone;
1207 $user2->user_mobile = $obj->user_mobile;
1208 $user2->email = $obj->email2;
1209 $user2->socid = $obj->fk_soc2;
1210 $user2->statut = $obj->status2;
1211 $user2->status = $obj->status2;
1212 if (
isModEnabled(
'multicompany') && $obj->admin2 && !$obj->entity2) {
1213 print
img_picto($langs->trans(
"SuperAdministratorDesc"),
'superadmin',
'class="valignmiddle paddingright"');
1214 } elseif ($obj->admin2) {
1215 print
img_picto($langs->trans(
"AdministratorDesc"),
'admin',
'class="valignmiddle paddingright"');
1217 print $user2->getNomUrl(-1,
'', 0, 0, 24, 0,
'',
'', 1);
1226 if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
1227 print
'<td>'.$obj->accountancy_code.
'</td>';
1234 if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
1235 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'phone').
"</td>\n";
1241 if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
1242 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'mobile').
"</td>\n";
1248 if (!empty($arrayfields[
'u.email'][
'checked'])) {
1249 print
'<td class="tdoverflowmax150" title="'.dolPrintHTMLForAttribute($obj->email).
'">'.
dol_print_email($obj->email, $obj->rowid, $obj->fk_soc, 1, 0, 0, 1).
"</td>\n";
1255 if (!empty($arrayfields[
'co.label'][
'checked'])) {
1256 print
'<td class="tdoverflowmax150">'.$obj->country_label.
"</td>\n";
1262 if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
1264 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($api_key).
'">';
1266 if ($canreadsecretapi) {
1267 print
'<span class="opacitymedium">';
1271 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1280 if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
1281 print
'<td class="tdoverflowmax150">';
1282 if ($obj->fk_soc > 0) {
1283 $companystatic->id = $obj->fk_soc;
1284 $companystatic->name = $obj->name;
1285 $companystatic->canvas = $obj->canvas;
1286 print $companystatic->getNomUrl(1);
1287 } elseif ($obj->ldap_sid) {
1288 print
'<span class="opacitymedium">'.$langs->trans(
"DomainUser").
'</span>';
1290 print
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
1299 if (!empty($arrayfields[
'u.entity'][
'checked'])) {
1300 if (!$obj->entity) {
1301 $labeltouse = $langs->trans(
"AllEntities");
1303 $mc->getInfo($obj->entity);
1304 $labeltouse = $mc->label;
1306 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltouse).
'">';
1316 if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
1317 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_employee).
'">';
1325 if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
1326 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->national_registration_number).
'">';
1334 if (!empty($arrayfields[
'u.job'][
'checked'])) {
1335 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->job).
'">';
1344 if (!empty($arrayfields[
'u.salary'][
'checked'])) {
1345 print
'<td class="nowraponall right amount">';
1347 if ($canreadhrmdata) {
1348 print
price($obj->salary);
1350 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1360 if (!isset($totalarray[
'val'])) {
1363 if (!isset($totalarray[
'val'][
'u.salary'])) {
1370 if (!empty($arrayfields[
'u.thm'][
'checked'])) {
1371 print
'<td class="nowraponall right amount">';
1372 if (!is_null($obj->thm)) {
1373 print
price($obj->thm);
1382 if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
1383 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datelastlogin),
"dayhour").
'</td>';
1389 if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
1390 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datepreviouslogin),
"dayhour").
'</td>';
1397 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1399 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1400 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1401 print $hookmanager->resPrint;
1403 if (!empty($arrayfields[
'u.datec'][
'checked'])) {
1404 print
'<td class="center nowraponall">';
1405 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1412 if (!empty($arrayfields[
'date_modification'][
'checked'])) {
1413 print
'<td class="center nowraponall">';
1414 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1421 if (!empty($arrayfields[
'u.import_key'][
'checked'])) {
1422 print
'<td class="center">'.dolPrintHTML($obj->import_key).
'</td>';
1428 if (!empty($arrayfields[
'u.statut'][
'checked'])) {
1429 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
1436 print
'<td class="nowrap center">';
1437 if ($massactionbutton || $massaction) {
1439 if (in_array(
$object->id, $arrayofselected)) {
1442 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1457include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1462 foreach ($arrayfields as $key => $val) {
1463 if (!empty($val[
'checked'])) {
1467 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1473$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1474$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1475print $hookmanager->resPrint;
1477print
'</table>'.
"\n";
1480print
'</form>'.
"\n";
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
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.
GETPOSTDATE($prefix, $hourTime='', $gm='auto', $saverestore='')
Helper function that combines values of a dolibarr DatePicker (such as Form\selectDate) for year,...
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.