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")) && (empty($user->socid) || $user->socid ==
$object->socid);
127$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
128$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
129$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
130$permissiontoreadgroup = $permissiontoread;
131$permissiontoeditgroup = $permissiontoedit;
133 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
134 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
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) {
151$caneditpasswordandsee =
false;
152$caneditpasswordandsend =
false;
155$permissiontoeditpasswordandsee =
false;
156$permissiontoeditpasswordandsend =
false;
159 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
160 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
161 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
164$passwordismodified =
false;
172$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
173$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
178if (empty($reshook)) {
179 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
181 if (empty($backtopage) || ($cancel && empty($id))) {
182 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
183 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
184 $backtopage = $backurlforlist;
186 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
192 if (!empty($backtopageforcancel)) {
193 header(
"Location: ".$backtopageforcancel);
195 } elseif (!empty($backtopage)) {
196 header(
"Location: ".$backtopage);
202 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
203 if ($id != $user->id) {
205 if (
$object->admin && empty($user->admin)) {
208 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
211 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
217 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
220 if ($id != $user->id) {
223 if (!empty(
$conf->file->main_limit_users)) {
224 $nb =
$object->getNbOfUsers(
"active");
225 if ($nb >=
$conf->file->main_limit_users) {
227 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
233 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
239 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
240 if ($id != $user->id) {
241 if (!GETPOSTISSET(
'token')) {
242 print
'Error, token required for this critical operation';
250 $result =
$object->delete($user);
252 $langs->load(
"errors");
256 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
263 if ($action ==
'add' && $permissiontoadd) {
277 if (!empty(
$conf->file->main_limit_users)) {
278 $nb =
$object->getNbOfUsers(
"active");
279 if ($nb >=
$conf->file->main_limit_users) {
281 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
291 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
305 if (isModEnabled(
'socialnetworks')) {
306 $object->socialnetworks = array();
307 foreach ($socialnetworks as $key => $value) {
308 if (
GETPOST($key,
'alphanohtml')) {
314 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
317 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
332 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
333 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
337 $object->dateemployment = $dateemployment;
338 $object->dateemploymentend = $dateemploymentend;
339 $object->datestartvalidity = $datestartvalidity;
340 $object->dateendvalidity = $dateendvalidity;
348 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
355 if (isModEnabled(
'multicompany')) {
362 $object->entity = ($entity ==
'' ? 1 : $entity);
366 $object->entity = ($entity ==
'' ? 1 : $entity);
377 if (
GETPOST(
'password',
'password')) {
378 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
380 if (is_int($resPass) && $resPass < 0) {
381 $langs->load(
"errors");
386 if (isModEnabled(
"category")) {
388 $usercats =
GETPOST(
'usercats',
'array');
389 $object->setCategories($usercats);
393 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
397 $langs->load(
"errors");
406 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
409 $editgroup->fetch($group);
410 $editgroup->oldcopy = clone $editgroup;
414 if ($action ==
'addgroup') {
415 $result =
$object->SetInGroup($group, $editgroup->entity);
417 if ($action ==
'removegroup') {
418 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
429 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
430 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
432 if ($permissiontoedit) {
435 if (!
GETPOST(
"lastname",
'alpha')) {
440 if (!
GETPOST(
"login",
'alpha')) {
457 if (GETPOSTISSET(
"ref_employee")) {
461 if (GETPOSTISSET(
"national_registration_number")) {
462 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
465 if ($permissiontoeditpasswordandsee) {
468 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
471 if (!empty($user->admin) && $user->id !=
$id) {
476 if ($user->admin && !
$object->ldap_sid) {
488 if (isModEnabled(
'socialnetworks')) {
489 $object->socialnetworks = array();
490 foreach ($socialnetworks as $key => $value) {
491 if (
GETPOST($key,
'alphanohtml')) {
497 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
500 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
513 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
515 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
519 $object->dateemployment = $dateemployment;
520 $object->dateemploymentend = $dateemploymentend;
521 $object->datestartvalidity = $datestartvalidity;
522 $object->dateendvalidity = $dateendvalidity;
525 if (isModEnabled(
'stock')) {
532 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
546 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
554 if (!empty($_FILES[
'photo'][
'name'])) {
560 $langs->load(
"errors");
562 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
567 $passwordismodified = 0;
570 $passwordismodified = 1;
577 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
578 $langs->load(
"errors");
579 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
587 if (!$error && GETPOSTISSET(
'contactid')) {
591 if ($contactid > 0) {
593 $contact->fetch($contactid);
595 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
596 $sql .=
" SET fk_socpeople=".((int) $contactid);
597 if (!empty($contact->socid)) {
598 $sql .=
", fk_soc=".((int) $contact->socid);
599 } elseif ($socid > 0) {
600 $sql .=
", fk_soc = null";
601 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
603 $sql .=
" WHERE rowid = ".((int)
$object->id);
604 } elseif ($socid > 0) {
605 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
606 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
607 $sql .=
" WHERE rowid = ".((int)
$object->id);
609 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
610 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
611 $sql .=
" WHERE rowid = ".((int)
$object->id);
614 $resql = $db->query($sql);
621 if (!$error && !count(
$object->errors)) {
630 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
638 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
640 if (!($result > 0)) {
648 $langs->load(
"errors");
649 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
654 if (!$error && !count(
$object->errors)) {
656 $categories =
GETPOST(
'usercats',
'array');
657 $object->setCategories($categories);
660 if (!$error && !count(
$object->errors)) {
664 $login = $_SESSION[
"dol_login"];
667 $langs->load(
"errors");
668 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
670 if ($passwordismodified &&
$object->login == $user->login) {
672 $langs->load(
"errors");
673 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
674 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
682 if ($permissiontoeditpasswordandsee) {
683 dol_syslog(
"Not allowed to change fields, only password");
687 if (
GETPOST(
"password",
"password")) {
690 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
691 if (is_int($ret) && $ret < 0) {
700 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
701 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
705 $newpassword =
$object->setPassword($user,
'');
706 if (is_int($newpassword) && $newpassword < 0) {
708 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
711 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
712 if (
$object->send_password($user, $newpassword) > 0) {
718 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
724 if ($action ==
'adduserldap' && $permissiontoadd) {
725 $selecteduser =
GETPOST(
'users');
727 $required_fields = array(
743 if (isModEnabled(
'socialnetworks')) {
744 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
745 foreach ($arrayofsocialnetworks as $socialnetwork) {
751 $result = $ldap->connectBind();
754 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
759 if (is_array($ldapusers)) {
760 foreach ($ldapusers as $key => $attribute) {
772 $ldap_social = array();
774 if (isModEnabled(
'socialnetworks')) {
775 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
776 foreach ($arrayofsocialnetworks as $socialnetwork) {
777 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
787 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
790 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
794 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
802 $clone->api_key =
'';
804 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
805 $clone->firstname = $parts[0];
806 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
808 $clone->login = substr($parts[0], 0, 1).$parts[1];
811 $clone->context[
'createfromclone'] =
'createfromclone';
812 $id = $clone->create($user);
813 $refalreadyexists = 0;
816 $result = $clone->cloneRights(
$object->id, $id);
819 if (
GETPOST(
'clone_categories')) {
820 $result = $clone->cloneCategories(
$object->id, $id);
828 if ($clone->error ==
'ErrorProductAlreadyExists') {
832 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
833 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
836 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
840 unset($clone->context[
'createfromclone']);
847 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
858 $triggersendname =
'USER_SENTBYMAIL';
860 $mode =
'emailfromuser';
861 $trackid =
'use'.$id;
862 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
865 $upload_dir =
$conf->user->dir_output;
866 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
874$form =
new Form($db);
879if (isModEnabled(
'stock')) {
885$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
886$resql = $db->query($sql);
888 $obj = $db->fetch_object($resql);
890 $nbofusers = $obj->nb;
898 $title = $person_name.
" - ".$langs->trans(
'Card');
901 $title = $langs->trans(
"NewEmployee");
903 $title = $langs->trans(
"NewUser");
909llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
911if ($action ==
'create' || $action ==
'adduserldap') {
914 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
918 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
923 $result = $ldap->connectBind();
925 $required_fields = array(
945 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
950 if (is_array($ldapusers)) {
951 foreach ($ldapusers as $key => $ldapuser) {
954 foreach ($required_fields as $value) {
956 $label .= $value.
"=******* ";
958 $label .= $value.
"=".$ldapuser[$value].
" ";
961 $liste[$key] = $label;
971 print
"\n\n<!-- Form liste LDAP debut -->\n";
973 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
974 print
'<input type="hidden" name="token" value="'.newToken().
'">';
975 print
'<table class="border centpercent"><tr>';
976 print
'<td width="160">';
977 print $langs->trans(
"LDAPUsers");
980 print
'<input type="hidden" name="action" value="adduserldap">';
981 if (is_array($liste) && count($liste)) {
982 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
985 print
'</td><td class="center">';
986 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
987 print
'</td></tr></table>';
990 print
"\n<!-- Form liste LDAP fin -->\n\n";
995 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
996 print
'<input type="hidden" name="token" value="'.newToken().
'">';
997 print
'<input type="hidden" name="action" value="add">';
998 if (!empty($ldap_sid)) {
999 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1001 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1007 print
'<table class="border centpercent">';
1010 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1011 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1016 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1018 if (!empty($ldap_lastname)) {
1019 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1020 print $ldap_lastname;
1022 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1027 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1029 if (!empty($ldap_firstname)) {
1030 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1031 print $ldap_firstname;
1033 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1038 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1040 if (!empty($ldap_login)) {
1041 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1043 } elseif (!empty($ldap_loginsmb)) {
1044 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1045 print $ldap_loginsmb;
1047 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1051 if (!empty(
$conf->use_javascript_ajax)) {
1055 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1056 if ($charforseparator ==
'none') {
1057 $charforseparator =
'';
1060 jQuery(document).ready(function() {
1061 $(".createloginauto").on("keyup", function() {
1062 console.log(".createloginauto change: We generate login when we have a lastname");
1064 lastname = $("#lastname").val().toLowerCase();
1067 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1069 print
' firstname = $("#firstname").val().toLowerCase();';
1075 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1079 $(
"#login").val(login);
1085 $generated_password = '';
1086 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1087 $generated_password = getRandomPassword(false);
1089 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1092 if (!empty($user->admin)) {
1093 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1095 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1097 if (isModEnabled('multicompany
') && !$user->entity) {
1098 if (!empty($conf->use_javascript_ajax)) {
1099 print '<script
type=
"text/javascript">
1101 $(
"select[name=admin]").change(
function() {
1102 if ( $(
this).val() == 0 ) {
1103 $(
"input[name=superadmin]")
1104 .prop(
"disabled",
true)
1105 .prop(
"checked",
false);
1106 $(
"select[name=entity]")
1107 .prop(
"disabled",
false);
1109 $(
"input[name=superadmin]")
1110 .prop(
"disabled",
false);
1113 $(
"input[name=superadmin]").change(
function() {
1114 if ( $(
this).is(
":checked") ) {
1115 $(
"select[name=entity]")
1116 .prop(
"disabled",
true);
1118 $(
"select[name=entity]")
1119 .prop(
"disabled",
false);
1125 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1126 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1127 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1129 print "</td></tr>\n";
1133 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1135 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1136 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1140 $defaultemployee = '1
';
1142 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1143 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1144 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1148 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1150 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
');
1154 // Expense report validator
1155 if (isModEnabled('expensereport
')) {
1156 print '<tr><td
class=
"titlefieldcreate">
';
1157 $text = $langs->trans("ForceUserExpenseValidator");
1158 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1161 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
');
1166 // Holiday request validator
1167 if (isModEnabled('holiday
')) {
1168 print '<tr><td
class=
"titlefieldcreate">
';
1169 $text = $langs->trans("ForceUserHolidayValidator");
1170 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1173 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
');
1179 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1181 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1185 print '</
table><hr><
table class=
"border centpercent">
';
1189 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1191 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1195 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1200 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1203 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1204 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1206 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1207 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1209 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1210 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1211 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1212 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1215 $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">';
1216 if (!empty(
$conf->use_javascript_ajax)) {
1217 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1223 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1224 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1226 $valuetoshow = $hookmanager->resPrint;
1228 $valuetoshow .= $hookmanager->resPrint;
1234 if (isModEnabled(
'api')) {
1237 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1239 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">';
1240 if (!empty(
$conf->use_javascript_ajax)) {
1241 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1247 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1251 print
'</table><hr><table class="border centpercent">';
1255 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1256 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1258 print
'</textarea></td></tr>';
1261 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1262 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1266 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1267 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1271 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1272 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1273 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1275 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1281 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1282 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1283 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1288 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1290 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1291 if (!empty($ldap_phone)) {
1292 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1295 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1300 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1302 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1303 if (!empty($ldap_mobile)) {
1304 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1307 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1312 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1314 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1315 if (!empty($ldap_fax)) {
1316 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1319 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1324 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1326 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1327 if (!empty($ldap_mail)) {
1328 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1331 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1336 if (isModEnabled(
'socialnetworks')) {
1337 foreach ($socialnetworks as $key => $value) {
1338 if ($value[
'active']) {
1339 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1341 if (!empty($value[
'icon'])) {
1342 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1344 if (!empty($ldap_social[$key])) {
1345 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1346 print $ldap_social[$key];
1348 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1353 if (!empty($ldap_social[$key])) {
1354 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1356 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1363 if (isModEnabled(
'accounting')) {
1364 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1366 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1371 if (isModEnabled(
'agenda')) {
1372 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1374 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1379 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1380 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1381 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1382 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1388 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1389 print
'<td class="maxwidthonsmartphone">'.
"\n";
1390 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');
1396 if (isModEnabled(
'multicompany') && is_object($mc)) {
1398 if (!method_exists($mc,
'formObjectOptions')) {
1399 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1400 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1401 print
"<td>".$mc->select_entities(
$conf->entity);
1402 print
"</td></tr>\n";
1404 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1410 $parameters = array();
1411 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1414 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1415 print
'<td class="wordbreak">';
1416 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1418 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1419 print $doleditor->Create(1);
1423 print
'<tr><td class="tdtop">';
1424 print $langs->trans(
"NotePublic");
1426 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1427 $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%');
1428 $doleditor->Create();
1429 print
"</td></tr>\n";
1432 print
'<tr><td class="tdtop">';
1433 print $langs->trans(
"NotePrivate");
1435 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1436 $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%');
1437 $doleditor->Create();
1438 print
"</td></tr>\n";
1440 print
'</table><hr><table class="border centpercent">';
1447 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1448 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1453 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1455 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1458 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1459 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1460 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1461 $langs->load(
"salaries");
1465 $text = $langs->trans(
"THM");
1466 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1469 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1475 $text = $langs->trans(
"TJM");
1476 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1479 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1484 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1486 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1492 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1494 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1499 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1501 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1505 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1510 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1512 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1520 print $form->buttonsSaveCancel(
"CreateUser");
1526 $res =
$object->fetch($id,
'',
'', 1);
1531 $res =
$object->fetch_optionals();
1541 $passDoNotExpire = 0;
1543 $userChangePassNextLogon = 0;
1547 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1549 $result = $ldap->connectBind();
1551 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1552 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1558 if (count($ldap->uacf) > 0) {
1559 foreach ($ldap->uacf as $key => $statut) {
1560 if ($key == 65536) {
1561 $passDoNotExpire = 1;
1562 $statutUACF = $statut;
1567 $statutUACF =
"ACCOUNTDISABLE";
1570 if ($ldap->pwdlastset == 0) {
1571 $userChangePassNextLogon = 1;
1577 if ($mode ==
'employee') {
1578 $title = $langs->trans(
"Employee");
1579 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1581 $title = $langs->trans(
"User");
1584 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1585 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1594 if ($action ==
'password') {
1595 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1601 if ($action ==
'passwordsend') {
1602 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1608 if ($action ==
'disable') {
1609 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1615 if ($action ==
'enable') {
1616 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1620 if ($action ==
'delete') {
1621 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1627 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1628 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1630 $formquestionclone = array(
1631 'text' => $langs->trans(
"ConfirmClone"),
1632 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1633 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1634 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1637 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1638 array_splice($formquestionclone, 2, 0, array($newElement));
1640 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);
1647 if ($action !=
'edit') {
1650 $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">';
1651 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1652 $morehtmlref .=
'</a>';
1654 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1655 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1657 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1659 print
'<div class="fichecenter">';
1660 print
'<div class="fichehalfleft">';
1662 print
'<div class="underbanner clearboth"></div>';
1663 print
'<table class="border tableforfield centpercent">';
1666 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1668 print
'<td class="error">';
1669 print $langs->trans(
"LoginAccountDisableInDolibarr");
1674 if (property_exists(
$object,
'admin')) {
1675 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1676 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1677 } elseif (!empty(
$object->admin)) {
1678 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1688 $text = $langs->trans(
"Type");
1689 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1691 $type = $langs->trans(
"Internal");
1693 $type = $langs->trans(
"External");
1695 print
'<span class="badgeneutral">';
1698 print
' ('.$langs->trans(
"DomainUser").
')';
1701 print
'</td></tr>'.
"\n";
1704 if (
$object->ldap_sid && is_object($ldap)) {
1705 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1706 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1707 print
'</td></tr>'.
"\n";
1711 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1713 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1717 print
'</td></tr>'.
"\n";
1720 if ($nbofusers > 1) {
1722 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1724 if (empty(
$object->fk_user)) {
1725 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1727 $huser =
new User($db);
1729 $huser->fetch(
$object->fk_user);
1730 print $huser->getNomUrl(-1);
1732 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1739 if (isModEnabled(
'expensereport')) {
1741 $text = $langs->trans(
"ForceUserExpenseValidator");
1742 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1745 if (!empty(
$object->fk_user_expense_validator)) {
1746 $evuser =
new User($db);
1747 $evuser->fetch(
$object->fk_user_expense_validator);
1748 print $evuser->getNomUrl(-1);
1755 if (isModEnabled(
'holiday')) {
1757 $text = $langs->trans(
"ForceUserHolidayValidator");
1758 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1761 if (!empty(
$object->fk_user_holiday_validator)) {
1762 $hvuser =
new User($db);
1763 $hvuser->fetch(
$object->fk_user_holiday_validator);
1764 print $hvuser->getNomUrl(-1);
1772 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1773 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1777 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1784 if ((empty($user->socid) && in_array($id, $childids))
1785 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1786 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1787 $langs->load(
"salaries");
1790 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1792 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1798 $text = $langs->trans(
"THM");
1799 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1808 $text = $langs->trans(
"TJM");
1809 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1818 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1820 if (
$object->dateemployment) {
1821 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1824 if (
$object->dateemploymentend) {
1825 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1832 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1840 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1841 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1842 if (
$object->fk_warehouse > 0) {
1843 $warehousestatic =
new Entrepot($db);
1844 $warehousestatic->fetch(
$object->fk_warehouse);
1845 print $warehousestatic->getNomUrl(1);
1853 print
'<div class="fichehalfright">';
1855 print
'<div class="underbanner clearboth"></div>';
1857 print
'<table class="border tableforfield centpercent">';
1860 if (isModEnabled(
'agenda')) {
1861 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1863 print $formother->showColor(
$object->color,
'');
1869 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1870 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1872 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1878 $langs->load(
"languages");
1879 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1881 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1885 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1891 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1892 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1893 print
'<td>'.$object->openid.
'</td>';
1898 if (isModEnabled(
'multicompany') && is_object($mc)) {
1900 if (!method_exists($mc,
'formObjectOptions')) {
1901 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1902 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1904 print $langs->trans(
"AllEntities");
1906 $mc->getInfo(
$object->entity);
1909 print
"</td></tr>\n";
1915 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1918 if (isModEnabled(
"societe")) {
1919 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1924 $societe->fetch(
$object->socid);
1925 if ($societe->id > 0) {
1926 $s .= $societe->getNomUrl(1,
'');
1929 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1931 if (!empty(
$object->contact_id)) {
1933 $contact->fetch(
$object->contact_id);
1934 if ($contact->id > 0) {
1935 if (
$object->socid > 0 && $s) {
1940 $s .= $contact->getNomUrl(1,
'');
1949 if (isModEnabled(
'member')) {
1950 $langs->load(
"members");
1951 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1955 $adh->fetch(
$object->fk_member);
1956 $adh->ref = $adh->getFullname($langs);
1957 print $adh->getNomUrl(-1);
1959 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1966 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1968 print
"</td></tr>\n";
1976 print
'<div class="div-table-responsive-no-min">';
1977 print
'<table class="noborder tableforfield centpercent">';
1979 print
'<tr class="liste_titre"><th class="liste_titre">';
1980 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1982 print
'<th class="liste_titre"></th>';
1986 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1988 if (
$object->datestartvalidity) {
1989 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1992 if (
$object->dateendvalidity) {
1993 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2000 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
2001 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2010 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2011 if (!empty(
$object->ldap_sid)) {
2012 if ($passDoNotExpire) {
2013 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2014 } elseif ($userChangePassNextLogon) {
2015 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2016 } elseif ($userDisabled) {
2017 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2019 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2022 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2025 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2026 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2047 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2048 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2050 $valuetoshow = $hookmanager->resPrint;
2052 $valuetoshow .= $hookmanager->resPrint;
2056 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2057 print
'<td class="wordbreak">';
2064 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2065 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2067 if (!empty(
$object->api_key)) {
2068 print
'<span class="opacitymedium">';
2075 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2077 if (
$object->datepreviouslogin) {
2078 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2081 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2092 print
'<div class="clearboth"></div>';
2101 print
'<div class="tabsAction">';
2103 $parameters = array();
2104 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2105 if (empty($reshook)) {
2109 'class' =>
'classfortooltip'
2113 if (empty($user->socid)) {
2114 $canSendMail =
false;
2116 $langs->load(
"mails");
2117 $canSendMail =
true;
2118 unset($params[
'attr'][
'title']);
2120 $langs->load(
"mails");
2121 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2123 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2126 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2128 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2129 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2131 unset($params[
'attr'][
'title']);
2134 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2136 unset($params[
'attr'][
'title']);
2137 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2144 'class' =>
'classfortooltip'
2149 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2150 $cloneButtonId =
'';
2153 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2155 $cloneButtonId =
'action-clone';
2157 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2161 if (
$object->status == $object::STATUS_DISABLED) {
2162 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2163 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2164 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2166 unset($params[
'attr'][
'title']);
2167 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2170 if (
$object->status == $object::STATUS_DISABLED) {
2171 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2172 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2173 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2176 unset($params[
'attr'][
'title']);
2177 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2179 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2180 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2185 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2187 unset($params[
'attr'][
'title']);
2188 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2191 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2193 unset($params[
'attr'][
'title']);
2194 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2196 if ($user->id == $id) {
2197 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2198 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2202 if ($user->id != $id && $permissiontodisable &&
2204 if ($user->admin || !
$object->admin) {
2205 unset($params[
'attr'][
'title']);
2206 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2208 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2209 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2219 if (
GETPOST(
'modelselected')) {
2220 $action =
'presend';
2224 $modelmail =
'user';
2225 $defaulttopic =
'Information';
2226 $diroutput =
$conf->user->dir_output;
2227 $trackid =
'use'.$object->id;
2229 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2231 if ($action !=
'presend' && $action !=
'send') {
2236 if ($permissiontoreadgroup) {
2237 print
'<!-- Group section -->'.
"\n";
2245 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2247 if (!empty($groupslist)) {
2248 foreach ($groupslist as $groupforuser) {
2249 $exclude[] = $groupforuser->id;
2254 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2255 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2256 print $hookmanager->resPrint;
2258 if (empty($reshook)) {
2259 if ($permissiontoeditgroup) {
2260 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2261 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2262 print
'<input type="hidden" name="action" value="addgroup" />';
2263 print
'<input type="hidden" name="page_y" value="" />';
2266 print
'<!-- List of groups of the user -->'.
"\n";
2267 print
'<table class="noborder centpercent">'.
"\n";
2268 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2269 print
'<th class="liste_titre right">';
2270 if ($permissiontoeditgroup) {
2271 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(),
$object->entity,
false,
'maxwidth150');
2273 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2274 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2276 print
'</th></tr>'.
"\n";
2279 if (!empty($groupslist)) {
2280 foreach ($groupslist as $group) {
2281 print
'<tr class="oddeven">';
2282 print
'<td class="tdoverflowmax200">';
2283 if ($permissiontoeditgroup) {
2284 print $group->getNomUrl(1);
2286 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2289 print
'<td class="right">';
2290 if ($permissiontoeditgroup) {
2291 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2292 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2297 print
"</td></tr>\n";
2300 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2305 if ($permissiontoeditgroup) {
2317 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2318 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2319 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2320 print
'<input type="hidden" name="action" value="update">';
2321 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2325 print
'<table class="border centpercent">';
2329 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2337 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2338 if ($permissiontoedit && !
$object->ldap_sid) {
2339 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2340 } elseif (
$object->civility_code) {
2341 print $langs->trans(
"Civility".
$object->civility_code);
2347 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2349 if ($permissiontoedit && !
$object->ldap_sid) {
2350 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2352 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2359 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2361 if ($permissiontoedit && !
$object->ldap_sid) {
2362 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2364 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2370 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2372 if ($user->admin && !
$object->ldap_sid) {
2373 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2375 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2382 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2384 $langs->load(
"admin");
2386 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2387 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2391 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2392 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2398 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2399 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2402 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2404 if (isModEnabled(
'multicompany') && !$user->entity) {
2405 if (
$conf->use_javascript_ajax) {
2406 print
'<script type="text/javascript">
2408 var admin = $("select[name=admin]").val();
2410 $("input[name=superadmin]")
2411 .prop("disabled", true)
2412 .prop("checked", false);
2414 if ($("input[name=superadmin]").is(":checked")) {
2415 $("select[name=entity]")
2416 .prop("disabled", true);
2418 $("select[name=admin]").change(function() {
2419 if ( $(this).val() == 0 ) {
2420 $("input[name=superadmin]")
2421 .prop("disabled", true)
2422 .prop("checked", false);
2423 $("select[name=entity]")
2424 .prop("disabled", false);
2426 $("input[name=superadmin]")
2427 .prop("disabled", false);
2430 $("input[name=superadmin]").change(function() {
2431 if ( $(this).is(":checked")) {
2432 $("select[name=entity]")
2433 .prop("disabled", true);
2435 $("select[name=entity]")
2436 .prop("disabled", false);
2443 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2444 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2448 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2449 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2450 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2451 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2460 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2462 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2463 if ($permissiontoedit) {
2464 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2466 print $arraygender[
$object->gender];
2472 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2473 if ($permissiontoedit) {
2474 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2477 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2486 if ($nbofusers > 1) {
2488 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2490 if ($permissiontoedit) {
2491 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');
2493 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2494 $huser =
new User($db);
2495 $huser->fetch(
$object->fk_user);
2496 print $huser->getNomUrl(-1);
2502 if (isModEnabled(
'expensereport')) {
2503 print
'<tr><td class="titlefieldcreate">';
2504 $text = $langs->trans(
"ForceUserExpenseValidator");
2505 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2508 if ($permissiontoedit) {
2509 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');
2511 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2512 $evuser =
new User($db);
2513 $evuser->fetch(
$object->fk_user_expense_validator);
2514 print $evuser->getNomUrl(-1);
2521 if (isModEnabled(
'holiday')) {
2522 print
'<tr><td class="titlefieldcreate">';
2523 $text = $langs->trans(
"ForceUserHolidayValidator");
2524 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2527 if ($permissiontoedit) {
2528 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');
2530 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2531 $hvuser =
new User($db);
2532 $hvuser->fetch(
$object->fk_user_holiday_validator);
2533 print $hvuser->getNomUrl(-1);
2541 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2543 if ($user->id ==
$object->id || !$user->admin) {
2545 $type = $langs->trans(
"Internal");
2547 $type = $langs->trans(
"External");
2550 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2552 print
' ('.$langs->trans(
"DomainUser").
')';
2561 $eventsCompanyContact = array();
2562 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2564 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2565 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2566 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2567 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2569 print
' ('.$langs->trans(
"DomainUser").
')';
2572 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2573 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2574 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2575 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2577 print
' ('.$langs->trans(
"DomainUser").
')';
2580 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2581 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2582 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2583 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2585 print
' ('.$langs->trans(
"DomainUser").
')';
2588 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2589 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2590 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2591 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2600 print
'<table class="border centpercent">';
2603 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2605 if ($permissiontoedit) {
2606 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2612 if ($permissiontoedit) {
2613 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2621 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2624 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2625 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2627 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2628 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2630 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2631 if ($permissiontoeditpasswordandsee) {
2632 $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">';
2633 if (!empty(
$conf->use_javascript_ajax)) {
2634 $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').
'"');
2637 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2641 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2642 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2644 $valuetoshow = $hookmanager->resPrint;
2646 $valuetoshow .= $hookmanager->resPrint;
2650 print
"</td></tr>\n";
2653 if (isModEnabled(
'api')) {
2654 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2656 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2657 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2658 if (!empty(
$conf->use_javascript_ajax)) {
2659 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2666 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2667 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2669 if ($permissiontoedit) {
2670 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2672 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2678 print
'</table><hr><table class="border centpercent">';
2682 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2684 if ($permissiontoedit) {
2685 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2688 if ($permissiontoedit) {
2689 print
'</textarea>';
2694 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2695 if ($permissiontoedit) {
2696 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2703 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2704 if ($permissiontoedit) {
2705 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2712 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2713 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2714 if ($permissiontoedit) {
2715 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2717 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2721 print $countrylabel;
2727 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2728 if ($permissiontoedit) {
2729 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2730 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2738 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2740 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2741 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2742 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2744 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2750 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2752 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2753 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2754 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2756 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2762 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2764 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2765 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2766 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2768 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2774 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2776 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2777 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2778 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2780 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2785 if (isModEnabled(
'socialnetworks')) {
2786 foreach ($socialnetworks as $key => $value) {
2787 if ($value[
'active']) {
2788 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2790 if (!empty($value[
'icon'])) {
2791 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2793 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2794 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2796 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2797 print
$object->socialnetworks[$key];
2802 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2807 print
'</table><hr><table class="border centpercent">';
2811 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2812 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2813 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>';
2818 if (isModEnabled(
'accounting')) {
2820 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2822 if ($permissiontoedit) {
2823 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2825 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2826 print
$object->accountancy_code;
2833 if (isModEnabled(
'agenda')) {
2834 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2836 if ($permissiontoedit) {
2837 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2839 print $formother->showColor(
$object->color,
'');
2846 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2848 print $form->showphoto(
'userphoto',
$object, 60, 0, $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2853 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2854 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2856 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2857 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
'',
'', 0, 0, 1);
2859 $cats =
$c->containing(
$object->id, Categorie::TYPE_USER);
2860 $arrayselected = array();
2861 foreach ($cats as $cat) {
2862 $arrayselected[] = $cat->id;
2864 if ($permissiontoedit) {
2865 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected, 0, 0,
'', 0,
'90%');
2867 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2874 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";
2875 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2881 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2883 print
$object->getLibStatut(4);
2910 if (isModEnabled(
'member')) {
2911 $langs->load(
"members");
2912 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2916 $adh->fetch(
$object->fk_member);
2917 $adh->ref = $adh->login;
2918 print $adh->getNomUrl(1);
2920 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2928 if (isModEnabled(
'multicompany') && is_object($mc)) {
2930 if (!method_exists($mc,
'formObjectOptions')) {
2931 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2932 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2933 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2934 print
"</td></tr>\n";
2936 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2942 $parameters = array(
'colspan' =>
' colspan="2"');
2944 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2945 print $hookmanager->resPrint;
2946 if (empty($reshook)) {
2947 if ($permissiontoedit) {
2948 print
$object->showOptionals($extrafields,
'edit');
2950 print
$object->showOptionals($extrafields,
'view');
2955 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2957 if ($permissiontoedit) {
2958 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2960 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2961 print $doleditor->Create(1);
2973 print
'<table class="border centpercent">';
2979 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2981 if ($permissiontoedit) {
2982 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2984 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2990 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2992 if ($permissiontoedit) {
2993 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3001 if ((empty($user->socid) && in_array($id, $childids))
3002 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
3003 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
3004 $langs->load(
"salaries");
3007 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3009 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3015 $text = $langs->trans(
"THM");
3016 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3019 if ($permissiontoedit) {
3020 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3029 $text = $langs->trans(
"TJM");
3030 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3033 if ($permissiontoedit) {
3034 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3043 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3045 if ($permissiontoedit) {
3046 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3051 if ($dateemployment && $dateemploymentend) {
3055 if ($permissiontoedit) {
3056 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3064 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3066 if ($permissiontoedit) {
3067 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3078 print
'<div class="center">';
3079 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3080 print
' ';
3081 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3087 if ($action !=
'edit' && $action !=
'presend') {
3088 print
'<div class="fichecenter"><div class="fichehalfleft">';
3093 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3094 $genallowed = $user->hasRight(
"user",
"user",
"read");
3095 $delallowed = $user->hasRight(
"user",
"user",
"write");
3100 $societe->fetch(
$object->socid);
3105 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);
3106 $somethingshown = $formfile->numoffiles;
3109 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3110 $linktoelem = $tmparray[
'linktoelem'];
3111 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3112 print $htmltoenteralink;
3114 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3118 $morehtmlcenter =
'<div class="nowraponall">';
3119 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3120 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3121 $morehtmlcenter .=
'</div>';
3123 print
'</div><div class="fichehalfright">';
3126 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3128 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3130 print
'</div></div>';
3133 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3140include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3142if (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.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage 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_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.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
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.
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, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
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_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
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...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
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.