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';
76$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
79$action =
GETPOST(
'action',
'aZ09');
80$mode =
GETPOST(
'mode',
'alpha');
81$confirm =
GETPOST(
'confirm',
'alpha');
83$cancel =
GETPOST(
'cancel',
'alpha');
84$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
86if (empty($id) && $action !=
'add' && $action !=
'create') {
96$childids = $user->getAllChildIds(1);
102$extrafields->fetch_name_optionals_label(
$object->table_element);
107$hookmanager->initHooks(array(
'usercard',
'globalcard'));
114 $res =
$object->fetch($id,
'',
'', 1);
119if ($user->socid > 0) {
120 $socid = $user->socid;
126$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
127$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
128$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
129$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
130$permissiontoreadgroup = $permissiontoread;
131$permissiontoeditgroup = $permissiontoedit;
133 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
134 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
137$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
138$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
139$permissiontocloneuser = $permissiontoadd;
142 $permissiontoclonesuperadmin =
false;
143 $permissiontocloneadmin =
false;
144 $permissiontocloneuser =
false;
147if ($user->id != $id && !$permissiontoread) {
152$permissiontoeditpasswordandsee =
false;
153$permissiontoeditpasswordandsend =
false;
156 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
157 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin));
158 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
161$passwordismodified =
false;
169$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
170$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
175if (empty($reshook)) {
176 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
178 if (empty($backtopage) || ($cancel && empty($id))) {
179 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
180 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
181 $backtopage = $backurlforlist;
183 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
189 if (!empty($backtopageforcancel)) {
190 header(
"Location: ".$backtopageforcancel);
192 } elseif (!empty($backtopage)) {
193 header(
"Location: ".$backtopage);
199 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
200 if ($id != $user->id) {
202 if (
$object->admin && empty($user->admin)) {
205 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
208 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
214 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
217 if ($id != $user->id) {
220 if (!empty(
$conf->file->main_limit_users)) {
221 $nb =
$object->getNbOfUsers(
"active");
222 if ($nb >=
$conf->file->main_limit_users) {
224 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
230 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
236 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
237 if ($id != $user->id) {
238 if (!GETPOSTISSET(
'token')) {
239 print
'Error, token required for this critical operation';
247 $result =
$object->delete($user);
249 $langs->load(
"errors");
253 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
260 if ($action ==
'add' && $permissiontoadd) {
274 if (!empty(
$conf->file->main_limit_users)) {
275 $nb =
$object->getNbOfUsers(
"active");
276 if ($nb >=
$conf->file->main_limit_users) {
278 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
288 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
302 if (isModEnabled(
'socialnetworks')) {
303 $object->socialnetworks = array();
304 foreach ($socialnetworks as $key => $value) {
305 if (
GETPOST($key,
'alphanohtml')) {
311 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
314 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
329 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
330 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
334 $object->dateemployment = $dateemployment;
335 $object->dateemploymentend = $dateemploymentend;
336 $object->datestartvalidity = $datestartvalidity;
337 $object->dateendvalidity = $dateendvalidity;
345 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
352 if (isModEnabled(
'multicompany')) {
359 $object->entity = ($entity ==
'' ? 1 : $entity);
363 $object->entity = ($entity ==
'' ? 1 : $entity);
374 if (
GETPOST(
'password',
'password')) {
375 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
377 if (is_int($resPass) && $resPass < 0) {
378 $langs->load(
"errors");
383 if (isModEnabled(
"category")) {
385 $usercats =
GETPOST(
'usercats',
'array');
386 $object->setCategories($usercats);
390 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
394 $langs->load(
"errors");
403 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
406 $editgroup->fetch($group);
407 $editgroup->oldcopy = clone $editgroup;
411 if ($action ==
'addgroup') {
412 $result =
$object->SetInGroup($group, $editgroup->entity);
414 if ($action ==
'removegroup') {
415 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
426 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
427 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
429 if ($permissiontoedit) {
432 if (!
GETPOST(
"lastname",
'alpha')) {
437 if (!
GETPOST(
"login",
'alpha')) {
454 if (GETPOSTISSET(
"ref_employee")) {
458 if (GETPOSTISSET(
"national_registration_number")) {
459 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
462 if ($permissiontoeditpasswordandsee) {
465 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
468 if (!empty($user->admin) && $user->id !=
$id) {
473 if ($user->admin && !
$object->ldap_sid) {
485 if (isModEnabled(
'socialnetworks')) {
486 $object->socialnetworks = array();
487 foreach ($socialnetworks as $key => $value) {
488 if (
GETPOST($key,
'alphanohtml')) {
494 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
497 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
510 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
512 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
516 $object->dateemployment = $dateemployment;
517 $object->dateemploymentend = $dateemploymentend;
518 $object->datestartvalidity = $datestartvalidity;
519 $object->dateendvalidity = $dateendvalidity;
522 if (isModEnabled(
'stock')) {
529 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
543 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
551 if (!empty($_FILES[
'photo'][
'name'])) {
557 $langs->load(
"errors");
559 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
564 $passwordismodified = 0;
567 $passwordismodified = 1;
574 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
575 $langs->load(
"errors");
576 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
584 if (!$error && GETPOSTISSET(
'contactid')) {
588 if ($contactid > 0) {
590 $contact->fetch($contactid);
592 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
593 $sql .=
" SET fk_socpeople=".((int) $contactid);
594 if (!empty($contact->socid)) {
595 $sql .=
", fk_soc=".((int) $contact->socid);
596 } elseif ($socid > 0) {
597 $sql .=
", fk_soc = null";
598 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
600 $sql .=
" WHERE rowid = ".((int)
$object->id);
601 } elseif ($socid > 0) {
602 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
603 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
604 $sql .=
" WHERE rowid = ".((int)
$object->id);
606 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
607 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
608 $sql .=
" WHERE rowid = ".((int)
$object->id);
611 $resql = $db->query($sql);
618 if (!$error && !count(
$object->errors)) {
627 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
635 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
637 if (!($result > 0)) {
645 $langs->load(
"errors");
646 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
651 if (!$error && !count(
$object->errors)) {
653 $categories =
GETPOST(
'usercats',
'array');
654 $object->setCategories($categories);
657 if (!$error && !count(
$object->errors)) {
661 $login = $_SESSION[
"dol_login"];
664 $langs->load(
"errors");
665 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
667 if ($passwordismodified &&
$object->login == $user->login) {
669 $langs->load(
"errors");
670 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
671 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
679 if ($permissiontoeditpasswordandsee) {
680 dol_syslog(
"Not allowed to change fields, only password");
684 if (
GETPOST(
"password",
"password")) {
687 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
688 if (is_int($ret) && $ret < 0) {
697 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
698 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
702 $newpassword =
$object->setPassword($user,
'');
703 if (is_int($newpassword) && $newpassword < 0) {
705 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
708 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
709 if (
$object->send_password($user, $newpassword) > 0) {
715 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
721 if ($action ==
'adduserldap' && $permissiontoadd) {
722 $selecteduser =
GETPOST(
'users');
724 $required_fields = array(
740 if (isModEnabled(
'socialnetworks')) {
741 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
742 foreach ($arrayofsocialnetworks as $socialnetwork) {
748 $result = $ldap->connectBind();
751 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
756 if (is_array($ldapusers)) {
757 foreach ($ldapusers as $key => $attribute) {
769 $ldap_social = array();
771 if (isModEnabled(
'socialnetworks')) {
772 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
773 foreach ($arrayofsocialnetworks as $socialnetwork) {
774 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
784 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
787 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
791 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
799 $clone->api_key =
'';
801 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
802 $clone->firstname = $parts[0];
803 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
805 $clone->login = substr($parts[0], 0, 1).$parts[1];
808 $clone->context[
'createfromclone'] =
'createfromclone';
809 $id = $clone->create($user);
810 $refalreadyexists = 0;
813 $result = $clone->cloneRights(
$object->id, $id);
816 if (
GETPOST(
'clone_categories')) {
817 $result = $clone->cloneCategories(
$object->id, $id);
825 if ($clone->error ==
'ErrorProductAlreadyExists') {
829 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
830 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
833 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
837 unset($clone->context[
'createfromclone']);
844 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
855 $triggersendname =
'USER_SENTBYMAIL';
857 $mode =
'emailfromuser';
858 $trackid =
'use'.$id;
859 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
862 $upload_dir =
$conf->user->dir_output;
863 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
871$form =
new Form($db);
876if (isModEnabled(
'stock')) {
882$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
883$resql = $db->query($sql);
885 $obj = $db->fetch_object($resql);
887 $nbofusers = $obj->nb;
895 $title = $person_name.
" - ".$langs->trans(
'Card');
898 $title = $langs->trans(
"NewEmployee");
900 $title = $langs->trans(
"NewUser");
906llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
908if ($action ==
'create' || $action ==
'adduserldap') {
911 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
915 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
920 $result = $ldap->connectBind();
922 $required_fields = array(
942 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
947 if (is_array($ldapusers)) {
948 foreach ($ldapusers as $key => $ldapuser) {
951 foreach ($required_fields as $value) {
953 $label .= $value.
"=******* ";
955 $label .= $value.
"=".$ldapuser[$value].
" ";
958 $liste[$key] = $label;
968 print
"\n\n<!-- Form liste LDAP debut -->\n";
970 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
971 print
'<input type="hidden" name="token" value="'.newToken().
'">';
972 print
'<table class="border centpercent"><tr>';
973 print
'<td width="160">';
974 print $langs->trans(
"LDAPUsers");
977 print
'<input type="hidden" name="action" value="adduserldap">';
978 if (is_array($liste) && count($liste)) {
979 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
982 print
'</td><td class="center">';
983 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
984 print
'</td></tr></table>';
987 print
"\n<!-- Form liste LDAP fin -->\n\n";
992 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
993 print
'<input type="hidden" name="token" value="'.newToken().
'">';
994 print
'<input type="hidden" name="action" value="add">';
995 if (!empty($ldap_sid)) {
996 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
998 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1004 print
'<table class="border centpercent">';
1007 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1008 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1013 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1015 if (!empty($ldap_lastname)) {
1016 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1017 print $ldap_lastname;
1019 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1024 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1026 if (!empty($ldap_firstname)) {
1027 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1028 print $ldap_firstname;
1030 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1035 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1037 if (!empty($ldap_login)) {
1038 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1040 } elseif (!empty($ldap_loginsmb)) {
1041 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1042 print $ldap_loginsmb;
1044 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1048 if (!empty(
$conf->use_javascript_ajax)) {
1052 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1053 if ($charforseparator ==
'none') {
1054 $charforseparator =
'';
1057 jQuery(document).ready(function() {
1058 $(".createloginauto").on("keyup", function() {
1059 console.log(".createloginauto change: We generate login when we have a lastname");
1061 lastname = $("#lastname").val().toLowerCase();
1064 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1066 print
' firstname = $("#firstname").val().toLowerCase();';
1072 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1076 $(
"#login").val(login);
1082 $generated_password = '';
1083 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1084 $generated_password = getRandomPassword(false);
1086 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1089 if (!empty($user->admin)) {
1090 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1092 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1094 if (isModEnabled('multicompany
') && !$user->entity) {
1095 if (!empty($conf->use_javascript_ajax)) {
1096 print '<script
type=
"text/javascript">
1098 $(
"select[name=admin]").change(
function() {
1099 if ( $(
this).val() == 0 ) {
1100 $(
"input[name=superadmin]")
1101 .prop(
"disabled",
true)
1102 .prop(
"checked",
false);
1103 $(
"select[name=entity]")
1104 .prop(
"disabled",
false);
1106 $(
"input[name=superadmin]")
1107 .prop(
"disabled",
false);
1110 $(
"input[name=superadmin]").change(
function() {
1111 if ( $(
this).is(
":checked") ) {
1112 $(
"select[name=entity]")
1113 .prop(
"disabled",
true);
1115 $(
"select[name=entity]")
1116 .prop(
"disabled",
false);
1122 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1123 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1124 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1126 print "</td></tr>\n";
1130 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1132 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1133 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1137 $defaultemployee = '1
';
1139 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1140 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1141 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1145 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1147 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
');
1151 // Expense report validator
1152 if (isModEnabled('expensereport
')) {
1153 print '<tr><td
class=
"titlefieldcreate">
';
1154 $text = $langs->trans("ForceUserExpenseValidator");
1155 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1158 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
');
1163 // Holiday request validator
1164 if (isModEnabled('holiday
')) {
1165 print '<tr><td
class=
"titlefieldcreate">
';
1166 $text = $langs->trans("ForceUserHolidayValidator");
1167 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1170 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
');
1176 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1178 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1182 print '</
table><hr><
table class=
"border centpercent">
';
1186 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1188 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1192 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1197 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1200 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1201 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1203 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1204 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1206 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1207 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1208 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1209 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1212 $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">';
1213 if (!empty(
$conf->use_javascript_ajax)) {
1214 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1220 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
1221 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1223 $valuetoshow = $hookmanager->resPrint;
1225 $valuetoshow .= $hookmanager->resPrint;
1231 if (isModEnabled(
'api')) {
1234 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1236 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">';
1237 if (!empty(
$conf->use_javascript_ajax)) {
1238 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1244 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1248 print
'</table><hr><table class="border centpercent">';
1252 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1253 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1255 print
'</textarea></td></tr>';
1258 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1259 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1263 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1264 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1268 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1269 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1270 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1272 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1278 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1279 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1280 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1285 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1287 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1288 if (!empty($ldap_phone)) {
1289 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1292 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1297 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1299 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1300 if (!empty($ldap_mobile)) {
1301 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1304 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1309 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1311 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1312 if (!empty($ldap_fax)) {
1313 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1316 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1321 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1323 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1324 if (!empty($ldap_mail)) {
1325 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1328 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1333 if (isModEnabled(
'socialnetworks')) {
1334 foreach ($socialnetworks as $key => $value) {
1335 if ($value[
'active']) {
1336 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1338 if (!empty($value[
'icon'])) {
1339 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1341 if (!empty($ldap_social[$key])) {
1342 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1343 print $ldap_social[$key];
1345 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1350 if (!empty($ldap_social[$key])) {
1351 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1353 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1360 if (isModEnabled(
'accounting')) {
1361 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1363 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1368 if (isModEnabled(
'agenda')) {
1369 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1371 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1376 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1377 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1378 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1379 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1385 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1386 print
'<td class="maxwidthonsmartphone">'.
"\n";
1387 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');
1393 if (isModEnabled(
'multicompany') && is_object($mc)) {
1395 if (!method_exists($mc,
'formObjectOptions')) {
1396 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1397 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1398 print
"<td>".$mc->select_entities(
$conf->entity);
1399 print
"</td></tr>\n";
1401 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1407 $parameters = array();
1408 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1411 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1412 print
'<td class="wordbreak">';
1413 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1415 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1416 print $doleditor->Create(1);
1420 print
'<tr><td class="tdtop">';
1421 print $langs->trans(
"NotePublic");
1423 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1424 $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%');
1425 $doleditor->Create();
1426 print
"</td></tr>\n";
1429 print
'<tr><td class="tdtop">';
1430 print $langs->trans(
"NotePrivate");
1432 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1433 $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%');
1434 $doleditor->Create();
1435 print
"</td></tr>\n";
1437 print
'</table><hr><table class="border centpercent">';
1444 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1445 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1450 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1452 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1455 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1456 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1457 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1458 $langs->load(
"salaries");
1462 $text = $langs->trans(
"THM");
1463 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1466 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1472 $text = $langs->trans(
"TJM");
1473 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1476 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1481 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1483 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1489 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1491 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1496 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1498 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1502 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1507 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1509 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1517 print $form->buttonsSaveCancel(
"CreateUser");
1523 $res =
$object->fetch($id,
'',
'', 1);
1528 $res =
$object->fetch_optionals();
1538 $passDoNotExpire = 0;
1540 $userChangePassNextLogon = 0;
1544 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1546 $result = $ldap->connectBind();
1548 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1549 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1555 if (count($ldap->uacf) > 0) {
1556 foreach ($ldap->uacf as $key => $statut) {
1557 if ($key == 65536) {
1558 $passDoNotExpire = 1;
1559 $statutUACF = $statut;
1564 $statutUACF =
"ACCOUNTDISABLE";
1567 if ($ldap->pwdlastset == 0) {
1568 $userChangePassNextLogon = 1;
1574 if ($mode ==
'employee') {
1575 $title = $langs->trans(
"Employee");
1576 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1578 $title = $langs->trans(
"User");
1581 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1582 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1591 if ($action ==
'password') {
1592 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1598 if ($action ==
'passwordsend') {
1599 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1605 if ($action ==
'disable') {
1606 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1612 if ($action ==
'enable') {
1613 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1617 if ($action ==
'delete') {
1618 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1624 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1625 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1627 $formquestionclone = array(
1628 'text' => $langs->trans(
"ConfirmClone"),
1629 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1630 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1631 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1634 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1635 array_splice($formquestionclone, 2, 0, array($newElement));
1637 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmUserClone',
$object->firstname.
' '.
$object->lastname),
'confirm_clone', $formquestionclone,
'yes',
'action-clone', 350, 600);
1644 if ($action !=
'edit') {
1647 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid valignmiddle" rel="noopener">';
1648 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1649 $morehtmlref .=
'</a>';
1651 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1652 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1654 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1656 print
'<div class="fichecenter">';
1657 print
'<div class="fichehalfleft">';
1659 print
'<div class="underbanner clearboth"></div>';
1660 print
'<table class="border tableforfield centpercent">';
1663 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1665 print
'<td class="error">';
1666 print $langs->trans(
"LoginAccountDisableInDolibarr");
1671 if (property_exists(
$object,
'admin')) {
1672 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1673 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1674 } elseif (!empty(
$object->admin)) {
1675 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1685 $text = $langs->trans(
"Type");
1686 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1688 $type = $langs->trans(
"Internal");
1690 $type = $langs->trans(
"External");
1692 print
'<span class="badgeneutral">';
1695 print
' ('.$langs->trans(
"DomainUser").
')';
1698 print
'</td></tr>'.
"\n";
1701 if (
$object->ldap_sid && is_object($ldap)) {
1702 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1703 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1704 print
'</td></tr>'.
"\n";
1708 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1710 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1714 print
'</td></tr>'.
"\n";
1717 if ($nbofusers > 1) {
1719 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1721 if (empty(
$object->fk_user)) {
1722 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1724 $huser =
new User($db);
1726 $huser->fetch(
$object->fk_user);
1727 print $huser->getNomUrl(-1);
1729 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1736 if (isModEnabled(
'expensereport')) {
1738 $text = $langs->trans(
"ForceUserExpenseValidator");
1739 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1742 if (!empty(
$object->fk_user_expense_validator)) {
1743 $evuser =
new User($db);
1744 $evuser->fetch(
$object->fk_user_expense_validator);
1745 print $evuser->getNomUrl(-1);
1752 if (isModEnabled(
'holiday')) {
1754 $text = $langs->trans(
"ForceUserHolidayValidator");
1755 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1758 if (!empty(
$object->fk_user_holiday_validator)) {
1759 $hvuser =
new User($db);
1760 $hvuser->fetch(
$object->fk_user_holiday_validator);
1761 print $hvuser->getNomUrl(-1);
1769 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1770 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1774 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1781 if ((empty($user->socid) && in_array($id, $childids))
1782 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1783 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1784 $langs->load(
"salaries");
1787 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1789 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1795 $text = $langs->trans(
"THM");
1796 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1805 $text = $langs->trans(
"TJM");
1806 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1815 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1817 if (
$object->dateemployment) {
1818 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1821 if (
$object->dateemploymentend) {
1822 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1829 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1837 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1838 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1839 if (
$object->fk_warehouse > 0) {
1840 $warehousestatic =
new Entrepot($db);
1841 $warehousestatic->fetch(
$object->fk_warehouse);
1842 print $warehousestatic->getNomUrl(1);
1850 print
'<div class="fichehalfright">';
1852 print
'<div class="underbanner clearboth"></div>';
1854 print
'<table class="border tableforfield centpercent">';
1857 if (isModEnabled(
'agenda')) {
1858 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1860 print $formother->showColor(
$object->color,
'');
1866 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1867 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1869 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1875 $langs->load(
"languages");
1876 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1878 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1882 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1888 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1889 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1890 print
'<td>'.$object->openid.
'</td>';
1895 if (isModEnabled(
'multicompany') && is_object($mc)) {
1897 if (!method_exists($mc,
'formObjectOptions')) {
1898 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1899 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1901 print $langs->trans(
"AllEntities");
1903 $mc->getInfo(
$object->entity);
1906 print
"</td></tr>\n";
1912 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1915 if (isModEnabled(
"societe")) {
1916 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1921 $societe->fetch(
$object->socid);
1922 if ($societe->id > 0) {
1923 $s .= $societe->getNomUrl(1,
'');
1926 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1928 if (!empty(
$object->contact_id)) {
1930 $contact->fetch(
$object->contact_id);
1931 if ($contact->id > 0) {
1932 if (
$object->socid > 0 && $s) {
1937 $s .= $contact->getNomUrl(1,
'');
1946 if (isModEnabled(
'member')) {
1947 $langs->load(
"members");
1948 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1952 $adh->fetch(
$object->fk_member);
1953 $adh->ref = $adh->getFullname($langs);
1954 print $adh->getNomUrl(-1);
1956 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1963 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1965 print
"</td></tr>\n";
1973 print
'<div class="div-table-responsive-no-min">';
1974 print
'<table class="noborder tableforfield centpercent">';
1976 print
'<tr class="liste_titre"><th class="liste_titre">';
1977 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1979 print
'<th class="liste_titre"></th>';
1983 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1985 if (
$object->datestartvalidity) {
1986 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1989 if (
$object->dateendvalidity) {
1990 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1997 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1998 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2007 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2008 if (!empty(
$object->ldap_sid)) {
2009 if ($passDoNotExpire) {
2010 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2011 } elseif ($userChangePassNextLogon) {
2012 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2013 } elseif ($userDisabled) {
2014 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2016 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2019 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2022 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2023 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2044 $parameters = array(
'valuetoshow' => $valuetoshow);
2045 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2047 $valuetoshow = $hookmanager->resPrint;
2049 $valuetoshow .= $hookmanager->resPrint;
2053 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2054 print
'<td class="wordbreak">';
2061 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2062 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2064 if (!empty(
$object->api_key)) {
2065 print
'<span class="opacitymedium">';
2072 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2074 if (
$object->datepreviouslogin) {
2075 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2078 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2089 print
'<div class="clearboth"></div>';
2098 print
'<div class="tabsAction">';
2100 $parameters = array();
2101 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2102 if (empty($reshook)) {
2106 'class' =>
'classfortooltip'
2110 if (empty($user->socid)) {
2111 $canSendMail =
false;
2113 $langs->load(
"mails");
2114 $canSendMail =
true;
2115 unset($params[
'attr'][
'title']);
2117 $langs->load(
"mails");
2118 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2120 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2123 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2125 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2126 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2128 unset($params[
'attr'][
'title']);
2129 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
2131 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2133 unset($params[
'attr'][
'title']);
2134 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2141 'class' =>
'classfortooltip'
2146 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2147 $cloneButtonId =
'';
2150 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2152 $cloneButtonId =
'action-clone';
2154 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2158 if (
$object->status == $object::STATUS_DISABLED) {
2159 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2160 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2161 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2163 unset($params[
'attr'][
'title']);
2164 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2167 if (
$object->status == $object::STATUS_DISABLED) {
2168 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2169 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2170 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2173 unset($params[
'attr'][
'title']);
2174 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2176 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2177 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2182 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2184 unset($params[
'attr'][
'title']);
2185 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2188 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2190 unset($params[
'attr'][
'title']);
2191 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2193 if ($user->id == $id) {
2194 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2195 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2199 if ($user->id != $id && $permissiontodisable &&
2201 if ($user->admin || !
$object->admin) {
2202 unset($params[
'attr'][
'title']);
2203 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2205 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2206 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2216 if (
GETPOST(
'modelselected')) {
2217 $action =
'presend';
2221 $modelmail =
'user';
2222 $defaulttopic =
'Information';
2223 $diroutput =
$conf->user->dir_output;
2224 $trackid =
'use'.$object->id;
2226 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2228 if ($action !=
'presend' && $action !=
'send') {
2233 if ($permissiontoreadgroup) {
2234 print
'<!-- Group section -->'.
"\n";
2242 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2244 if (!empty($groupslist)) {
2245 foreach ($groupslist as $groupforuser) {
2246 $exclude[] = $groupforuser->id;
2251 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2252 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2253 print $hookmanager->resPrint;
2255 if (empty($reshook)) {
2256 if ($permissiontoeditgroup) {
2257 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2258 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2259 print
'<input type="hidden" name="action" value="addgroup" />';
2260 print
'<input type="hidden" name="page_y" value="" />';
2263 print
'<!-- List of groups of the user -->'.
"\n";
2264 print
'<table class="noborder centpercent">'.
"\n";
2265 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2266 print
'<th class="liste_titre right">';
2267 if ($permissiontoeditgroup) {
2268 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(),
$object->entity,
false,
'maxwidth150');
2270 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2271 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2273 print
'</th></tr>'.
"\n";
2276 if (!empty($groupslist)) {
2277 foreach ($groupslist as $group) {
2278 print
'<tr class="oddeven">';
2279 print
'<td class="tdoverflowmax200">';
2280 if ($permissiontoeditgroup) {
2281 print $group->getNomUrl(1);
2283 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2286 print
'<td class="right">';
2287 if ($permissiontoeditgroup) {
2288 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2289 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2294 print
"</td></tr>\n";
2297 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2302 if ($permissiontoeditgroup) {
2314 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2315 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2316 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2317 print
'<input type="hidden" name="action" value="update">';
2318 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2322 print
'<table class="border centpercent">';
2326 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2334 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2335 if ($permissiontoedit && !
$object->ldap_sid) {
2336 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2337 } elseif (
$object->civility_code) {
2338 print $langs->trans(
"Civility".
$object->civility_code);
2344 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2346 if ($permissiontoedit && !
$object->ldap_sid) {
2347 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2349 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2356 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2358 if ($permissiontoedit && !
$object->ldap_sid) {
2359 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2361 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2367 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2369 if ($user->admin && !
$object->ldap_sid) {
2370 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2372 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2379 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2381 $langs->load(
"admin");
2383 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2384 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2388 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2389 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2395 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2396 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2399 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2401 if (isModEnabled(
'multicompany') && !$user->entity) {
2402 if (
$conf->use_javascript_ajax) {
2403 print
'<script type="text/javascript">
2405 var admin = $("select[name=admin]").val();
2407 $("input[name=superadmin]")
2408 .prop("disabled", true)
2409 .prop("checked", false);
2411 if ($("input[name=superadmin]").is(":checked")) {
2412 $("select[name=entity]")
2413 .prop("disabled", true);
2415 $("select[name=admin]").change(function() {
2416 if ( $(this).val() == 0 ) {
2417 $("input[name=superadmin]")
2418 .prop("disabled", true)
2419 .prop("checked", false);
2420 $("select[name=entity]")
2421 .prop("disabled", false);
2423 $("input[name=superadmin]")
2424 .prop("disabled", false);
2427 $("input[name=superadmin]").change(function() {
2428 if ( $(this).is(":checked")) {
2429 $("select[name=entity]")
2430 .prop("disabled", true);
2432 $("select[name=entity]")
2433 .prop("disabled", false);
2440 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2441 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2445 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2446 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2447 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2448 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2457 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2459 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2460 if ($permissiontoedit) {
2461 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2463 print $arraygender[
$object->gender];
2469 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2470 if ($permissiontoedit) {
2471 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2474 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2483 if ($nbofusers > 1) {
2485 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2487 if ($permissiontoedit) {
2488 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');
2490 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2491 $huser =
new User($db);
2492 $huser->fetch(
$object->fk_user);
2493 print $huser->getNomUrl(-1);
2499 if (isModEnabled(
'expensereport')) {
2500 print
'<tr><td class="titlefieldcreate">';
2501 $text = $langs->trans(
"ForceUserExpenseValidator");
2502 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2505 if ($permissiontoedit) {
2506 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');
2508 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2509 $evuser =
new User($db);
2510 $evuser->fetch(
$object->fk_user_expense_validator);
2511 print $evuser->getNomUrl(-1);
2518 if (isModEnabled(
'holiday')) {
2519 print
'<tr><td class="titlefieldcreate">';
2520 $text = $langs->trans(
"ForceUserHolidayValidator");
2521 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2524 if ($permissiontoedit) {
2525 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');
2527 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2528 $hvuser =
new User($db);
2529 $hvuser->fetch(
$object->fk_user_holiday_validator);
2530 print $hvuser->getNomUrl(-1);
2538 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2540 if ($user->id ==
$object->id || !$user->admin) {
2542 $type = $langs->trans(
"Internal");
2544 $type = $langs->trans(
"External");
2547 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2549 print
' ('.$langs->trans(
"DomainUser").
')';
2559 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2562 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2564 print
' ('.$langs->trans(
"DomainUser").
')';
2567 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2570 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2572 print
' ('.$langs->trans(
"DomainUser").
')';
2575 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2578 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2580 print
' ('.$langs->trans(
"DomainUser").
')';
2583 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2586 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2595 print
'<table class="border centpercent">';
2598 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2600 if ($permissiontoedit) {
2601 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2607 if ($permissiontoedit) {
2608 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2616 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2619 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2620 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2622 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2623 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2625 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2626 if ($permissiontoeditpasswordandsee) {
2627 $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">';
2628 if (!empty(
$conf->use_javascript_ajax)) {
2629 $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').
'"');
2632 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2636 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2637 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2639 $valuetoshow = $hookmanager->resPrint;
2641 $valuetoshow .= $hookmanager->resPrint;
2645 print
"</td></tr>\n";
2648 if (isModEnabled(
'api')) {
2649 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2651 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2652 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2653 if (!empty(
$conf->use_javascript_ajax)) {
2654 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2661 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2662 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2664 if ($permissiontoedit) {
2665 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2667 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2673 print
'</table><hr><table class="border centpercent">';
2677 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2679 if ($permissiontoedit) {
2680 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2683 if ($permissiontoedit) {
2684 print
'</textarea>';
2689 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2690 if ($permissiontoedit) {
2691 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2698 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2699 if ($permissiontoedit) {
2700 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2707 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td>';
2708 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2709 if ($permissiontoedit) {
2710 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2712 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2716 print $countrylabel;
2722 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2723 if ($permissiontoedit) {
2724 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2725 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2733 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2735 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2736 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2737 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2739 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2745 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2747 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2748 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2749 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2751 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2757 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2759 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2760 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2761 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2763 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2769 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2771 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2772 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2773 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2775 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2780 if (isModEnabled(
'socialnetworks')) {
2781 foreach ($socialnetworks as $key => $value) {
2782 if ($value[
'active']) {
2783 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2785 if (!empty($value[
'icon'])) {
2786 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2788 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2789 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2791 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2792 print
$object->socialnetworks[$key];
2797 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2802 print
'</table><hr><table class="border centpercent">';
2806 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2807 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2808 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>';
2813 if (isModEnabled(
'accounting')) {
2815 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2817 if ($permissiontoedit) {
2818 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2820 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2821 print
$object->accountancy_code;
2828 if (isModEnabled(
'agenda')) {
2829 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2831 if ($permissiontoedit) {
2832 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2834 print $formother->showColor(
$object->color,
'');
2841 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2843 print $form->showphoto(
'userphoto',
$object, 60, 0, $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2848 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2849 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2851 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2852 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
'',
'', 0, 0, 1);
2854 $cats = $c->containing(
$object->id, Categorie::TYPE_USER);
2855 $arrayselected = array();
2856 foreach ($cats as $cat) {
2857 $arrayselected[] = $cat->id;
2859 if ($permissiontoedit) {
2860 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected, 0, 0,
'', 0,
'90%');
2862 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2869 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";
2870 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2876 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2878 print
$object->getLibStatut(4);
2905 if (isModEnabled(
'member')) {
2906 $langs->load(
"members");
2907 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2911 $adh->fetch(
$object->fk_member);
2912 $adh->ref = $adh->login;
2913 print $adh->getNomUrl(1);
2915 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2923 if (isModEnabled(
'multicompany') && is_object($mc)) {
2925 if (!method_exists($mc,
'formObjectOptions')) {
2926 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2927 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2928 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2929 print
"</td></tr>\n";
2931 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2937 $parameters = array(
'colspan' =>
' colspan="2"');
2939 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2940 print $hookmanager->resPrint;
2941 if (empty($reshook)) {
2942 if ($permissiontoedit) {
2943 print
$object->showOptionals($extrafields,
'edit');
2945 print
$object->showOptionals($extrafields,
'view');
2950 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2952 if ($permissiontoedit) {
2953 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2955 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2956 print $doleditor->Create(1);
2968 print
'<table class="border centpercent">';
2974 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2976 if ($permissiontoedit) {
2977 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2979 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2985 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2987 if ($permissiontoedit) {
2988 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2996 if ((empty($user->socid) && in_array($id, $childids))
2997 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
2998 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2999 $langs->load(
"salaries");
3002 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3004 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3010 $text = $langs->trans(
"THM");
3011 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3014 if ($permissiontoedit) {
3015 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3024 $text = $langs->trans(
"TJM");
3025 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3028 if ($permissiontoedit) {
3029 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3038 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3040 if ($permissiontoedit) {
3041 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3046 if ($dateemployment && $dateemploymentend) {
3050 if ($permissiontoedit) {
3051 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3059 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3061 if ($permissiontoedit) {
3062 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3073 print
'<div class="center">';
3074 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3075 print
' ';
3076 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3082 if ($action !=
'edit' && $action !=
'presend') {
3083 print
'<div class="fichecenter"><div class="fichehalfleft">';
3088 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3089 $genallowed = $user->hasRight(
"user",
"user",
"read");
3090 $delallowed = $user->hasRight(
"user",
"user",
"write");
3095 $societe->fetch(
$object->socid);
3100 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', !is_object($societe) || empty($societe->default_lang) ?
'' : $societe->default_lang);
3101 $somethingshown = $formfile->numoffiles;
3104 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3105 $linktoelem = $tmparray[
'linktoelem'];
3106 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3107 print $htmltoenteralink;
3109 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3113 $morehtmlcenter =
'<div class="nowraponall">';
3114 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3115 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3116 $morehtmlcenter .=
'</div>';
3118 print
'</div><div class="fichehalfright">';
3121 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3123 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3125 print
'</div></div>';
3128 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3135include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3137if (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.
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.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
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_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$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.