40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
54if (isModEnabled(
'ldap')) {
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
57if (isModEnabled(
'member')) {
58 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
60if (isModEnabled(
'category')) {
61 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63if (isModEnabled(
'stock')) {
64 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
68$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
71$action =
GETPOST(
'action',
'aZ09');
72$mode =
GETPOST(
'mode',
'alpha');
73$confirm =
GETPOST(
'confirm',
'alpha');
75$cancel =
GETPOST(
'cancel',
'alpha');
76$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
78if (empty($id) && $action !=
'add' && $action !=
'create') {
88$childids = $user->getAllChildIds(1);
94$extrafields->fetch_name_optionals_label(
$object->table_element);
99$hookmanager->initHooks(array(
'usercard',
'globalcard'));
106 $res =
$object->fetch($id,
'',
'', 1);
111if ($user->socid > 0) {
112 $socid = $user->socid;
118$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
119$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
120$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
121$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
122$permissiontoreadgroup = $permissiontoread;
123$permissiontoeditgroup = $permissiontoedit;
125 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
126 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
129if ($user->id != $id && !$permissiontoread) {
134$permissiontoeditpasswordandsee =
false;
135$permissiontoeditpasswordandsend =
false;
138 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
139 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin));
140 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
143$passwordismodified =
false;
150$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
151$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
156if (empty($reshook)) {
157 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
159 if (empty($backtopage) || ($cancel && empty($id))) {
160 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
161 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
162 $backtopage = $backurlforlist;
164 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
170 if (!empty($backtopageforcancel)) {
171 header(
"Location: ".$backtopageforcancel);
173 } elseif (!empty($backtopage)) {
174 header(
"Location: ".$backtopage);
180 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
181 if ($id != $user->id) {
183 if (
$object->admin && empty($user->admin)) {
186 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
189 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
195 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
198 if ($id != $user->id) {
201 if (!empty($conf->file->main_limit_users)) {
202 $nb =
$object->getNbOfUsers(
"active");
203 if ($nb >= $conf->file->main_limit_users) {
205 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
211 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
217 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
218 if ($id != $user->id) {
219 if (!GETPOSTISSET(
'token')) {
220 print
'Error, token required for this critical operation';
228 $result =
$object->delete($user);
230 $langs->load(
"errors");
234 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
241 if ($action ==
'add' && $permissiontoadd) {
255 if (!empty($conf->file->main_limit_users)) {
256 $nb =
$object->getNbOfUsers(
"active");
257 if ($nb >= $conf->file->main_limit_users) {
259 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
269 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
283 if (isModEnabled(
'socialnetworks')) {
284 $object->socialnetworks = array();
285 foreach ($socialnetworks as $key => $value) {
286 if (
GETPOST($key,
'alphanohtml')) {
292 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
295 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
310 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
311 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
315 $object->dateemployment = $dateemployment;
316 $object->dateemploymentend = $dateemploymentend;
317 $object->datestartvalidity = $datestartvalidity;
318 $object->dateendvalidity = $dateendvalidity;
326 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
333 if (isModEnabled(
'multicompany')) {
340 $object->entity = ($entity ==
'' ? 1 : $entity);
344 $object->entity = ($entity ==
'' ? 1 : $entity);
355 if (
GETPOST(
'password',
'password')) {
356 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
358 if (is_int($resPass) && $resPass < 0) {
359 $langs->load(
"errors");
364 if (isModEnabled(
"category")) {
366 $usercats =
GETPOST(
'usercats',
'array');
367 $object->setCategories($usercats);
371 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
375 $langs->load(
"errors");
384 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
387 $editgroup->fetch($group);
388 $editgroup->oldcopy = clone $editgroup;
392 if ($action ==
'addgroup') {
393 $result =
$object->SetInGroup($group, $editgroup->entity);
395 if ($action ==
'removegroup') {
396 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
407 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
408 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
410 if ($permissiontoedit) {
413 if (!
GETPOST(
"lastname",
'alpha')) {
418 if (!
GETPOST(
"login",
'alpha')) {
435 if (GETPOSTISSET(
"ref_employee")) {
439 if (GETPOSTISSET(
"national_registration_number")) {
440 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
443 if ($permissiontoeditpasswordandsee) {
446 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
449 if (!empty($user->admin) && $user->id !=
$id) {
454 if ($user->admin && !
$object->ldap_sid) {
466 if (isModEnabled(
'socialnetworks')) {
467 $object->socialnetworks = array();
468 foreach ($socialnetworks as $key => $value) {
469 if (
GETPOST($key,
'alphanohtml')) {
475 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
478 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
491 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
493 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
497 $object->dateemployment = $dateemployment;
498 $object->dateemploymentend = $dateemploymentend;
499 $object->datestartvalidity = $datestartvalidity;
500 $object->dateendvalidity = $dateendvalidity;
503 if (isModEnabled(
'stock')) {
510 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
524 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
532 if (!empty($_FILES[
'photo'][
'name'])) {
538 $langs->load(
"errors");
540 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
545 $passwordismodified = 0;
548 $passwordismodified = 1;
555 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
556 $langs->load(
"errors");
557 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
565 if (!$error && GETPOSTISSET(
'contactid')) {
569 if ($contactid > 0) {
571 $contact->fetch($contactid);
573 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
574 $sql .=
" SET fk_socpeople=".((int) $contactid);
575 if (!empty($contact->socid)) {
576 $sql .=
", fk_soc=".((int) $contact->socid);
577 } elseif ($socid > 0) {
578 $sql .=
", fk_soc = null";
579 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
581 $sql .=
" WHERE rowid = ".((int)
$object->id);
582 } elseif ($socid > 0) {
583 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
584 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
585 $sql .=
" WHERE rowid = ".((int)
$object->id);
587 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
588 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
589 $sql .=
" WHERE rowid = ".((int)
$object->id);
592 $resql = $db->query($sql);
599 if (!$error && !count(
$object->errors)) {
601 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/'.
$object->oldcopy->photo;
604 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/thumbs';
608 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
609 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1,
$object,
'user').
'/photos';
615 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
617 if (!($result > 0)) {
625 $langs->load(
"errors");
626 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
631 if (!$error && !count(
$object->errors)) {
633 $categories =
GETPOST(
'usercats',
'array');
634 $object->setCategories($categories);
637 if (!$error && !count(
$object->errors)) {
641 $login = $_SESSION[
"dol_login"];
644 $langs->load(
"errors");
645 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
647 if ($passwordismodified &&
$object->login == $user->login) {
649 $langs->load(
"errors");
650 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
651 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
659 if ($permissiontoeditpasswordandsee) {
660 dol_syslog(
"Not allowed to change fields, only password");
664 if (
GETPOST(
"password",
"password")) {
667 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
668 if (is_int($ret) && $ret < 0) {
677 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
678 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
682 $newpassword =
$object->setPassword($user,
'');
683 if (is_int($newpassword) && $newpassword < 0) {
685 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
688 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
689 if (
$object->send_password($user, $newpassword) > 0) {
695 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
701 if ($action ==
'adduserldap' && $permissiontoadd) {
702 $selecteduser =
GETPOST(
'users');
704 $required_fields = array(
720 if (isModEnabled(
'socialnetworks')) {
721 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
722 foreach ($arrayofsocialnetworks as $socialnetwork) {
728 $result = $ldap->connectBind();
731 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
736 if (is_array($ldapusers)) {
737 foreach ($ldapusers as $key => $attribute) {
749 $ldap_social = array();
751 if (isModEnabled(
'socialnetworks')) {
752 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
753 foreach ($arrayofsocialnetworks as $socialnetwork) {
754 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
765 $triggersendname =
'USER_SENTBYMAIL';
767 $mode =
'emailfromuser';
768 $trackid =
'use'.$id;
769 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
772 $upload_dir = $conf->user->dir_output;
773 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
781$form =
new Form($db);
786if (isModEnabled(
'stock')) {
792$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
793$resql = $db->query($sql);
795 $obj = $db->fetch_object($resql);
797 $nbofusers = $obj->nb;
805 $title = $person_name.
" - ".$langs->trans(
'Card');
807 if (
GETPOST(
'employee',
'alphanohtml')) {
808 $title = $langs->trans(
"NewEmployee");
810 $title = $langs->trans(
"NewUser");
816llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
818if ($action ==
'create' || $action ==
'adduserldap') {
821 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
825 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
830 $result = $ldap->connectBind();
832 $required_fields = array(
852 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
857 if (is_array($ldapusers)) {
858 foreach ($ldapusers as $key => $ldapuser) {
861 foreach ($required_fields as $value) {
863 $label .= $value.
"=******* ";
865 $label .= $value.
"=".$ldapuser[$value].
" ";
868 $liste[$key] = $label;
878 print
"\n\n<!-- Form liste LDAP debut -->\n";
880 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
881 print
'<input type="hidden" name="token" value="'.newToken().
'">';
882 print
'<table class="border centpercent"><tr>';
883 print
'<td width="160">';
884 print $langs->trans(
"LDAPUsers");
887 print
'<input type="hidden" name="action" value="adduserldap">';
888 if (is_array($liste) && count($liste)) {
889 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
892 print
'</td><td class="center">';
893 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
894 print
'</td></tr></table>';
897 print
"\n<!-- Form liste LDAP fin -->\n\n";
902 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
903 print
'<input type="hidden" name="token" value="'.newToken().
'">';
904 print
'<input type="hidden" name="action" value="add">';
905 if (!empty($ldap_sid)) {
906 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
908 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
914 print
'<table class="border centpercent">';
917 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
918 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
923 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
925 if (!empty($ldap_lastname)) {
926 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
927 print $ldap_lastname;
929 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
934 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
936 if (!empty($ldap_firstname)) {
937 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
938 print $ldap_firstname;
940 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
945 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
947 if (!empty($ldap_login)) {
948 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
950 } elseif (!empty($ldap_loginsmb)) {
951 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
952 print $ldap_loginsmb;
954 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
958 if (!empty($conf->use_javascript_ajax)) {
962 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
963 if ($charforseparator ==
'none') {
964 $charforseparator =
'';
967 jQuery(document).ready(function() {
968 $(".createloginauto").on("keyup", function() {
969 console.log(".createloginauto change: We generate login when we have a lastname");
971 lastname = $("#lastname").val().toLowerCase();
974 print
' firstname = $("#firstname").val().toLowerCase()[0];';
976 print
' firstname = $("#firstname").val().toLowerCase();';
982 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
986 $(
"#login").val(login);
992 $generated_password = '';
993 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
994 $generated_password = getRandomPassword(false);
996 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
999 if (!empty($user->admin)) {
1000 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1002 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1004 if (isModEnabled('multicompany
') && !$user->entity) {
1005 if (!empty($conf->use_javascript_ajax)) {
1006 print '<script
type=
"text/javascript">
1008 $(
"select[name=admin]").change(
function() {
1009 if ( $(
this).val() == 0 ) {
1010 $(
"input[name=superadmin]")
1011 .prop(
"disabled",
true)
1012 .prop(
"checked",
false);
1013 $(
"select[name=entity]")
1014 .prop(
"disabled",
false);
1016 $(
"input[name=superadmin]")
1017 .prop(
"disabled",
false);
1020 $(
"input[name=superadmin]").change(
function() {
1021 if ( $(
this).is(
":checked") ) {
1022 $(
"select[name=entity]")
1023 .prop(
"disabled",
true);
1025 $(
"select[name=entity]")
1026 .prop(
"disabled",
false);
1032 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1033 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1034 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1036 print "</td></tr>\n";
1040 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1042 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1043 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1047 $defaultemployee = '1
';
1049 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1050 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1051 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1055 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1057 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user, 'fk_user
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1061 // Expense report validator
1062 if (isModEnabled('expensereport
')) {
1063 print '<tr><td
class=
"titlefieldcreate">
';
1064 $text = $langs->trans("ForceUserExpenseValidator");
1065 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1068 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1073 // Holiday request validator
1074 if (isModEnabled('holiday
')) {
1075 print '<tr><td
class=
"titlefieldcreate">
';
1076 $text = $langs->trans("ForceUserHolidayValidator");
1077 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1080 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1086 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1088 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1092 print '</
table><hr><
table class=
"border centpercent">
';
1096 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1098 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1102 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1107 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1110 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1111 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1113 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1114 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1116 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1117 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1118 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1119 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1122 $valuetoshow .= ($valuetoshow ?
' + '.$langs->trans(
"DolibarrPassword") :
'').
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxlength="128" type="text" id="password" name="password" value="'.
dol_escape_htmltag($password).
'" autocomplete="new-password">';
1123 if (!empty($conf->use_javascript_ajax)) {
1124 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1130 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
1131 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1133 $valuetoshow = $hookmanager->resPrint;
1135 $valuetoshow .= $hookmanager->resPrint;
1141 if (isModEnabled(
'api')) {
1144 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1146 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off">';
1147 if (!empty($conf->use_javascript_ajax)) {
1148 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1154 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1158 print
'</table><hr><table class="border centpercent">';
1162 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1163 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1165 print
'</textarea></td></tr>';
1168 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1169 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1173 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1174 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1178 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1179 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1180 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1182 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1188 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1189 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1190 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1195 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1197 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1198 if (!empty($ldap_phone)) {
1199 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1202 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1207 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1209 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1210 if (!empty($ldap_mobile)) {
1211 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1214 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1219 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1221 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1222 if (!empty($ldap_fax)) {
1223 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1226 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1231 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1233 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1234 if (!empty($ldap_mail)) {
1235 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1238 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1243 if (isModEnabled(
'socialnetworks')) {
1244 foreach ($socialnetworks as $key => $value) {
1245 if ($value[
'active']) {
1246 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1248 if (!empty($value[
'icon'])) {
1249 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1251 if (!empty($ldap_social[$key])) {
1252 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1253 print $ldap_social[$key];
1255 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1260 if (!empty($ldap_social[$key])) {
1261 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1263 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1270 if (isModEnabled(
'accounting')) {
1271 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1273 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1278 if (isModEnabled(
'agenda')) {
1279 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1281 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1286 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1287 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1288 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1289 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1295 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1296 print
'<td class="maxwidthonsmartphone">'.
"\n";
1297 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
GETPOST(
'default_lang',
'alpha') ?
GETPOST(
'default_lang',
'alpha') : (
$object->lang ?
$object->lang :
''),
'default_lang', 0, array(), 1, 0, 0,
'maxwidth300 widthcentpercentminusx');
1303 if (isModEnabled(
'multicompany') && is_object($mc)) {
1305 if (!method_exists($mc,
'formObjectOptions')) {
1306 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1307 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1308 print
"<td>".$mc->select_entities($conf->entity);
1309 print
"</td></tr>\n";
1311 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1317 $parameters = array();
1318 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1321 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1322 print
'<td class="wordbreak">';
1323 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1325 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1326 print $doleditor->Create(1);
1330 print
'<tr><td class="tdtop">';
1331 print $langs->trans(
"NotePublic");
1333 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1334 $doleditor =
new DolEditor(
'note_public', GETPOSTISSET(
'note_public') ?
GETPOST(
'note_public',
'restricthtml') :
'',
'', 100,
'dolibarr_notes',
'', false, true,
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PUBLIC'), ROWS_3,
'90%');
1335 $doleditor->Create();
1336 print
"</td></tr>\n";
1339 print
'<tr><td class="tdtop">';
1340 print $langs->trans(
"NotePrivate");
1342 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1343 $doleditor =
new DolEditor(
'note_private', GETPOSTISSET(
'note_private') ?
GETPOST(
'note_private',
'restricthtml') :
'',
'', 100,
'dolibarr_notes',
'', false, true,
getDolGlobalString(
'FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_3,
'90%');
1344 $doleditor->Create();
1345 print
"</td></tr>\n";
1347 print
'</table><hr><table class="border centpercent">';
1354 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1355 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1360 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1362 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1365 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1366 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1367 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1368 $langs->load(
"salaries");
1372 $text = $langs->trans(
"THM");
1373 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1376 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1382 $text = $langs->trans(
"TJM");
1383 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1386 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1391 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1393 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1399 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1401 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1406 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1408 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1412 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1417 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1419 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1427 print $form->buttonsSaveCancel(
"CreateUser");
1433 $res =
$object->fetch($id,
'',
'', 1);
1438 $res =
$object->fetch_optionals();
1448 $passDoNotExpire = 0;
1450 $userChangePassNextLogon = 0;
1454 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1456 $result = $ldap->connectBind();
1458 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1459 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1465 if (count($ldap->uacf) > 0) {
1466 foreach ($ldap->uacf as $key => $statut) {
1467 if ($key == 65536) {
1468 $passDoNotExpire = 1;
1469 $statutUACF = $statut;
1474 $statutUACF =
"ACCOUNTDISABLE";
1477 if ($ldap->pwdlastset == 0) {
1478 $userChangePassNextLogon = 1;
1484 if ($mode ==
'employee') {
1485 $title = $langs->trans(
"Employee");
1486 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1488 $title = $langs->trans(
"User");
1491 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1492 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1501 if ($action ==
'password') {
1502 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1508 if ($action ==
'passwordsend') {
1509 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1515 if ($action ==
'disable') {
1516 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1522 if ($action ==
'enable') {
1523 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1527 if ($action ==
'delete') {
1528 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1532 if ($action !=
'edit') {
1535 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid" rel="noopener" rel="noopener">';
1536 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1537 $morehtmlref .=
'</a>';
1539 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1540 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
1542 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1544 print
'<div class="fichecenter">';
1545 print
'<div class="fichehalfleft">';
1547 print
'<div class="underbanner clearboth"></div>';
1548 print
'<table class="border tableforfield centpercent">';
1551 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1553 print
'<td class="error">';
1554 print $langs->trans(
"LoginAccountDisableInDolibarr");
1559 if (property_exists(
$object,
'admin')) {
1560 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1561 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1562 } elseif (!empty(
$object->admin)) {
1563 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1573 $text = $langs->trans(
"Type");
1574 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1576 $type = $langs->trans(
"Internal");
1578 $type = $langs->trans(
"External");
1580 print
'<span class="badgeneutral">';
1583 print
' ('.$langs->trans(
"DomainUser").
')';
1586 print
'</td></tr>'.
"\n";
1589 if (
$object->ldap_sid && is_object($ldap)) {
1590 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1591 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1592 print
'</td></tr>'.
"\n";
1596 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1598 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1602 print
'</td></tr>'.
"\n";
1605 if ($nbofusers > 1) {
1607 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1609 if (empty(
$object->fk_user)) {
1610 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1612 $huser =
new User($db);
1614 $huser->fetch(
$object->fk_user);
1615 print $huser->getNomUrl(-1);
1617 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1624 if (isModEnabled(
'expensereport')) {
1626 $text = $langs->trans(
"ForceUserExpenseValidator");
1627 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1630 if (!empty(
$object->fk_user_expense_validator)) {
1631 $evuser =
new User($db);
1632 $evuser->fetch(
$object->fk_user_expense_validator);
1633 print $evuser->getNomUrl(-1);
1640 if (isModEnabled(
'holiday')) {
1642 $text = $langs->trans(
"ForceUserHolidayValidator");
1643 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1646 if (!empty(
$object->fk_user_holiday_validator)) {
1647 $hvuser =
new User($db);
1648 $hvuser->fetch(
$object->fk_user_holiday_validator);
1649 print $hvuser->getNomUrl(-1);
1657 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1658 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1662 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1669 if ((empty($user->socid) && in_array($id, $childids))
1670 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1671 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1672 $langs->load(
"salaries");
1675 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1677 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1683 $text = $langs->trans(
"THM");
1684 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1687 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1693 $text = $langs->trans(
"TJM");
1694 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1697 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1703 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1705 if (
$object->dateemployment) {
1706 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1709 if (
$object->dateemploymentend) {
1710 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1717 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1725 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1726 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1727 if (
$object->fk_warehouse > 0) {
1728 $warehousestatic =
new Entrepot($db);
1729 $warehousestatic->fetch(
$object->fk_warehouse);
1730 print $warehousestatic->getNomUrl(1);
1738 print
'<div class="fichehalfright">';
1740 print
'<div class="underbanner clearboth"></div>';
1742 print
'<table class="border tableforfield centpercent">';
1745 if (isModEnabled(
'agenda')) {
1746 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1748 print $formother->showColor(
$object->color,
'');
1754 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1755 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1757 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1763 $langs->load(
"languages");
1764 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1766 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1770 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1776 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1777 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1778 print
'<td>'.$object->openid.
'</td>';
1783 if (isModEnabled(
'multicompany') && is_object($mc)) {
1785 if (!method_exists($mc,
'formObjectOptions')) {
1786 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1787 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1789 print $langs->trans(
"AllEntities");
1791 $mc->getInfo(
$object->entity);
1794 print
"</td></tr>\n";
1800 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1803 if (isModEnabled(
"societe")) {
1804 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1809 $societe->fetch(
$object->socid);
1810 if ($societe->id > 0) {
1811 $s .= $societe->getNomUrl(1,
'');
1814 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1816 if (!empty(
$object->contact_id)) {
1818 $contact->fetch(
$object->contact_id);
1819 if ($contact->id > 0) {
1820 if (
$object->socid > 0 && $s) {
1825 $s .= $contact->getNomUrl(1,
'');
1834 if (isModEnabled(
'member')) {
1835 $langs->load(
"members");
1836 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1840 $adh->fetch(
$object->fk_member);
1841 $adh->ref = $adh->getFullname($langs);
1842 print $adh->getNomUrl(-1);
1844 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1851 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1853 print
"</td></tr>\n";
1861 print
'<div class="div-table-responsive-no-min">';
1862 print
'<table class="noborder tableforfield centpercent">';
1864 print
'<tr class="liste_titre"><th class="liste_titre">';
1865 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1867 print
'<th class="liste_titre"></th>';
1871 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1873 if (
$object->datestartvalidity) {
1874 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1877 if (
$object->dateendvalidity) {
1878 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1885 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1886 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
1895 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1896 if (!empty(
$object->ldap_sid)) {
1897 if ($passDoNotExpire) {
1898 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1899 } elseif ($userChangePassNextLogon) {
1900 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1901 } elseif ($userDisabled) {
1902 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1904 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1907 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1910 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1911 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1932 $parameters = array(
'valuetoshow' => $valuetoshow);
1933 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1935 $valuetoshow = $hookmanager->resPrint;
1937 $valuetoshow .= $hookmanager->resPrint;
1941 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
1942 print
'<td class="wordbreak">';
1949 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1950 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1952 if (!empty(
$object->api_key)) {
1953 print
'<span class="opacitymedium">';
1960 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1962 if (
$object->datepreviouslogin) {
1963 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1966 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1977 print
'<div class="clearboth"></div>';
1986 print
'<div class="tabsAction">';
1988 $parameters = array();
1989 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1990 if (empty($reshook)) {
1994 'class' =>
'classfortooltip'
1998 if (empty($user->socid)) {
1999 $canSendMail =
false;
2001 $langs->load(
"mails");
2002 $canSendMail =
true;
2003 unset($params[
'attr'][
'title']);
2005 $langs->load(
"mails");
2006 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2008 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2011 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2013 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2014 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2016 unset($params[
'attr'][
'title']);
2017 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
2019 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2020 (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2021 unset($params[
'attr'][
'title']);
2022 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2029 'class' =>
'classfortooltip'
2033 if (
$object->status == $object::STATUS_DISABLED) {
2034 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2035 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2036 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2037 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2038 unset($params[
'attr'][
'title']);
2039 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2042 if (
$object->status == $object::STATUS_DISABLED) {
2043 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2044 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2045 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2046 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2048 unset($params[
'attr'][
'title']);
2049 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2051 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2052 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2057 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2058 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2059 unset($params[
'attr'][
'title']);
2060 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2063 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2064 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2065 unset($params[
'attr'][
'title']);
2066 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2068 if ($user->id == $id) {
2069 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2070 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2074 if ($user->id != $id && $permissiontodisable &&
2075 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2076 if ($user->admin || !
$object->admin) {
2077 unset($params[
'attr'][
'title']);
2078 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2080 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2081 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2091 if (
GETPOST(
'modelselected')) {
2092 $action =
'presend';
2096 $modelmail =
'user';
2097 $defaulttopic =
'Information';
2098 $diroutput = $conf->user->dir_output;
2099 $trackid =
'use'.$object->id;
2101 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2103 if ($action !=
'presend' && $action !=
'send') {
2108 if ($permissiontoreadgroup) {
2109 print
'<!-- Group section -->'.
"\n";
2117 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2119 if (!empty($groupslist)) {
2120 foreach ($groupslist as $groupforuser) {
2121 $exclude[] = $groupforuser->id;
2126 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2127 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2128 print $hookmanager->resPrint;
2130 if (empty($reshook)) {
2131 if ($permissiontoeditgroup) {
2132 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2133 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2134 print
'<input type="hidden" name="action" value="addgroup" />';
2135 print
'<input type="hidden" name="page_y" value="" />';
2138 print
'<!-- List of groups of the user -->'.
"\n";
2139 print
'<table class="noborder centpercent">'.
"\n";
2140 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2141 print
'<th class="liste_titre right">';
2142 if ($permissiontoeditgroup) {
2143 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(),
$object->entity,
false,
'maxwidth150');
2145 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2146 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2148 print
'</th></tr>'.
"\n";
2151 if (!empty($groupslist)) {
2152 foreach ($groupslist as $group) {
2153 print
'<tr class="oddeven">';
2154 print
'<td class="tdoverflowmax150">';
2155 if ($permissiontoeditgroup) {
2156 print $group->getNomUrl(1);
2158 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2161 print
'<td class="right">';
2162 if ($permissiontoeditgroup) {
2163 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2164 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2169 print
"</td></tr>\n";
2172 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2177 if ($permissiontoeditgroup) {
2189 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2190 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2191 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2192 print
'<input type="hidden" name="action" value="update">';
2193 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2197 print
'<table class="border centpercent">';
2201 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2209 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2210 if ($permissiontoedit && !
$object->ldap_sid) {
2211 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2212 } elseif (
$object->civility_code) {
2213 print $langs->trans(
"Civility".
$object->civility_code);
2219 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2221 if ($permissiontoedit && !
$object->ldap_sid) {
2222 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2224 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2231 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2233 if ($permissiontoedit && !
$object->ldap_sid) {
2234 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2236 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2242 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2244 if ($user->admin && !
$object->ldap_sid) {
2245 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2247 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2254 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2256 $langs->load(
"admin");
2258 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2259 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2263 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2264 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2270 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2271 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2274 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2276 if (isModEnabled(
'multicompany') && !$user->entity) {
2277 if ($conf->use_javascript_ajax) {
2278 print
'<script type="text/javascript">
2280 var admin = $("select[name=admin]").val();
2282 $("input[name=superadmin]")
2283 .prop("disabled", true)
2284 .prop("checked", false);
2286 if ($("input[name=superadmin]").is(":checked")) {
2287 $("select[name=entity]")
2288 .prop("disabled", true);
2290 $("select[name=admin]").change(function() {
2291 if ( $(this).val() == 0 ) {
2292 $("input[name=superadmin]")
2293 .prop("disabled", true)
2294 .prop("checked", false);
2295 $("select[name=entity]")
2296 .prop("disabled", false);
2298 $("input[name=superadmin]")
2299 .prop("disabled", false);
2302 $("input[name=superadmin]").change(function() {
2303 if ( $(this).is(":checked")) {
2304 $("select[name=entity]")
2305 .prop("disabled", true);
2307 $("select[name=entity]")
2308 .prop("disabled", false);
2315 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2316 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2320 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2321 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2322 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2323 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2332 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2334 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2335 if ($permissiontoedit) {
2336 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2338 print $arraygender[
$object->gender];
2344 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2345 if ($permissiontoedit) {
2346 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2349 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2358 if ($nbofusers > 1) {
2360 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2362 if ($permissiontoedit) {
2363 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user,
'fk_user', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2365 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2366 $huser =
new User($db);
2367 $huser->fetch(
$object->fk_user);
2368 print $huser->getNomUrl(-1);
2374 if (isModEnabled(
'expensereport')) {
2375 print
'<tr><td class="titlefieldcreate">';
2376 $text = $langs->trans(
"ForceUserExpenseValidator");
2377 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2380 if ($permissiontoedit) {
2381 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2383 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2384 $evuser =
new User($db);
2385 $evuser->fetch(
$object->fk_user_expense_validator);
2386 print $evuser->getNomUrl(-1);
2393 if (isModEnabled(
'holiday')) {
2394 print
'<tr><td class="titlefieldcreate">';
2395 $text = $langs->trans(
"ForceUserHolidayValidator");
2396 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2399 if ($permissiontoedit) {
2400 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2402 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2403 $hvuser =
new User($db);
2404 $hvuser->fetch(
$object->fk_user_holiday_validator);
2405 print $hvuser->getNomUrl(-1);
2413 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2415 if ($user->id ==
$object->id || !$user->admin) {
2417 $type = $langs->trans(
"Internal");
2419 $type = $langs->trans(
"External");
2422 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2424 print
' ('.$langs->trans(
"DomainUser").
')';
2434 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2437 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2439 print
' ('.$langs->trans(
"DomainUser").
')';
2442 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2445 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2447 print
' ('.$langs->trans(
"DomainUser").
')';
2450 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2453 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2455 print
' ('.$langs->trans(
"DomainUser").
')';
2458 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2461 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2470 print
'<table class="border centpercent">';
2473 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2475 if ($permissiontoedit) {
2476 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2482 if ($permissiontoedit) {
2483 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2491 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2494 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2495 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2497 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2498 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2500 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2501 if ($permissiontoeditpasswordandsee) {
2502 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="flat" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password">';
2503 if (!empty($conf->use_javascript_ajax)) {
2504 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->trans(
'NoPasswordGenerationRuleConfigured') : $langs->trans(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2507 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2511 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2512 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2514 $valuetoshow = $hookmanager->resPrint;
2516 $valuetoshow .= $hookmanager->resPrint;
2520 print
"</td></tr>\n";
2523 if (isModEnabled(
'api')) {
2524 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2526 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2527 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2528 if (!empty($conf->use_javascript_ajax)) {
2529 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2536 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2537 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2539 if ($permissiontoedit) {
2540 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2542 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2548 print
'</table><hr><table class="border centpercent">';
2552 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2554 if ($permissiontoedit) {
2555 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2558 if ($permissiontoedit) {
2559 print
'</textarea>';
2564 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2565 if ($permissiontoedit) {
2566 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2573 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2574 if ($permissiontoedit) {
2575 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2582 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td>';
2583 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2584 if ($permissiontoedit) {
2585 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2587 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2591 print $countrylabel;
2597 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2598 if ($permissiontoedit) {
2599 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2600 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2608 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2610 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2611 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2612 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2614 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2620 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2622 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2623 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2624 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2626 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2632 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2634 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2635 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2636 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2638 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2644 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2646 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2647 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2648 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2650 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2655 if (isModEnabled(
'socialnetworks')) {
2656 foreach ($socialnetworks as $key => $value) {
2657 if ($value[
'active']) {
2658 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2660 if (!empty($value[
'icon'])) {
2661 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2663 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2664 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2666 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2667 print
$object->socialnetworks[$key];
2672 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2677 print
'</table><hr><table class="border centpercent">';
2681 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2682 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2683 print
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create&token='.
newToken().
'&backtopage='.urlencode($_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken()).
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddWarehouse").
'"></span></a>';
2688 if (isModEnabled(
'accounting')) {
2690 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2692 if ($permissiontoedit) {
2693 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2695 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2696 print
$object->accountancy_code;
2703 if (isModEnabled(
'agenda')) {
2704 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2706 if ($permissiontoedit) {
2707 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2709 print $formother->showColor(
$object->color,
'');
2716 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2718 print $form->showphoto(
'userphoto',
$object, 60, 0, $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2723 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2724 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2726 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2727 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
'',
'', 0, 0, 1);
2729 $cats = $c->containing(
$object->id, Categorie::TYPE_USER);
2730 $arrayselected = array();
2731 foreach ($cats as $cat) {
2732 $arrayselected[] = $cat->id;
2734 if ($permissiontoedit) {
2735 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected, 0, 0,
'', 0,
'90%');
2737 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2744 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td><td colspan="3">'.
"\n";
2745 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2751 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2753 print
$object->getLibStatut(4);
2780 if (isModEnabled(
'member')) {
2781 $langs->load(
"members");
2782 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2786 $adh->fetch(
$object->fk_member);
2787 $adh->ref = $adh->login;
2788 print $adh->getNomUrl(1);
2790 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2798 if (isModEnabled(
'multicompany') && is_object($mc)) {
2800 if (!method_exists($mc,
'formObjectOptions')) {
2801 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2802 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2803 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2804 print
"</td></tr>\n";
2806 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2812 $parameters = array(
'colspan' =>
' colspan="2"');
2814 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2815 print $hookmanager->resPrint;
2816 if (empty($reshook)) {
2817 if ($permissiontoedit) {
2818 print
$object->showOptionals($extrafields,
'edit');
2820 print
$object->showOptionals($extrafields,
'view');
2825 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2827 if ($permissiontoedit) {
2828 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2830 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2831 print $doleditor->Create(1);
2843 print
'<table class="border centpercent">';
2849 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2851 if ($permissiontoedit) {
2852 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2854 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2860 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2862 if ($permissiontoedit) {
2863 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2871 if ((empty($user->socid) && in_array($id, $childids))
2872 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
2873 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2874 $langs->load(
"salaries");
2877 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2879 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
2885 $text = $langs->trans(
"THM");
2886 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2889 if ($permissiontoedit) {
2890 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
2892 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2899 $text = $langs->trans(
"TJM");
2900 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2903 if ($permissiontoedit) {
2904 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
2906 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2913 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2915 if ($permissiontoedit) {
2916 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2921 if ($dateemployment && $dateemploymentend) {
2925 if ($permissiontoedit) {
2926 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2934 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2936 if ($permissiontoedit) {
2937 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2948 print
'<div class="center">';
2949 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2950 print
' ';
2951 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2957 if ($action !=
'edit' && $action !=
'presend') {
2958 print
'<div class="fichecenter"><div class="fichehalfleft">';
2963 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2964 $genallowed = $user->hasRight(
"user",
"user",
"read");
2965 $delallowed = $user->hasRight(
"user",
"user",
"write");
2967 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', !is_object($soc) || empty($soc->default_lang) ?
'' : $soc->default_lang);
2968 $somethingshown = $formfile->numoffiles;
2971 $linktoelem = $form->showLinkToObjectBlock(
$object, array(), array());
2972 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2976 $morehtmlcenter =
'<div class="nowraponall">';
2977 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
2978 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
2979 $morehtmlcenter .=
'</div>';
2981 print
'</div><div class="fichehalfright">';
2984 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2986 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
2988 print
'</div></div>';
2991 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
2998include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3000if (isModEnabled(
'api')) {
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
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 members of a foundation.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
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...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
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_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
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...
treeview li table
No Email.
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
div refaddress div address
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.