33require
'../main.inc.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
35if (isModEnabled(
'category')) {
36 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
48$langs->loadLangs(array(
'users',
'companies',
'hrm',
'salaries'));
50$action =
GETPOST(
'action',
'aZ09') ?
GETPOST(
'action',
'aZ09') :
'view';
51$massaction =
GETPOST(
'massaction',
'alpha');
53$confirm =
GETPOST(
'confirm',
'alpha');
54$cancel =
GETPOST(
'cancel',
'alpha');
55$toselect =
GETPOST(
'toselect',
'array');
56$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') : str_replace(
'_',
'', basename(dirname(__FILE__)).basename(__FILE__,
'.php'));
57$backtopage =
GETPOST(
'backtopage',
'alpha');
58$optioncss =
GETPOST(
'optioncss',
'aZ');
63if ($user->socid > 0) {
64 $socid = $user->socid;
69$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
70$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
72if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
76$offset = $limit * $page;
83$diroutputmassaction =
$conf->user->dir_output.
'/temp/massgeneration/'.$user->id;
84$hookmanager->initHooks(array(
'userlist'));
87$extrafields->fetch_name_optionals_label(
$object->table_element);
89$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
92 $sortfield =
"u.login";
99$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
101foreach (
$object->fields as $key => $val) {
102 if (
GETPOST(
'search_'.$key,
'alpha') !==
'') {
103 $search[$key] =
GETPOST(
'search_'.$key,
'alpha');
105 if (preg_match(
'/^(date|timestamp|datetime)/', $val[
'type'])) {
111$userstatic =
new User($db);
112$companystatic =
new Societe($db);
113$form =
new Form($db);
116$fieldstosearchall = array(
117 'u.login' =>
"Login",
118 'u.lastname' =>
"Lastname",
119 'u.firstname' =>
"Firstname",
120 'u.accountancy_code' =>
"AccountancyCode",
121 'u.office_phone' =>
"PhonePro",
122 'u.user_mobile' =>
"PhoneMobile",
123 'u.email' =>
"EMail",
124 'co.label' =>
"Country",
125 'u.note_public' =>
"NotePublic",
126 'u.note_private' =>
"NotePrivate"
128if (isModEnabled(
'api')) {
129 $fieldstosearchall[
'u.api_key'] =
"ApiKey";
132$permissiontoreadhr = $user->hasRight(
'hrm',
'read_personal_information',
'read') || $user->hasRight(
'hrm',
'write_personal_information',
'write');
133$permissiontowritehr = $user->hasRight(
'hrm',
'write_personal_information',
'write');
137 'u.rowid' => array(
'label' =>
"TechnicalID",
'checked' => -1,
'position' => 5),
138 'u.login' => array(
'label' =>
"Login",
'checked' => 1,
'position' => 10),
139 'u.lastname' => array(
'label' =>
"Lastname",
'checked' => 1,
'position' => 15),
140 'u.firstname' => array(
'label' =>
"Firstname",
'checked' => 1,
'position' => 20),
141 'u.entity' => array(
'label' =>
"Entity",
'checked' => 1,
'position' => 50,
'enabled' => (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE'))),
142 'u.gender' => array(
'label' =>
"Gender",
'checked' => 0,
'position' => 22),
143 'u.employee' => array(
'label' =>
"Employee",
'checked' => ($contextpage ==
'employeelist' ? 1 : 0),
'position' => 25),
144 'u.fk_user' => array(
'label' =>
"HierarchicalResponsible",
'checked' => 1,
'position' => 27,
'csslist' =>
'maxwidth150'),
145 'u.accountancy_code' => array(
'label' =>
"AccountancyCode",
'checked' => 0,
'position' => 30),
146 'u.office_phone' => array(
'label' =>
"PhonePro",
'checked' => 1,
'position' => 31),
147 'u.user_mobile' => array(
'label' =>
"PhoneMobile",
'checked' => 1,
'position' => 32),
148 'u.email' => array(
'label' =>
"EMail",
'checked' => 1,
'position' => 35),
149 'co.label' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 37),
150 'u.api_key' => array(
'label' =>
"ApiKey",
'checked' => 0,
'position' => 40,
"enabled" => (isModEnabled(
'api') && $user->admin)),
151 'u.fk_soc' => array(
'label' =>
"Company",
'checked' => ($contextpage ==
'employeelist' ? 0 : 1),
'position' => 45),
152 'u.ref_employee' => array(
'label' =>
"RefEmployee",
'checked' => -1,
'position' => 50,
'enabled' => (isModEnabled(
'hrm') && $permissiontoreadhr)),
153 'u.national_registration_number' => array(
'label' =>
"NationalRegistrationNumber",
'checked' => -1,
'position' => 51,
'enabled' => (isModEnabled(
'hrm') && $permissiontoreadhr)),
154 'u.job' => array(
'label' =>
"PostOrFunction",
'checked' => -1,
'position' => 60),
155 'u.salary' => array(
'label' =>
"Salary",
'checked' => -1,
'position' => 80,
'enabled' => (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall")),
'isameasure' => 1),
156 'u.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 500),
157 'u.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 500),
158 'u.statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000),
162 $arrayfields[
'u.datelastlogin'] = array(
'label' =>
"LastConnexion",
'checked' => 1,
'position' => 100);
163 $arrayfields[
'u.datepreviouslogin'] = array(
'label' =>
"PreviousConnexion",
'checked' => 0,
'position' => 110);
167include DOL_DOCUMENT_ROOT .
'/core/tpl/extrafields_list_array_fields.tpl.php';
171'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
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$searchCategoryUserOperator = 0;
195if (GETPOSTISSET(
'formfilteraction')) {
196 $searchCategoryUserOperator =
GETPOSTINT(
'search_category_user_operator');
200$searchCategoryUserList =
GETPOST(
'search_category_user_list',
'array');
202if (!empty($catid) && empty($searchCategoryUserList)) {
203 $searchCategoryUserList = array($catid);
206if (!empty($catid) && empty($search_categ)) {
207 $search_categ = $catid;
211if ($search_status ==
'' && empty($search_all)) {
212 $search_status =
'1';
214if ($contextpage ==
'employeelist' && !GETPOSTISSET(
'search_employee')) {
215 $search_employee = 1;
219$permissiontoadd = (isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")));
220$canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
221$canedituser = $permissiontoadd;
222$candisableuser = (isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")));
223$canreadgroup = $canreaduser;
224$caneditgroup = $canedituser;
226 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
227 $caneditgroup = (isModEnabled(
'multicompany') && !empty($user->entity) &&
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') ? false : (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")));
233if (isModEnabled(
'salaries') && $contextpage ==
'employeelist' && $search_employee == 1) {
234 if (!$user->hasRight(
"salaries",
"read")) {
238 if (!$user->hasRight(
"user",
"user",
"read") && empty($user->admin)) {
243$childids = $user->getAllChildIds(1);
250if (
GETPOST(
'cancel',
'alpha')) {
254if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
258$parameters = array(
'arrayfields' => &$arrayfields);
259$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
264if (empty($reshook)) {
266 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
269 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
273 $search_lastname =
"";
274 $search_firstname =
"";
276 $search_employee =
"";
277 $search_accountancy_code =
"";
278 $search_phonepro =
"";
279 $search_phonemobile =
"";
281 $search_country =
"";
283 $search_thirdparty =
"";
285 $search_warehouse =
"";
286 $search_supervisor =
"";
287 $search_api_key =
"";
288 $search_date_creation =
"";
289 $search_date_modification =
"";
292 $search_array_options = array();
294 $search_datelastlogin =
"";
295 $search_datepreviouslogin =
"";
298 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
299 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
304 $objectclass =
'User';
305 $objectlabel =
'User';
306 $uploaddir =
$conf->user->dir_output;
309 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
312 if (!$error && ($massaction ==
'disable' || $massaction ==
'reactivate') && $permissiontoadd) {
313 $objecttmp =
new User($db);
318 foreach ($toselect as $toselectid) {
319 if ($toselectid == $user->id) {
320 setEventMessages($langs->trans($massaction == 0 ?
'CantDisableYourself' :
'CanEnableYourself'), null,
'errors');
325 $result = $objecttmp->fetch($toselectid);
327 if ($objecttmp->admin) {
328 setEventMessages($langs->trans($massaction == 0 ?
'CantDisableAnAdminUserWithMassActions' :
'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null,
'errors');
333 $result = $objecttmp->setstatus($massaction ==
'disable' ? 0 : 1);
336 } elseif ($result < 0) {
350 if (!$error && !empty(
$conf->file->main_limit_users)) {
351 $nb =
$object->getNbOfUsers(
"active");
352 if ($nb >=
$conf->file->main_limit_users) {
354 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
373$user2 =
new User($db);
377$help_url =
'EN:Module_Users|FR:Module_Utilisateurs|ES:Módulo_Usuarios|DE:Modul_Benutzer';
378if ($contextpage ==
'employeelist' && $search_employee == 1) {
379 $title = $langs->trans(
"Employees");
381 $title = $langs->trans(
"Users");
389$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,";
390$sql .=
" u.fk_user,";
391$sql .=
" u.ref_employee, u.national_registration_number, u.job, u.salary, u.datelastlogin, u.datepreviouslogin,";
392$sql .=
" u.datestartvalidity, u.dateendvalidity,";
393$sql .=
" u.ldap_sid, u.statut as status, u.entity,";
394$sql .=
" u.tms as date_modification, u.datec as date_creation,";
395$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,";
396$sql .=
" s.nom as name, s.canvas,";
397$sql .=
" co.code as country_code, co.label as country_label";
399if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
400 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
401 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
405$parameters = array();
406$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
407$sql .= $hookmanager->resPrint;
408$sql = preg_replace(
'/,\s*$/',
'', $sql);
412$sql .=
" FROM ".MAIN_DB_PREFIX.$object->table_element.
" as u";
413if (isset($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
414 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (u.rowid = ef.fk_object)";
416$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON u.fk_soc = s.rowid";
417$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"user as u2 ON u.fk_user = u2.rowid";
418$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as co ON u.fk_country = co.rowid";
420$parameters = array();
421$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
422$sql .= $hookmanager->resPrint;
424 $sql .= $hookmanager->resPrint;
426$sql .=
" WHERE u.entity IN (".getEntity(
$object->element).
")";
428 $sql .=
" AND u.fk_soc = ".((int) $socid);
431if ($search_supervisor > 0) {
432 $sql .=
" AND u.fk_user IN (".$db->sanitize($search_supervisor).
")";
434if ($search_thirdparty !=
'') {
437if ($search_warehouse > 0) {
438 $sql .=
natural_search(array(
'u.fk_warehouse'), $search_warehouse);
440if ($search_rowid !=
'') {
443if ($search_login !=
'') {
446if ($search_lastname !=
'') {
449if ($search_firstname !=
'') {
452if ($search_gender !=
'' && $search_gender !=
'-1') {
453 $sql .=
" AND u.gender = '".$db->escape($search_gender).
"'";
455if (is_numeric($search_employee) && $search_employee >= 0) {
456 $sql .=
' AND u.employee = '.(int) $search_employee;
458if ($search_accountancy_code !=
'') {
459 $sql .=
natural_search(
"u.accountancy_code", $search_accountancy_code);
461if ($search_phonepro !=
'') {
464if ($search_phonemobile !=
'') {
467if ($search_email !=
'') {
470if ($search_country !=
'') {
471 $sql .=
" AND u.fk_country IN (".$db->sanitize($search_country).
')';
473if ($search_api_key !=
'') {
476if ($search_job !=
'') {
479if ($search_status !=
'' && $search_status >= 0) {
480 $sql .=
" AND u.statut IN (".$db->sanitize($search_status).
")";
483 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
486$searchCategoryUserList = array($search_categ);
487if (!empty($searchCategoryUserList)) {
488 $searchCategoryUserSqlList = array();
489 $listofcategoryid =
'';
490 foreach ($searchCategoryUserList as $searchCategoryUser) {
491 if (intval($searchCategoryUser) == -2) {
492 $searchCategoryUserSqlList[] =
"NOT EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user)";
493 } elseif (intval($searchCategoryUser) > 0) {
494 if ($searchCategoryUserOperator == 0) {
495 $searchCategoryUserSqlList[] =
" EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie = ".((int) $searchCategoryUser).
")";
497 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryUser);
501 if ($listofcategoryid) {
502 $searchCategoryUserSqlList[] =
" EXISTS (SELECT ck.fk_user FROM ".MAIN_DB_PREFIX.
"categorie_user as ck WHERE u.rowid = ck.fk_user AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
504 if ($searchCategoryUserOperator == 1) {
505 if (!empty($searchCategoryUserSqlList)) {
506 $sql .=
" AND (".implode(
' OR ', $searchCategoryUserSqlList).
")";
509 if (!empty($searchCategoryUserSqlList)) {
510 $sql .=
" AND (".implode(
' AND ', $searchCategoryUserSqlList).
")";
514if ($search_warehouse > 0) {
515 $sql .=
" AND u.fk_warehouse = ".((int) $search_warehouse);
517if (isModEnabled(
'salaries') && $contextpage ==
'employeelist' && !$user->hasRight(
"salaries",
"readall")) {
518 $sql .=
" AND u.rowid IN (".$db->sanitize(implode(
',', $childids)).
")";
521include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
523$parameters = array();
524$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
525$sql .= $hookmanager->resPrint;
528$nbtotalofrecords =
'';
531 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
532 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
533 $resql = $db->query($sqlforcount);
535 $objforcount = $db->fetch_object($resql);
536 $nbtotalofrecords = $objforcount->nbtotalofrecords;
541 if (($page * $limit) > $nbtotalofrecords) {
549$sql .= $db->order($sortfield, $sortorder);
551 $sql .= $db->plimit($limit + 1, $offset);
554$resql = $db->query($sql);
560$num = $db->num_rows($resql);
563if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all && !$page) {
564 $obj = $db->fetch_object($resql);
566 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$id);
573llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist mod-product page-list');
575$arrayofselected = is_array($toselect) ? $toselect : array();
579 $param .=
'&mode='.urlencode($mode);
581if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
582 $param .=
'&contextpage='.urlencode($contextpage);
584if ($limit > 0 && $limit !=
$conf->liste_limit) {
585 $param .=
'&limit='.((int) $limit);
587if ($optioncss !=
'') {
588 $param .=
'&optioncss='.urlencode($optioncss);
590if ($search_all !=
'') {
591 $param .=
'&search_all='.urlencode($search_all);
593if ($search_user !=
'') {
594 $param .=
"&search_user=".urlencode($search_user);
596if ($search_rowid !=
'') {
597 $param .=
"&search_rowid=".urlencode($search_rowid);
599if ($search_login !=
'') {
600 $param .=
"&search_login=".urlencode($search_login);
602if ($search_lastname !=
'') {
603 $param .=
"&search_lastname=".urlencode($search_lastname);
605if ($search_firstname !=
'') {
606 $param .=
"&search_firstname=".urlencode($search_firstname);
608if ($search_gender !=
'' && $search_gender !=
'-1') {
609 $param .=
"&search_gender=".urlencode($search_gender);
611if ($search_employee !=
'' && $search_employee !=
'-1') {
612 $param .=
"&search_employee=".urlencode($search_employee);
614if ($search_accountancy_code !=
'') {
615 $param .=
"&search_accountancy_code=".urlencode($search_accountancy_code);
617if ($search_phonepro !=
'') {
618 $param .=
"&search_phonepro=".urlencode($search_phonepro);
620if ($search_phonemobile !=
'') {
621 $param .=
"&search_phonemobile=".urlencode($search_phonemobile);
623if ($search_email !=
'') {
624 $param .=
"&search_email=".urlencode($search_email);
626if ($search_country !=
'') {
627 $param .=
"&search_country=".urlencode($search_country);
629if ($search_api_key !=
'') {
630 $param .=
"&search_api_key=".urlencode($search_api_key);
632if ($search_supervisor > 0) {
633 $param .=
"&search_supervisor=".urlencode($search_supervisor);
635if ($search_status !=
'') {
636 $param .=
"&search_status=".urlencode($search_status);
638if ($search_categ > 0) {
639 $param .=
'&search_categ='.urlencode((
string) ($search_categ));
641if ($search_warehouse > 0) {
642 $param .=
'&search_warehouse='.urlencode($search_warehouse);
645include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
648$arrayofmassactions = array();
649if ($permissiontoadd) {
650 $arrayofmassactions[
'disable'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"DisableUser");
652if ($permissiontoadd) {
653 $arrayofmassactions[
'reactivate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Reactivate");
655if (isModEnabled(
'category') && $permissiontoadd) {
656 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
658if ($permissiontoadd) {
659 $arrayofmassactions[
'presetsupervisor'] =
img_picto(
'',
'user',
'class="pictofixedwidth"').$langs->trans(
"SetSupervisor");
663if (
GETPOSTINT(
'nomassaction') || in_array($massaction, array(
'presend',
'predelete',
'preaffecttag',
'presetsupervisor'))) {
664 $arrayofmassactions = array();
666$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
668print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
669if ($optioncss !=
'') {
670 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
672print
'<input type="hidden" name="token" value="'.newToken().
'">';
673print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
674print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
675print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
676print
'<input type="hidden" name="page" value="'.$page.
'">';
677print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
678print
'<input type="hidden" name="page_y" value="">';
679print
'<input type="hidden" name="mode" value="'.$mode.
'">';
681$url = DOL_URL_ROOT.
'/user/card.php?action=create'.($contextpage ==
'employeelist' ?
'&search_employee=1' :
'').
'&leftmenu=';
683 $url .=
'&socid='.urlencode((
string) ($socid));
687$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'));
688$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'));
689$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
691$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewUser'),
'',
'fa fa-plus-circle', $url,
'', (
int) $permissiontoadd);
698print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'user', 0, $morehtmlright.
' '.$newcardbutton,
'', $limit, 0, 0, 1);
703$topicmail =
"SendUserRef";
705$objecttmp =
new User($db);
706$trackid =
'use'.$object->id;
707include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
710 print
"<div id='ways'>";
712 $ways = $c->print_all_ways(
' > ',
'user/list.php');
713 print
" > ".$ways[0].
"<br>\n";
719 foreach ($fieldstosearchall as $key => $val) {
720 $fieldstosearchall[$key] = $langs->trans($val);
721 $setupstring .= $key.
"=".$val.
";";
723 print
'<!-- Search done like if USER_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
724 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
733if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
734 $moreforfilter .=
'<div class="divsearchfield">';
735 $tmptitle = $langs->trans(
'Category');
736 $moreforfilter .=
img_picto($langs->trans(
"Category"),
'category',
'class="pictofixedwidth"').$formother->select_categories(Categorie::TYPE_USER, $search_categ,
'search_categ', 1, $tmptitle);
737 $moreforfilter .=
'</div>';
741 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
743 $moreforfilter .=
'<div class="divsearchfield">';
744 $tmptitle = $langs->trans(
'Warehouse');
745 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', $tmptitle, 0, 0, $tmptitle);
746 $moreforfilter .=
'</div>';
749$parameters = array();
750$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
751if (empty($reshook)) {
752 $moreforfilter .= $hookmanager->resPrint;
754 $moreforfilter = $hookmanager->resPrint;
757if (!empty($moreforfilter)) {
758 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
759 print $moreforfilter;
763$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
764$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
765$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
766$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
768print
'<div class="div-table-responsive">';
769print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
773print
'<tr class="liste_titre_filter">';
776 print
'<td class="liste_titre center maxwidthsearch">';
777 $searchpicto = $form->showFilterButtons(
'left');
781if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
782 print
'<td class="liste_titre"><input type="text" name="search_rowid" class="maxwidth50" value="'.$search_rowid.
'"></td>';
784if (!empty($arrayfields[
'u.login'][
'checked'])) {
785 print
'<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.
'"></td>';
787if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
788 print
'<td class="liste_titre"><input type="text" name="search_lastname" class="maxwidth50" value="'.$search_lastname.
'"></td>';
790if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
791 print
'<td class="liste_titre"><input type="text" name="search_firstname" class="maxwidth50" value="'.$search_firstname.
'"></td>';
793if (!empty($arrayfields[
'u.gender'][
'checked'])) {
794 print
'<td class="liste_titre center">';
795 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
796 print $form->selectarray(
'search_gender', $arraygender, $search_gender, 1);
799if (!empty($arrayfields[
'u.employee'][
'checked'])) {
800 print
'<td class="liste_titre">';
801 print $form->selectyesno(
'search_employee', $search_employee, 1,
false, 1);
805if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
806 print
'<td class="liste_titre">';
807 print $form->select_dolusers($search_supervisor,
'search_supervisor', 1, array(), 0,
'', 0, 0, 0, 0,
'', 0,
'',
'maxwidth125');
810if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
811 print
'<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.
'"></td>';
813if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
814 print
'<td class="liste_titre"><input type="text" name="search_phonepro" class="maxwidth50" value="'.$search_phonepro.
'"></td>';
816if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
817 print
'<td class="liste_titre"><input type="text" name="search_phonemobile" class="maxwidth50" value="'.$search_phonemobile.
'"></td>';
819if (!empty($arrayfields[
'u.email'][
'checked'])) {
820 print
'<td class="liste_titre"><input type="text" name="search_email" class="maxwidth75" value="'.$search_email.
'"></td>';
822if (!empty($arrayfields[
'co.label'][
'checked'])) {
823 print
'<td class="liste_titre">';
824 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
827if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
828 print
'<td class="liste_titre"><input type="text" name="search_api_key" class="maxwidth50" value="'.$search_api_key.
'"></td>';
830if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
831 print
'<td class="liste_titre"><input type="text" name="search_thirdparty" class="maxwidth75" value="'.$search_thirdparty.
'"></td>';
833if (!empty($arrayfields[
'u.entity'][
'checked'])) {
834 print
'<td class="liste_titre"></td>';
836if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
837 print
'<td class="liste_titre"></td>';
839if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
840 print
'<td class="liste_titre"></td>';
842if (!empty($arrayfields[
'u.job'][
'checked'])) {
843 print
'<td class="liste_titre"><input type="text" name="search_job" class="maxwidth75" value="'.$search_job.
'"></td>';
845if (!empty($arrayfields[
'u.salary'][
'checked'])) {
846 print
'<td class="liste_titre"></td>';
848if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
849 print
'<td class="liste_titre"></td>';
851if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
852 print
'<td class="liste_titre"></td>';
855include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
857$parameters = array(
'arrayfields' => $arrayfields);
858$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
859print $hookmanager->resPrint;
860if (!empty($arrayfields[
'u.datec'][
'checked'])) {
862 print
'<td class="liste_titre">';
865if (!empty($arrayfields[
'u.tms'][
'checked'])) {
867 print
'<td class="liste_titre">';
870if (!empty($arrayfields[
'u.statut'][
'checked'])) {
872 print
'<td class="liste_titre center parentonrightofpage">';
873 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');
878 print
'<td class="liste_titre maxwidthsearch">';
879 $searchpicto = $form->showFilterButtons();
885$totalarray = array();
886$totalarray[
'nbfield'] = 0;
890print
'<tr class="liste_titre">';
892 print
getTitleFieldOfList($selectedfields, 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
893 $totalarray[
'nbfield']++;
895if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
897 print_liste_field_titre($arrayfields[
'u.rowid'][
'label'], $_SERVER[
'PHP_SELF'],
"u.rowid", $param,
"",
"", $sortfield, $sortorder);
898 $totalarray[
'nbfield']++;
900if (!empty($arrayfields[
'u.login'][
'checked'])) {
901 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
'PHP_SELF'],
"u.login", $param,
"",
"", $sortfield, $sortorder);
902 $totalarray[
'nbfield']++;
904if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
905 print_liste_field_titre(
"Lastname", $_SERVER[
'PHP_SELF'],
"u.lastname", $param,
"",
"", $sortfield, $sortorder);
906 $totalarray[
'nbfield']++;
908if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
909 print_liste_field_titre(
"FirstName", $_SERVER[
'PHP_SELF'],
"u.firstname", $param,
"",
"", $sortfield, $sortorder);
910 $totalarray[
'nbfield']++;
912if (!empty($arrayfields[
'u.gender'][
'checked'])) {
913 print_liste_field_titre(
"Gender", $_SERVER[
'PHP_SELF'],
"u.gender", $param,
"",
"", $sortfield, $sortorder,
'center ');
914 $totalarray[
'nbfield']++;
916if (!empty($arrayfields[
'u.employee'][
'checked'])) {
917 print_liste_field_titre(
"Employee", $_SERVER[
'PHP_SELF'],
"u.employee", $param,
"",
"", $sortfield, $sortorder,
'center ');
918 $totalarray[
'nbfield']++;
920if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
921 print_liste_field_titre(
"HierarchicalResponsible", $_SERVER[
'PHP_SELF'],
"u.fk_user", $param,
"",
"", $sortfield, $sortorder);
922 $totalarray[
'nbfield']++;
924if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
925 print_liste_field_titre(
"AccountancyCode", $_SERVER[
'PHP_SELF'],
"u.accountancy_code", $param,
"",
"", $sortfield, $sortorder);
926 $totalarray[
'nbfield']++;
928if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
929 print_liste_field_titre(
"PhonePro", $_SERVER[
'PHP_SELF'],
"u.office_phone", $param,
"",
"", $sortfield, $sortorder);
930 $totalarray[
'nbfield']++;
932if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
933 print_liste_field_titre(
"PhoneMobile", $_SERVER[
'PHP_SELF'],
"u.user_mobile", $param,
"",
"", $sortfield, $sortorder);
934 $totalarray[
'nbfield']++;
936if (!empty($arrayfields[
'u.email'][
'checked'])) {
938 $totalarray[
'nbfield']++;
940if (!empty($arrayfields[
'co.label'][
'checked'])) {
942 $totalarray[
'nbfield']++;
944if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
946 $totalarray[
'nbfield']++;
948if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
950 $totalarray[
'nbfield']++;
952if (!empty($arrayfields[
'u.entity'][
'checked'])) {
953 print_liste_field_titre($arrayfields[
'u.entity'][
'label'], $_SERVER[
'PHP_SELF'],
"u.entity", $param,
"",
"", $sortfield, $sortorder);
954 $totalarray[
'nbfield']++;
956if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
957 print_liste_field_titre(
"RefEmployee", $_SERVER[
'PHP_SELF'],
"u.ref_employee", $param,
"",
"", $sortfield, $sortorder);
958 $totalarray[
'nbfield']++;
960if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
961 print_liste_field_titre(
"NationalRegistrationNumber", $_SERVER[
'PHP_SELF'],
"u.national_registration_number", $param,
"",
"", $sortfield, $sortorder);
962 $totalarray[
'nbfield']++;
964if (!empty($arrayfields[
'u.job'][
'checked'])) {
965 print_liste_field_titre($arrayfields[
'u.job'][
'label'], $_SERVER[
'PHP_SELF'],
"u.job", $param,
"",
"", $sortfield, $sortorder);
966 $totalarray[
'nbfield']++;
968if (!empty($arrayfields[
'u.salary'][
'checked'])) {
969 print_liste_field_titre(
"Salary", $_SERVER[
'PHP_SELF'],
"u.salary", $param,
"",
"", $sortfield, $sortorder,
'right ');
970 $totalarray[
'nbfield']++;
972if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
973 print_liste_field_titre(
"LastConnexion", $_SERVER[
'PHP_SELF'],
"u.datelastlogin", $param,
"",
'', $sortfield, $sortorder,
'center ');
974 $totalarray[
'nbfield']++;
976if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
977 print_liste_field_titre(
"PreviousConnexion", $_SERVER[
'PHP_SELF'],
"u.datepreviouslogin", $param,
"",
'', $sortfield, $sortorder,
'center ');
978 $totalarray[
'nbfield']++;
981include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
983$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &$totalarray);
984$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object);
985print $hookmanager->resPrint;
986if (!empty($arrayfields[
'u.datec'][
'checked'])) {
987 print_liste_field_titre(
"DateCreationShort", $_SERVER[
"PHP_SELF"],
"u.datec",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
988 $totalarray[
'nbfield']++;
990if (!empty($arrayfields[
'u.tms'][
'checked'])) {
991 print_liste_field_titre(
"DateModificationShort", $_SERVER[
"PHP_SELF"],
"u.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
992 $totalarray[
'nbfield']++;
994if (!empty($arrayfields[
'u.statut'][
'checked'])) {
995 print_liste_field_titre(
"Status", $_SERVER[
"PHP_SELF"],
"u.statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
996 $totalarray[
'nbfield']++;
1000 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
1001 $totalarray[
'nbfield']++;
1007$needToFetchEachLine = 0;
1008if (isset($extrafields->attributes[
$object->table_element][
'computed']) && is_array($extrafields->attributes[
$object->table_element][
'computed']) && count($extrafields->attributes[
$object->table_element][
'computed']) > 0) {
1009 foreach ($extrafields->attributes[
$object->table_element][
'computed'] as $key => $val) {
1010 if (!is_null($val) && preg_match(
'/\$object/', $val)) {
1011 $needToFetchEachLine++;
1020$savnbfield = $totalarray[
'nbfield'];
1021$totalarray = array(
'val' => array(
'u.salary' => 0));
1022$totalarray[
'nbfield'] = 0;
1023$imaxinloop = ($limit ? min($num, $limit) : $num);
1024while ($i < $imaxinloop) {
1025 $obj = $db->fetch_object($resql);
1031 $object->setVarsFromFetchObj($obj);
1037 $object->statut = $obj->status;
1038 $object->status = $obj->status;
1039 $object->office_phone = $obj->office_phone;
1040 $object->user_mobile = $obj->user_mobile;
1043 $object->gender = $obj->gender;
1044 $object->socid = $obj->fk_soc;
1045 $object->firstname = $obj->firstname;
1046 $object->lastname = $obj->lastname;
1047 $object->employee = $obj->employee;
1049 $object->datestartvalidity = $db->jdate($obj->datestartvalidity);
1050 $object->dateendvalidity = $db->jdate($obj->dateendvalidity);
1051 $object->country_code = $obj->country_code;
1052 $object->country = $obj->country_label;
1054 $li =
$object->getNomUrl(-1,
'', 0, 0, 24, 1,
'login',
'', 1);
1056 $canreadhrmdata = 0;
1057 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($obj->rowid, $childids))
1058 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1059 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1060 $canreadhrmdata = 1;
1062 $canreadsecretapi = 0;
1063 if ($user->id == $obj->rowid || !empty($user->admin)) {
1064 $canreadsecretapi = 1;
1067 if ($mode ==
'kanban') {
1069 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
1070 print
'<div class="box-flex-container kanban">';
1075 if ($massactionbutton || $massaction) {
1077 if (in_array(
$object->id, $arrayofselected)) {
1081 print
$object->getKanbanView(
'', array(
'selected' => $selected));
1082 if ($i == ($imaxinloop - 1)) {
1089 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
1092 print
'<td class="nowrap center">';
1093 if ($massactionbutton || $massaction) {
1095 if (in_array(
$object->id, $arrayofselected)) {
1098 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1102 $totalarray[
'nbfield']++;
1106 if (!empty($arrayfields[
'u.rowid'][
'checked'])) {
1107 print
'<td class="nowraponall">'.dol_escape_htmltag($obj->rowid).
'</td>';
1109 $totalarray[
'nbfield']++;
1113 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1114 print
'<td class="nowraponall tdoverflowmax150">';
1116 if (isModEnabled(
'multicompany') && $obj->admin && !$obj->entity) {
1117 print
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar',
'class="valignmiddle paddingright paddingleft"');
1118 } elseif ($obj->admin) {
1119 print
img_picto($langs->trans(
"AdministratorDesc"),
'star',
'class="valignmiddle paddingright paddingleft"');
1123 $totalarray[
'nbfield']++;
1126 if (!empty($arrayfields[
'u.lastname'][
'checked'])) {
1127 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->lastname).
'</td>';
1129 $totalarray[
'nbfield']++;
1132 if (!empty($arrayfields[
'u.firstname'][
'checked'])) {
1133 print
'<td class="tdoverflowmax150" title="'.dol_escape_htmltag($obj->lastname).
'">'.
dol_escape_htmltag($obj->firstname).
'</td>';
1135 $totalarray[
'nbfield']++;
1138 if (!empty($arrayfields[
'u.gender'][
'checked'])) {
1139 print
'<td class="center">';
1143 switch ($obj->gender) {
1145 $addgendertxt .=
'<i class="fas fa-mars" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1148 $addgendertxt .=
'<i class="fas fa-venus" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1151 $addgendertxt .=
'<i class="fas fa-transgender" title="'.dol_escape_htmltag($langs->trans(
"Gender".$obj->gender)).
'"></i>';
1154 print $addgendertxt;
1159 $totalarray[
'nbfield']++;
1163 if (!empty($arrayfields[
'u.employee'][
'checked'])) {
1164 print
'<td class="center">'.yn($obj->employee).
'</td>';
1166 $totalarray[
'nbfield']++;
1171 if (!empty($arrayfields[
'u.fk_user'][
'checked'])) {
1172 print
'<td class="tdoverflowmax125">';
1174 $user2->id = $obj->id2;
1175 $user2->login = $obj->login2;
1176 $user2->lastname = $obj->lastname2;
1177 $user2->firstname = $obj->firstname2;
1178 $user2->gender = $obj->gender2;
1179 $user2->photo = $obj->photo2;
1180 $user2->admin = $obj->admin2;
1181 $user2->office_phone = $obj->office_phone;
1182 $user2->user_mobile = $obj->user_mobile;
1183 $user2->email = $obj->email2;
1184 $user2->socid = $obj->fk_soc2;
1185 $user2->statut = $obj->status2;
1186 $user2->status = $obj->status2;
1187 if (isModEnabled(
'multicompany') && $obj->admin2 && !$obj->entity2) {
1188 print
img_picto($langs->trans(
"SuperAdministratorDesc"),
'redstar',
'class="valignmiddle paddingright"');
1189 } elseif ($obj->admin2) {
1190 print
img_picto($langs->trans(
"AdministratorDesc"),
'star',
'class="valignmiddle paddingright"');
1192 print $user2->getNomUrl(-1,
'', 0, 0, 24, 0,
'',
'', 1);
1196 $totalarray[
'nbfield']++;
1200 if (!empty($arrayfields[
'u.accountancy_code'][
'checked'])) {
1201 print
'<td>'.$obj->accountancy_code.
'</td>';
1203 $totalarray[
'nbfield']++;
1208 if (!empty($arrayfields[
'u.office_phone'][
'checked'])) {
1209 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->office_phone, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'phone').
"</td>\n";
1211 $totalarray[
'nbfield']++;
1215 if (!empty($arrayfields[
'u.user_mobile'][
'checked'])) {
1216 print
'<td class="tdoverflowmax125">'.dol_print_phone($obj->user_mobile, $obj->country_code, 0, $obj->rowid,
'AC_TEL',
' ',
'mobile').
"</td>\n";
1218 $totalarray[
'nbfield']++;
1222 if (!empty($arrayfields[
'u.email'][
'checked'])) {
1223 print
'<td class="tdoverflowmax150">'.dol_print_email($obj->email, $obj->rowid, $obj->fk_soc, 1, 0, 0, 1).
"</td>\n";
1225 $totalarray[
'nbfield']++;
1229 if (!empty($arrayfields[
'co.label'][
'checked'])) {
1230 print
'<td class="tdoverflowmax150">'.$obj->country_label.
"</td>\n";
1232 $totalarray[
'nbfield']++;
1236 if (!empty($arrayfields[
'u.api_key'][
'checked'])) {
1238 print
'<td class="tdoverflowmax125" title="'.dol_escape_htmltag($api_key).
'">';
1240 if ($canreadsecretapi) {
1241 print
'<span class="opacitymedium">';
1245 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1250 $totalarray[
'nbfield']++;
1254 if (!empty($arrayfields[
'u.fk_soc'][
'checked'])) {
1255 print
'<td class="tdoverflowmax150">';
1256 if ($obj->fk_soc > 0) {
1257 $companystatic->id = $obj->fk_soc;
1258 $companystatic->name = $obj->name;
1259 $companystatic->canvas = $obj->canvas;
1260 print $companystatic->getNomUrl(1);
1261 } elseif ($obj->ldap_sid) {
1262 print
'<span class="opacitymedium">'.$langs->trans(
"DomainUser").
'</span>';
1264 print
'<span class="opacitymedium">'.$langs->trans(
"InternalUser").
'</span>';
1268 $totalarray[
'nbfield']++;
1272 if (isModEnabled(
'multicompany') && is_object($mc) && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE')) {
1273 if (!empty($arrayfields[
'u.entity'][
'checked'])) {
1274 if (!$obj->entity) {
1275 $labeltouse = $langs->trans(
"AllEntities");
1277 $mc->getInfo($obj->entity);
1278 $labeltouse = $mc->label;
1280 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($labeltouse).
'">';
1284 $totalarray[
'nbfield']++;
1290 if (!empty($arrayfields[
'u.ref_employee'][
'checked'])) {
1291 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_employee).
'">';
1295 $totalarray[
'nbfield']++;
1299 if (!empty($arrayfields[
'u.national_registration_number'][
'checked'])) {
1300 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->national_registration_number).
'">';
1304 $totalarray[
'nbfield']++;
1308 if (!empty($arrayfields[
'u.job'][
'checked'])) {
1309 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->job).
'">';
1313 $totalarray[
'nbfield']++;
1318 if (!empty($arrayfields[
'u.salary'][
'checked'])) {
1319 print
'<td class="nowraponall right amount">';
1321 if ($canreadhrmdata) {
1322 print
price($obj->salary);
1324 print
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1329 $totalarray[
'nbfield']++;
1332 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'u.salary';
1334 if (!isset($totalarray[
'val'])) {
1335 $totalarray[
'val'] = array();
1337 if (!isset($totalarray[
'val'][
'u.salary'])) {
1338 $totalarray[
'val'][
'u.salary'] = 0;
1340 $totalarray[
'val'][
'u.salary'] += $obj->salary;
1344 if (!empty($arrayfields[
'u.datelastlogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
1345 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datelastlogin),
"dayhour").
'</td>';
1347 $totalarray[
'nbfield']++;
1351 if (!empty($arrayfields[
'u.datepreviouslogin'][
'checked']) &&
getDolGlobalInt(
'MAIN_ENABLE_LOGINS_PRIVACY') == 0) {
1352 print
'<td class="nowraponall center">'.dol_print_date($db->jdate($obj->datepreviouslogin),
"dayhour").
'</td>';
1354 $totalarray[
'nbfield']++;
1359 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1361 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1362 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1363 print $hookmanager->resPrint;
1365 if (!empty($arrayfields[
'u.datec'][
'checked'])) {
1366 print
'<td class="center nowraponall">';
1367 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1370 $totalarray[
'nbfield']++;
1374 if (!empty($arrayfields[
'u.tms'][
'checked'])) {
1375 print
'<td class="center nowraponall">';
1376 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
1379 $totalarray[
'nbfield']++;
1383 if (!empty($arrayfields[
'u.statut'][
'checked'])) {
1384 print
'<td class="center">'.$object->getLibStatut(5).
'</td>';
1386 $totalarray[
'nbfield']++;
1391 print
'<td class="nowrap center">';
1392 if ($massactionbutton || $massaction) {
1394 if (in_array(
$object->id, $arrayofselected)) {
1397 print
'<input id="cb'.$object->id.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.
$object->id.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1401 $totalarray[
'nbfield']++;
1412include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1417 foreach ($arrayfields as $key => $val) {
1418 if (!empty($val[
'checked'])) {
1422 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1428$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1429$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1430print $hookmanager->resPrint;
1432print
'</table>'.
"\n";
1435print
'</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.
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)
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.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.