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 !=
'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$canadduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
119$canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
120$canedituser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
121$candisableuser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
122$canreadgroup = $canreaduser;
123$caneditgroup = $canedituser;
125 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
126 $caneditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
129if ($user->id != $id && !$canreaduser) {
133$caneditpasswordandsee =
false;
134$caneditpasswordandsend =
false;
139 $canedituser = (($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"));
140 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
141 $caneditpasswordandsee = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin));
142 $caneditpasswordandsend = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
150$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $caneditgroup);
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" && $candisableuser) {
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" && $candisableuser) {
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" && $candisableuser) {
218 if ($id != $user->id) {
219 if (!GETPOSTISSET(
'token')) {
220 print
'Error, token required for this critical operation';
226 if (
$object->admin && empty($user->admin)) {
229 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
233 $result =
$object->delete($user);
235 $langs->load(
"errors");
239 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
247 if ($action ==
'add' && $canadduser) {
261 if (!empty($conf->file->main_limit_users)) {
262 $nb =
$object->getNbOfUsers(
"active");
263 if ($nb >= $conf->file->main_limit_users) {
265 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
275 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
289 if (isModEnabled(
'socialnetworks')) {
290 $object->socialnetworks = array();
291 foreach ($socialnetworks as $key => $value) {
292 if (
GETPOST($key,
'alphanohtml')) {
298 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
301 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
316 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
317 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
321 $object->dateemployment = $dateemployment;
322 $object->dateemploymentend = $dateemploymentend;
323 $object->datestartvalidity = $datestartvalidity;
324 $object->dateendvalidity = $dateendvalidity;
332 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
339 if (isModEnabled(
'multicompany')) {
346 $object->entity = ($entity ==
'' ? 1 : $entity);
350 $object->entity = ($entity ==
'' ? 1 : $entity);
361 if (
GETPOST(
'password',
'none')) {
362 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'none'));
364 if (is_int($resPass) && $resPass < 0) {
365 $langs->load(
"errors");
370 if (isModEnabled(
"category")) {
372 $usercats =
GETPOST(
'usercats',
'array');
373 $object->setCategories($usercats);
377 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
381 $langs->load(
"errors");
390 if (($action ==
'addgroup' || $action ==
'removegroup') && $caneditgroup) {
393 $editgroup->fetch($group);
394 $editgroup->oldcopy = clone $editgroup;
398 if ($action ==
'addgroup') {
399 $result =
$object->SetInGroup($group, $editgroup->entity);
401 if ($action ==
'removegroup') {
402 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
413 if ($action ==
'update' && ($canedituser || $caneditpasswordandsee)) {
414 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
419 if (!
GETPOST(
"lastname",
'alpha')) {
424 if (!
GETPOST(
"login",
'alpha')) {
441 if (GETPOSTISSET(
"ref_employee")) {
445 if (GETPOSTISSET(
"national_registration_number")) {
446 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
449 if ($caneditpasswordandsee) {
452 if ($caneditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
455 if (!empty($user->admin) && $user->id != $id) {
460 if ($user->admin && !
$object->ldap_sid) {
472 if (isModEnabled(
'socialnetworks')) {
473 $object->socialnetworks = array();
474 foreach ($socialnetworks as $key => $value) {
475 if (
GETPOST($key,
'alphanohtml')) {
481 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
484 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
497 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
499 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
503 $object->dateemployment = $dateemployment;
504 $object->dateemploymentend = $dateemploymentend;
505 $object->datestartvalidity = $datestartvalidity;
506 $object->dateendvalidity = $dateendvalidity;
509 if (isModEnabled(
'stock')) {
516 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
530 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
538 if (!empty($_FILES[
'photo'][
'name'])) {
544 $langs->load(
"errors");
546 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
551 $passwordismodified = 0;
554 $passwordismodified = 1;
561 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
562 $langs->load(
"errors");
563 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
571 if (!$error && GETPOSTISSET(
'contactid')) {
575 if ($contactid > 0) {
577 $contact->fetch($contactid);
579 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
580 $sql .=
" SET fk_socpeople=".((int) $contactid);
581 if (!empty($contact->socid)) {
582 $sql .=
", fk_soc=".((int) $contact->socid);
583 } elseif ($socid > 0) {
584 $sql .=
", fk_soc = null";
585 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
587 $sql .=
" WHERE rowid = ".((int)
$object->id);
588 } elseif ($socid > 0) {
589 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
590 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
591 $sql .=
" WHERE rowid = ".((int)
$object->id);
593 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
594 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
595 $sql .=
" WHERE rowid = ".((int)
$object->id);
598 $resql = $db->query($sql);
605 if (!$error && !count(
$object->errors)) {
607 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/'.
$object->oldcopy->photo;
610 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/thumbs';
614 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
615 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1,
$object,
'user').
'/photos';
621 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
623 if (!($result > 0)) {
631 $langs->load(
"errors");
632 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
637 if (!$error && !count(
$object->errors)) {
639 $categories =
GETPOST(
'usercats',
'array');
640 $object->setCategories($categories);
643 if (!$error && !count(
$object->errors)) {
647 $login = $_SESSION[
"dol_login"];
650 $langs->load(
"errors");
651 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
653 if ($passwordismodified &&
$object->login == $user->login) {
655 $langs->load(
"errors");
656 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
657 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
665 if ($caneditpasswordandsee) {
666 dol_syslog(
"Not allowed to change fields, only password");
670 if (
GETPOST(
"password",
"none")) {
674 if (is_int($ret) && $ret < 0) {
683 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $caneditpasswordandsee)
684 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $caneditpasswordandsend))
688 $newpassword =
$object->setPassword($user,
'');
689 if (is_int($newpassword) && $newpassword < 0) {
691 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
694 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
695 if (
$object->send_password($user, $newpassword) > 0) {
701 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
707 if ($action ==
'adduserldap' && $canadduser) {
708 $selecteduser =
GETPOST(
'users');
710 $required_fields = array(
726 if (isModEnabled(
'socialnetworks')) {
727 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
728 foreach ($arrayofsocialnetworks as $socialnetwork) {
734 $result = $ldap->connectBind();
737 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
742 if (is_array($ldapusers)) {
743 foreach ($ldapusers as $key => $attribute) {
755 $ldap_social = array();
757 if (isModEnabled(
'socialnetworks')) {
758 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
759 foreach ($arrayofsocialnetworks as $socialnetwork) {
760 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
771 $triggersendname =
'USER_SENTBYMAIL';
773 $mode =
'emailfromuser';
774 $trackid =
'use'.$id;
775 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
778 $upload_dir = $conf->user->dir_output;
779 $permissiontoadd = $user->hasRight(
"user",
"user",
"write");
780 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
788$form =
new Form($db);
793if (isModEnabled(
'stock')) {
799$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
800$resql = $db->query($sql);
802 $obj = $db->fetch_object($resql);
804 $nbofusers = $obj->nb;
812 $title = $person_name.
" - ".$langs->trans(
'Card');
814 if (
GETPOST(
'employee',
'alphanohtml')) {
815 $title = $langs->trans(
"NewEmployee");
817 $title = $langs->trans(
"NewUser");
822llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
825if ($action ==
'create' || $action ==
'adduserldap') {
828 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
832 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
837 $result = $ldap->connectBind();
839 $required_fields = array(
859 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
864 if (is_array($ldapusers)) {
865 foreach ($ldapusers as $key => $ldapuser) {
868 foreach ($required_fields as $value) {
870 $label .= $value.
"=******* ";
872 $label .= $value.
"=".$ldapuser[$value].
" ";
875 $liste[$key] = $label;
885 print
"\n\n<!-- Form liste LDAP debut -->\n";
887 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
888 print
'<input type="hidden" name="token" value="'.newToken().
'">';
889 print
'<table class="border centpercent"><tr>';
890 print
'<td width="160">';
891 print $langs->trans(
"LDAPUsers");
894 print
'<input type="hidden" name="action" value="adduserldap">';
895 if (is_array($liste) && count($liste)) {
896 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
899 print
'</td><td class="center">';
900 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
901 print
'</td></tr></table>';
904 print
"\n<!-- Form liste LDAP fin -->\n\n";
909 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
910 print
'<input type="hidden" name="token" value="'.newToken().
'">';
911 print
'<input type="hidden" name="action" value="add">';
912 if (!empty($ldap_sid)) {
913 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
915 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
921 print
'<table class="border centpercent">';
924 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
925 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
930 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
932 if (!empty($ldap_lastname)) {
933 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
934 print $ldap_lastname;
936 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
941 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
943 if (!empty($ldap_firstname)) {
944 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
945 print $ldap_firstname;
947 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
952 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
954 if (!empty($ldap_login)) {
955 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
957 } elseif (!empty($ldap_loginsmb)) {
958 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
959 print $ldap_loginsmb;
961 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
965 if (!empty($conf->use_javascript_ajax)) {
969 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
970 if ($charforseparator ==
'none') {
971 $charforseparator =
'';
974 jQuery(document).ready(function() {
975 $(".createloginauto").on("keyup", function() {
976 console.log(".createloginauto change: We generate login when we have a lastname");
978 lastname = $("#lastname").val().toLowerCase();
981 print
' firstname = $("#firstname").val().toLowerCase()[0];';
983 print
' firstname = $("#firstname").val().toLowerCase();';
989 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
993 $(
"#login").val(login);
999 $generated_password = '';
1000 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1001 $generated_password = getRandomPassword(false);
1003 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1006 if (!empty($user->admin)) {
1007 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1009 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1011 if (isModEnabled('multicompany
') && !$user->entity) {
1012 if (!empty($conf->use_javascript_ajax)) {
1013 print '<script
type=
"text/javascript">
1015 $(
"select[name=admin]").change(
function() {
1016 if ( $(
this).val() == 0 ) {
1017 $(
"input[name=superadmin]")
1018 .prop(
"disabled",
true)
1019 .prop(
"checked",
false);
1020 $(
"select[name=entity]")
1021 .prop(
"disabled",
false);
1023 $(
"input[name=superadmin]")
1024 .prop(
"disabled",
false);
1027 $(
"input[name=superadmin]").change(
function() {
1028 if ( $(
this).is(
":checked") ) {
1029 $(
"select[name=entity]")
1030 .prop(
"disabled",
true);
1032 $(
"select[name=entity]")
1033 .prop(
"disabled",
false);
1039 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1040 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1041 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1043 print "</td></tr>\n";
1047 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1049 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1050 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1054 $defaultemployee = '1
';
1056 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1057 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1058 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1062 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1064 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
');
1068 // Expense report validator
1069 if (isModEnabled('expensereport
')) {
1070 print '<tr><td
class=
"titlefieldcreate">
';
1071 $text = $langs->trans("ForceUserExpenseValidator");
1072 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1075 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
');
1080 // Holiday request validator
1081 if (isModEnabled('holiday
')) {
1082 print '<tr><td
class=
"titlefieldcreate">
';
1083 $text = $langs->trans("ForceUserHolidayValidator");
1084 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1087 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
');
1093 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1095 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1099 print '</
table><hr><
table class=
"border centpercent">
';
1103 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1105 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1109 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1114 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1117 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1118 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1120 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1121 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1123 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1124 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1125 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1126 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1129 $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">';
1130 if (!empty($conf->use_javascript_ajax)) {
1131 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1137 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
1138 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1140 $valuetoshow = $hookmanager->resPrint;
1142 $valuetoshow .= $hookmanager->resPrint;
1148 if (isModEnabled(
'api')) {
1151 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1153 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">';
1154 if (!empty($conf->use_javascript_ajax)) {
1155 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1161 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1165 print
'</table><hr><table class="border centpercent">';
1169 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1170 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1172 print
'</textarea></td></tr>';
1175 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1176 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1180 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1181 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1185 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1186 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1187 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1189 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1195 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1196 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1197 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1202 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1204 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1205 if (!empty($ldap_phone)) {
1206 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1209 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1214 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1216 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1217 if (!empty($ldap_mobile)) {
1218 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1221 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1226 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1228 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1229 if (!empty($ldap_fax)) {
1230 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1233 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1238 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1240 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1241 if (!empty($ldap_mail)) {
1242 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1245 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1250 if (isModEnabled(
'socialnetworks')) {
1251 foreach ($socialnetworks as $key => $value) {
1252 if ($value[
'active']) {
1253 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1255 if (!empty($value[
'icon'])) {
1256 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1258 if (!empty($ldap_social[$key])) {
1259 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1260 print $ldap_social[$key];
1262 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1267 if (!empty($ldap_social[$key])) {
1268 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1270 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1277 if (isModEnabled(
'accounting')) {
1278 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1280 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1285 if (isModEnabled(
'agenda')) {
1286 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1288 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1,
'',
'hideifnotset');
1293 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1294 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1295 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1296 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1302 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1303 print
'<td class="maxwidthonsmartphone">'.
"\n";
1304 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
GETPOST(
'default_lang',
'alpha') ?
GETPOST(
'default_lang',
'alpha') : (
$object->lang ?
$object->lang :
''),
'default_lang', 0, 0, 1, 0, 0,
'maxwidth300 widthcentpercentminusx');
1310 if (isModEnabled(
'multicompany') && is_object($mc)) {
1312 if (!method_exists($mc,
'formObjectOptions')) {
1313 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1314 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1315 print
"<td>".$mc->select_entities($conf->entity);
1316 print
"</td></tr>\n";
1318 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1324 $parameters = array();
1325 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1328 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1329 print
'<td class="wordbreak">';
1330 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1332 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1333 print $doleditor->Create(1);
1337 print
'<tr><td class="tdtop">';
1338 print $langs->trans(
"NotePublic");
1340 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1341 $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%');
1342 $doleditor->Create();
1343 print
"</td></tr>\n";
1346 print
'<tr><td class="tdtop">';
1347 print $langs->trans(
"NotePrivate");
1349 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1350 $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%');
1351 $doleditor->Create();
1352 print
"</td></tr>\n";
1354 print
'</table><hr><table class="border centpercent">';
1361 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1362 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1367 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1369 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1372 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1373 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1374 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1375 $langs->load(
"salaries");
1379 $text = $langs->trans(
"THM");
1380 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1383 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1389 $text = $langs->trans(
"TJM");
1390 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1393 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1398 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1400 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1406 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1408 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1413 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1415 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1419 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1424 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1426 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1434 print $form->buttonsSaveCancel(
"CreateUser");
1440 $res =
$object->fetch($id,
'',
'', 1);
1445 $res =
$object->fetch_optionals();
1457 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1459 $result = $ldap->connectBind();
1461 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1462 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1467 $passDoNotExpire = 0;
1468 $userChangePassNextLogon = 0;
1473 if (count($ldap->uacf) > 0) {
1474 foreach ($ldap->uacf as $key => $statut) {
1475 if ($key == 65536) {
1476 $passDoNotExpire = 1;
1477 $statutUACF = $statut;
1482 $statutUACF =
"ACCOUNTDISABLE";
1485 if ($ldap->pwdlastset == 0) {
1486 $userChangePassNextLogon = 1;
1492 if ($mode ==
'employee') {
1493 $title = $langs->trans(
"Employee");
1494 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1496 $title = $langs->trans(
"User");
1499 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1500 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1509 if ($action ==
'password') {
1510 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1516 if ($action ==
'passwordsend') {
1517 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1523 if ($action ==
'disable') {
1524 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1530 if ($action ==
'enable') {
1531 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1537 if ($action ==
'delete') {
1538 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1544 if ($action !=
'edit') {
1547 $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">';
1548 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1549 $morehtmlref .=
'</a>';
1551 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1552 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
1554 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1556 print
'<div class="fichecenter">';
1557 print
'<div class="fichehalfleft">';
1559 print
'<div class="underbanner clearboth"></div>';
1560 print
'<table class="border tableforfield centpercent">';
1563 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1565 print
'<td class="error">';
1566 print $langs->trans(
"LoginAccountDisableInDolibarr");
1571 if (property_exists(
$object,
'admin')) {
1572 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1573 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1574 } elseif (!empty(
$object->admin)) {
1575 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1585 $text = $langs->trans(
"Type");
1586 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1588 $type = $langs->trans(
"Internal");
1590 $type = $langs->trans(
"External");
1592 print
'<span class="badgeneutral">';
1595 print
' ('.$langs->trans(
"DomainUser").
')';
1598 print
'</td></tr>'.
"\n";
1602 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1603 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1604 print
'</td></tr>'.
"\n";
1608 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1610 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1614 print
'</td></tr>'.
"\n";
1617 if ($nbofusers > 1) {
1619 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1621 if (empty(
$object->fk_user)) {
1622 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1624 $huser =
new User($db);
1626 $huser->fetch(
$object->fk_user);
1627 print $huser->getNomUrl(-1);
1629 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1636 if (isModEnabled(
'expensereport')) {
1638 $text = $langs->trans(
"ForceUserExpenseValidator");
1639 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1642 if (!empty(
$object->fk_user_expense_validator)) {
1643 $evuser =
new User($db);
1644 $evuser->fetch(
$object->fk_user_expense_validator);
1645 print $evuser->getNomUrl(-1);
1652 if (isModEnabled(
'holiday')) {
1654 $text = $langs->trans(
"ForceUserHolidayValidator");
1655 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1658 if (!empty(
$object->fk_user_holiday_validator)) {
1659 $hvuser =
new User($db);
1660 $hvuser->fetch(
$object->fk_user_holiday_validator);
1661 print $hvuser->getNomUrl(-1);
1669 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1670 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1674 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1681 if ((empty($user->socid) && in_array($id, $childids))
1682 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1683 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1684 $langs->load(
"salaries");
1687 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1689 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1695 $text = $langs->trans(
"THM");
1696 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1699 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1705 $text = $langs->trans(
"TJM");
1706 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1709 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1715 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1717 if (
$object->dateemployment) {
1718 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1721 if (
$object->dateemploymentend) {
1722 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1729 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1737 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1738 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1739 if (
$object->fk_warehouse > 0) {
1740 $warehousestatic =
new Entrepot($db);
1741 $warehousestatic->fetch(
$object->fk_warehouse);
1742 print $warehousestatic->getNomUrl(1);
1750 print
'<div class="fichehalfright">';
1752 print
'<div class="underbanner clearboth"></div>';
1754 print
'<table class="border tableforfield centpercent">';
1757 if (isModEnabled(
'agenda')) {
1758 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1760 print $formother->showColor(
$object->color,
'');
1766 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1767 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1769 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1775 $langs->load(
"languages");
1776 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1778 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1782 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1788 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1789 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1790 print
'<td>'.$object->openid.
'</td>';
1795 if (isModEnabled(
'multicompany') && is_object($mc)) {
1797 if (!method_exists($mc,
'formObjectOptions')) {
1798 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1799 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1801 print $langs->trans(
"AllEntities");
1803 $mc->getInfo(
$object->entity);
1806 print
"</td></tr>\n";
1812 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1815 if (isModEnabled(
"societe")) {
1816 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1821 $societe->fetch(
$object->socid);
1822 if ($societe->id > 0) {
1823 $s .= $societe->getNomUrl(1,
'');
1826 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1828 if (!empty(
$object->contact_id)) {
1830 $contact->fetch(
$object->contact_id);
1831 if ($contact->id > 0) {
1832 if (
$object->socid > 0 && $s) {
1837 $s .= $contact->getNomUrl(1,
'');
1846 if (isModEnabled(
'member')) {
1847 $langs->load(
"members");
1848 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1852 $adh->fetch(
$object->fk_member);
1853 $adh->ref = $adh->getFullname($langs);
1854 print $adh->getNomUrl(-1);
1856 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1863 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1865 print
"</td></tr>\n";
1873 print
'<div class="div-table-responsive-no-min">';
1874 print
'<table class="noborder tableforfield centpercent">';
1876 print
'<tr class="liste_titre"><th class="liste_titre">';
1877 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1879 print
'<th class="liste_titre"></th>';
1883 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1885 if (
$object->datestartvalidity) {
1886 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1889 if (
$object->dateendvalidity) {
1890 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1897 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1898 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
1907 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1908 if (!empty(
$object->ldap_sid)) {
1909 if ($passDoNotExpire) {
1910 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1911 } elseif ($userChangePassNextLogon) {
1912 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1913 } elseif ($userDisabled) {
1914 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1916 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1919 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1922 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1923 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1944 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
1945 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1947 $valuetoshow = $hookmanager->resPrint;
1949 $valuetoshow .= $hookmanager->resPrint;
1953 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
1954 print
'<td class="wordbreak">';
1961 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1962 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1964 if (!empty(
$object->api_key)) {
1965 print
'<span class="opacitymedium">';
1972 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1974 if (
$object->datepreviouslogin) {
1975 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1978 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1989 print
'<div class="clearboth"></div>';
1998 print
'<div class="tabsAction">';
2000 $parameters = array();
2001 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2002 if (empty($reshook)) {
2006 'class' =>
'classfortooltip'
2010 if (empty($user->socid)) {
2011 $canSendMail =
false;
2013 $langs->load(
"mails");
2014 $canSendMail =
true;
2015 unset($params[
'attr'][
'title']);
2017 $langs->load(
"mails");
2018 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2020 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2023 if ($caneditfield && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2025 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2026 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2028 unset($params[
'attr'][
'title']);
2029 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
2031 } elseif ($caneditpasswordandsee && !
$object->ldap_sid &&
2032 (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2033 unset($params[
'attr'][
'title']);
2034 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2041 'class' =>
'classfortooltip'
2045 if (
$object->status == $object::STATUS_DISABLED) {
2046 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2047 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2048 } elseif (($user->id != $id && $caneditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2049 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2050 unset($params[
'attr'][
'title']);
2051 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2054 if (
$object->status == $object::STATUS_DISABLED) {
2055 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2056 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2057 } elseif (($user->id != $id && $caneditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2058 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2060 unset($params[
'attr'][
'title']);
2061 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2063 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2064 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2069 if ($user->id != $id && $candisableuser &&
$object->statut == 0 &&
2070 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2071 unset($params[
'attr'][
'title']);
2072 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2075 if ($user->id != $id && $candisableuser &&
$object->statut == 1 &&
2076 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2077 unset($params[
'attr'][
'title']);
2078 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2080 if ($user->id == $id) {
2081 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2082 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2086 if ($user->id != $id && $candisableuser &&
2087 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2088 if ($user->admin || !
$object->admin) {
2089 unset($params[
'attr'][
'title']);
2090 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2092 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2093 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2103 if (
GETPOST(
'modelselected')) {
2104 $action =
'presend';
2108 $modelmail =
'user';
2109 $defaulttopic =
'Information';
2110 $diroutput = $conf->user->dir_output;
2111 $trackid =
'use'.$object->id;
2113 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2115 if ($action !=
'presend' && $action !=
'send') {
2120 if ($canreadgroup) {
2121 print
'<!-- Group section -->'.
"\n";
2129 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2131 if (!empty($groupslist)) {
2132 foreach ($groupslist as $groupforuser) {
2133 $exclude[] = $groupforuser->id;
2138 $parameters = array(
'caneditgroup' => $caneditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2139 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2140 print $hookmanager->resPrint;
2142 if (empty($reshook)) {
2143 if ($caneditgroup) {
2144 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">'.
"\n";
2145 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2146 print
'<input type="hidden" name="action" value="addgroup" />';
2147 print
'<input type="hidden" name="page_y" value="" />';
2150 print
'<!-- List of groups of the user -->'.
"\n";
2151 print
'<table class="noborder centpercent">'.
"\n";
2152 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2153 print
'<th class="liste_titre right">';
2154 if ($caneditgroup) {
2155 print $form->select_dolgroups(
'',
'group', 1, $exclude, 0,
'',
'',
$object->entity,
false,
'maxwidth150');
2157 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2158 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2160 print
'</th></tr>'.
"\n";
2163 if (!empty($groupslist)) {
2164 foreach ($groupslist as $group) {
2165 print
'<tr class="oddeven">';
2166 print
'<td class="tdoverflowmax150">';
2167 if ($caneditgroup) {
2168 print $group->getNomUrl(1);
2170 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2173 print
'<td class="right">';
2174 if ($caneditgroup) {
2175 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2176 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2181 print
"</td></tr>\n";
2184 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2189 if ($caneditgroup) {
2201 if ($action ==
'edit' && ($canedituser || $caneditpasswordandsee)) {
2202 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2203 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2204 print
'<input type="hidden" name="action" value="update">';
2205 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2209 print
'<table class="border centpercent">';
2213 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2221 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2222 if ($caneditfield && !
$object->ldap_sid) {
2223 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2224 } elseif (
$object->civility_code) {
2225 print $langs->trans(
"Civility".
$object->civility_code);
2231 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2233 if ($caneditfield && !
$object->ldap_sid) {
2234 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2236 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2243 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2245 if ($caneditfield && !
$object->ldap_sid) {
2246 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2248 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2254 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2256 if ($user->admin && !
$object->ldap_sid) {
2257 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2259 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2266 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2268 $langs->load(
"admin");
2270 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2271 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2275 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2276 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2282 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2283 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2286 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2288 if (isModEnabled(
'multicompany') && !$user->entity) {
2289 if ($conf->use_javascript_ajax) {
2290 print
'<script type="text/javascript">
2292 var admin = $("select[name=admin]").val();
2294 $("input[name=superadmin]")
2295 .prop("disabled", true)
2296 .prop("checked", false);
2298 if ($("input[name=superadmin]").is(":checked")) {
2299 $("select[name=entity]")
2300 .prop("disabled", true);
2302 $("select[name=admin]").change(function() {
2303 if ( $(this).val() == 0 ) {
2304 $("input[name=superadmin]")
2305 .prop("disabled", true)
2306 .prop("checked", false);
2307 $("select[name=entity]")
2308 .prop("disabled", false);
2310 $("input[name=superadmin]")
2311 .prop("disabled", false);
2314 $("input[name=superadmin]").change(function() {
2315 if ( $(this).is(":checked")) {
2316 $("select[name=entity]")
2317 .prop("disabled", true);
2319 $("select[name=entity]")
2320 .prop("disabled", false);
2327 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2328 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2332 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2333 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2334 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2335 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2344 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2346 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2347 if ($caneditfield) {
2348 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2350 print $arraygender[
$object->gender];
2356 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2357 if ($caneditfield) {
2358 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2361 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2370 if ($nbofusers > 1) {
2372 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2374 if ($caneditfield) {
2375 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');
2377 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2378 $huser =
new User($db);
2379 $huser->fetch(
$object->fk_user);
2380 print $huser->getNomUrl(-1);
2386 if (isModEnabled(
'expensereport')) {
2387 print
'<tr><td class="titlefieldcreate">';
2388 $text = $langs->trans(
"ForceUserExpenseValidator");
2389 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2392 if ($caneditfield) {
2393 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');
2395 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2396 $evuser =
new User($db);
2397 $evuser->fetch(
$object->fk_user_expense_validator);
2398 print $evuser->getNomUrl(-1);
2405 if (isModEnabled(
'holiday')) {
2406 print
'<tr><td class="titlefieldcreate">';
2407 $text = $langs->trans(
"ForceUserHolidayValidator");
2408 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2411 if ($caneditfield) {
2412 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');
2414 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2415 $hvuser =
new User($db);
2416 $hvuser->fetch(
$object->fk_user_holiday_validator);
2417 print $hvuser->getNomUrl(-1);
2425 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2427 if ($user->id ==
$object->id || !$user->admin) {
2429 $type = $langs->trans(
"Internal");
2431 $type = $langs->trans(
"External");
2434 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2436 print
' ('.$langs->trans(
"DomainUser").
')';
2445 $eventsCompanyContact = array();
2446 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2449 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2451 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2453 print
' ('.$langs->trans(
"DomainUser").
')';
2457 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2459 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2461 print
' ('.$langs->trans(
"DomainUser").
')';
2465 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2467 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2469 print
' ('.$langs->trans(
"DomainUser").
')';
2473 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2475 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2484 print
'<table class="border centpercent">';
2487 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2489 if ($caneditfield) {
2490 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2496 if ($caneditfield) {
2497 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2505 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2508 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2509 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2511 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2512 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2514 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2515 if ($caneditpasswordandsee) {
2516 $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">';
2517 if (!empty($conf->use_javascript_ajax)) {
2518 $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').
'"');
2521 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2525 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
2526 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2528 $valuetoshow = $hookmanager->resPrint;
2530 $valuetoshow .= $hookmanager->resPrint;
2534 print
"</td></tr>\n";
2537 if (isModEnabled(
'api')) {
2538 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2540 if ($caneditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2541 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2542 if (!empty($conf->use_javascript_ajax)) {
2543 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2550 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2551 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2553 if ($caneditfield) {
2554 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2556 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2562 print
'</table><hr><table class="border centpercent">';
2566 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2568 if ($caneditfield) {
2569 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2572 if ($caneditfield) {
2573 print
'</textarea>';
2578 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2579 if ($caneditfield) {
2580 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2587 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2588 if ($caneditfield) {
2589 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2596 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2597 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2598 if ($caneditfield) {
2599 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2601 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2605 print $countrylabel;
2611 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2612 if ($caneditfield) {
2613 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2614 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2622 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2624 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2625 if ($caneditfield && empty(
$object->ldap_sid)) {
2626 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2628 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2634 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2636 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2637 if ($caneditfield && empty(
$object->ldap_sid)) {
2638 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2640 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2646 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2648 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2649 if ($caneditfield && empty(
$object->ldap_sid)) {
2650 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2652 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2658 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2660 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2661 if ($caneditfield && empty(
$object->ldap_sid)) {
2662 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2664 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2669 if (isModEnabled(
'socialnetworks')) {
2670 foreach ($socialnetworks as $key => $value) {
2671 if ($value[
'active']) {
2672 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2674 if (!empty($value[
'icon'])) {
2675 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2677 if ($caneditfield && empty(
$object->ldap_sid)) {
2678 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2680 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2681 print
$object->socialnetworks[$key];
2686 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2691 print
'</table><hr><table class="border centpercent">';
2695 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2696 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2697 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>';
2702 if (isModEnabled(
'accounting')) {
2704 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2706 if ($caneditfield) {
2707 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2709 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2710 print
$object->accountancy_code;
2717 if (isModEnabled(
'agenda')) {
2718 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2720 if ($caneditfield) {
2721 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1,
'',
'hideifnotset');
2723 print $formother->showColor(
$object->color,
'');
2730 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2732 print $form->showphoto(
'userphoto',
$object, 60, 0, $caneditfield,
'photowithmargin',
'small', 1, 0,
'user', 1);
2737 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2738 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2740 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2741 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
null,
null,
null,
null, 1);
2743 $cats = $c->containing(
$object->id, Categorie::TYPE_USER);
2744 $arrayselected = array();
2745 foreach ($cats as $cat) {
2746 $arrayselected[] = $cat->id;
2748 if ($caneditfield) {
2749 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
2751 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2758 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";
2759 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0,
null,
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2765 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2767 print
$object->getLibStatut(4);
2794 if (isModEnabled(
'member')) {
2795 $langs->load(
"members");
2796 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2800 $adh->fetch(
$object->fk_member);
2801 $adh->ref = $adh->login;
2802 print $adh->getNomUrl(1);
2804 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2812 if (isModEnabled(
'multicompany') && is_object($mc)) {
2814 if (!method_exists($mc,
'formObjectOptions')) {
2815 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2816 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2817 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2818 print
"</td></tr>\n";
2820 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2826 $parameters = array(
'colspan' =>
' colspan="2"');
2828 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2829 print $hookmanager->resPrint;
2830 if (empty($reshook)) {
2831 if ($caneditfield) {
2832 print
$object->showOptionals($extrafields,
'edit');
2834 print
$object->showOptionals($extrafields,
'view');
2839 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2841 if ($caneditfield) {
2842 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2844 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2845 print $doleditor->Create(1);
2857 print
'<table class="border centpercent">';
2863 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2865 if ($caneditfield) {
2866 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2868 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2874 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2876 if ($caneditfield) {
2877 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2885 if ((empty($user->socid) && in_array($id, $childids))
2886 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
2887 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2888 $langs->load(
"salaries");
2891 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2893 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
2899 $text = $langs->trans(
"THM");
2900 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2903 if ($caneditfield) {
2904 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
2906 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2913 $text = $langs->trans(
"TJM");
2914 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2917 if ($caneditfield) {
2918 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
2920 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2927 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2929 if ($caneditfield) {
2930 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2935 if ($dateemployment && $dateemploymentend) {
2939 if ($caneditfield) {
2940 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2948 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2950 if ($caneditfield) {
2951 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2962 print
'<div class="center">';
2963 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2964 print
' ';
2965 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2971 if ($action !=
'edit' && $action !=
'presend') {
2972 print
'<div class="fichecenter"><div class="fichehalfleft">';
2977 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2978 $genallowed = $user->hasRight(
"user",
"user",
"read");
2979 $delallowed = $user->hasRight(
"user",
"user",
"write");
2981 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', empty($soc->default_lang) ?
'' : $soc->default_lang);
2982 $somethingshown = $formfile->numoffiles;
2985 $linktoelem = $form->showLinkToObjectBlock(
$object,
null,
null);
2986 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2990 $morehtmlcenter =
'<div class="nowraponall">';
2991 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
2992 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
2993 $morehtmlcenter .=
'</div>';
2995 print
'</div><div class="fichehalfright">';
2998 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3000 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3002 print
'</div></div>';
3005 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3012include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3014if (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()
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)
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.
currentToken()
Return the value of token currently saved into session with name 'token'.
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.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
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 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.
$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.