41require
'../main.inc.php';
53require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/lib/emailsignature.lib.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
64require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
65require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
67 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
70 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
73 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
76 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
80$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
83$action =
GETPOST(
'action',
'aZ09');
84$mode =
GETPOST(
'mode',
'alpha');
85$confirm =
GETPOST(
'confirm',
'alpha');
87$cancel =
GETPOST(
'cancel',
'alpha');
88$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'usercard';
89$backtopage =
GETPOST(
'backtopage');
90$backtopageforcancel =
GETPOST(
'backtopageforcancel');
91$forcepasswordchange =
GETPOSTINT(
'forcepasswordchange');
93if (empty($id) && $action !=
'add' && $action !=
'create') {
103$childids = $user->getAllChildIds(1);
108$extrafields->fetch_name_optionals_label(
$object->table_element);
113$hookmanager->initHooks(array(
'usercard',
'globalcard'));
120 $res =
$object->fetch($id,
'',
'', 1);
125if ($user->socid > 0) {
126 $socid = $user->socid;
132$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
134$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
135$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
136$permissiontoreadgroup = $permissiontoread;
137$permissiontoeditgroup = $permissiontoedit;
139 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
140 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
143$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
144$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
145$permissiontocloneuser = $permissiontoadd;
148 $permissiontoclonesuperadmin =
false;
149 $permissiontocloneadmin =
false;
150 $permissiontocloneuser =
false;
153if ($user->id != $id && !$permissiontoread) {
157$caneditpasswordandsee =
false;
158$caneditpasswordandsend =
false;
161$permissiontoeditpasswordandsee =
false;
162$permissiontoeditpasswordandsend =
false;
165 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
166 $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);
167 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
171$permissiontoseesalary = (empty($user->socid) && (
172 (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
173 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
174 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
177$passwordismodified =
false;
185$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
186$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
188 setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
191if (empty($reshook)) {
192 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
194 if (empty($backtopage) || ($cancel && empty($id))) {
195 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
196 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
197 $backtopage = $backurlforlist;
199 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
205 if (!empty($backtopageforcancel)) {
206 header(
"Location: ".$backtopageforcancel);
208 } elseif (!empty($backtopage)) {
209 header(
"Location: ".$backtopage);
215 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
216 if ($id != $user->id) {
218 if (
$object->admin && empty($user->admin)) {
221 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
224 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
230 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
233 if ($id != $user->id) {
236 if (!empty(
$conf->file->main_limit_users)) {
237 $nb =
$object->getNbOfUsers(
"active");
238 if ($nb >=
$conf->file->main_limit_users) {
240 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
246 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
252 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
253 if ($id != $user->id) {
255 print
'Error, token required for this critical operation';
262 if (
$object->admin && empty($user->admin)) {
265 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
266 } elseif (
$object->admin && empty(
$object->entity) && !empty($user->entity)) {
269 setEventMessages($langs->trans(
"OnlySuperAdminUsersCanDeleteSuperAdminUsers"),
null,
'errors');
273 $result =
$object->delete($user);
275 $langs->load(
"errors");
276 setEventMessages($langs->trans(
"ErrorUserCannotBeDelete"),
$object->errors,
'errors');
278 setEventMessages($langs->trans(
"RecordDeleted"),
null);
279 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
287 if ($action ==
'add' && $permissiontoadd) {
292 setEventMessages($langs->trans(
"NameNotDefined"),
null,
'errors');
297 setEventMessages($langs->trans(
"LoginNotDefined"),
null,
'errors');
301 if (!empty(
$conf->file->main_limit_users)) {
302 $nb =
$object->getNbOfUsers(
"active");
303 if ($nb >=
$conf->file->main_limit_users) {
305 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
315 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
330 $object->socialnetworks = array();
331 foreach ($socialnetworks as $key => $value) {
332 if (
GETPOST($key,
'alphanohtml')) {
338 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
345 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
347 $langs->load(
"errors");
348 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
351 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
360 if ($permissiontoseesalary) {
373 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
375 $object->dateemployment = $dateemployment;
376 $object->dateemploymentend = $dateemploymentend;
377 $object->datestartvalidity = $datestartvalidity;
378 $object->dateendvalidity = $dateendvalidity;
380 $object->force_pass_change = $forcepasswordchange;
387 $ret = $extrafields->setOptionalsFromPost(
null, $object);
397 $cansetentity = (!empty($user->admin) && empty($user->entity));
398 $entity = $cansetentity ?
GETPOSTINT(
'entity') : $user->entity;
400 if ($cansetentity &&
GETPOSTINT(
'superadmin')) {
406 $object->entity = ($entity ==
'' ? 1 : $entity);
410 $object->entity = ($entity ==
'' ? 1 : $entity);
421 if (
GETPOST(
'password',
'password')) {
422 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
424 if (is_int($resPass) && $resPass < 0) {
425 $langs->load(
"errors");
432 $usercats =
GETPOST(
'usercats',
'array:int');
433 $object->setCategories($usercats);
437 if (!empty($backtopage)) {
438 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
440 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
442 header(
"Location: ".$url);
446 $langs->load(
"errors");
455 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
458 $editgroup->fetch($group);
459 $editgroup->oldcopy = clone $editgroup;
463 if ($action ==
'addgroup') {
464 $result =
$object->setInGroup($group, $editgroup->entity);
466 if ($action ==
'removegroup') {
467 $result =
$object->removeFromGroup($group, $editgroup->entity);
478 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
479 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
481 if ($permissiontoedit) {
484 if (!
GETPOST(
"lastname",
'alpha')) {
485 setEventMessages($langs->trans(
"NameNotDefined"),
null,
'errors');
489 if (!
GETPOST(
"login",
'alpha')) {
490 setEventMessages($langs->trans(
"LoginNotDefined"),
null,
'errors');
511 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
514 if ($permissiontoeditpasswordandsee) {
517 if ($permissiontoeditpasswordandsee) {
520 if (!empty($user->admin) && $user->id != $id) {
525 if ($user->admin && !
$object->ldap_sid) {
538 $object->socialnetworks = array();
539 foreach ($socialnetworks as $key => $value) {
540 if (
GETPOST($key,
'alphanohtml')) {
546 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
553 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
555 $langs->load(
"errors");
556 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
559 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
567 if ($permissiontoseesalary) {
580 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
581 $object->dateemployment = $dateemployment;
582 $object->dateemploymentend = $dateemploymentend;
583 $object->datestartvalidity = $datestartvalidity;
584 $object->dateendvalidity = $dateendvalidity;
586 $object->force_pass_change = $forcepasswordchange;
595 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
609 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
617 if (!empty($_FILES[
'photo'][
'name'])) {
621 if (
$object->id == $user->id) {
626 $langs->load(
"errors");
627 setEventMessages($langs->trans(
"ErrorBadImageFormat"),
null,
'errors');
628 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
633 $passwordismodified = 0;
636 $passwordismodified = 1;
643 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
644 $langs->load(
"errors");
645 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
657 if ($contactid > 0) {
659 $contact->fetch($contactid);
661 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
662 $sql .=
" SET fk_socpeople=".((int) $contactid);
663 if (!empty($contact->socid)) {
664 $sql .=
", fk_soc=".((int) $contact->socid);
665 } elseif ($socid > 0) {
666 $sql .=
", fk_soc = null";
667 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
669 $sql .=
" WHERE rowid = ".((int)
$object->id);
670 } elseif ($socid > 0) {
671 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
672 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
673 $sql .=
" WHERE rowid = ".((int)
$object->id);
675 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
676 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
677 $sql .=
" WHERE rowid = ".((int)
$object->id);
680 $resql = $db->query($sql);
683 setEventMessages($db->lasterror(),
null,
'errors');
687 if (!$error && !count(
$object->errors)) {
689 $fileimg =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
692 $dirthumbs =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
696 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
697 $dir =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
704 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
707 if (!is_numeric($result) || $result <= 0) {
708 setEventMessages($langs->trans(
"ErrorFailedToSaveFile"),
null,
'errors');
715 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
724 $langs->load(
"errors");
725 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
730 if (!$error && !count(
$object->errors)) {
732 $categories =
GETPOST(
'usercats',
'array:int');
733 $object->setCategories($categories);
736 if (!$error && !count(
$object->errors)) {
737 setEventMessages($langs->trans(
"UserModified"),
null,
'mesgs');
740 $login = $_SESSION[
"dol_login"];
743 $langs->load(
"errors");
744 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
746 if ($passwordismodified &&
$object->login == $user->login) {
748 $langs->load(
"errors");
749 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
750 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
758 if ($permissiontoeditpasswordandsee) {
759 dol_syslog(
"Not allowed to change fields, only password");
763 if (
GETPOST(
"password",
"password")) {
766 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
767 if (is_int($ret) && $ret < 0) {
776 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
777 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
781 $newpassword =
$object->setPassword($user,
'');
782 if (is_int($newpassword) && $newpassword < 0) {
784 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
787 if ($action ==
'confirm_passwordsend') {
788 if (
$object->send_password($user, $newpassword) > 0) {
789 setEventMessages($langs->trans(
"PasswordChangedAndSentTo",
$object->email),
null,
'mesgs');
794 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
800 if ($action ==
'adduserldap' && $permissiontoadd) {
801 $selecteduser =
GETPOST(
'users');
803 $required_fields = array(
820 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
821 foreach ($arrayofsocialnetworks as $socialnetwork) {
827 $result = $ldap->connectBind();
830 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
835 if (is_array($ldapusers)) {
836 foreach ($ldapusers as $key => $attribute) {
848 $ldap_social = array();
851 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
852 foreach ($arrayofsocialnetworks as $socialnetwork) {
853 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
859 setEventMessages($ldap->error, $ldap->errors,
'errors');
863 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
866 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
868 setEventMessages($langs->trans(
'ErrorNoCloneWithoutName'),
null,
'errors');
870 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
878 $clone->api_key =
'';
879 $clone->admin = ($user->admin ?
$object->admin : 0);
881 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
882 $clone->firstname = $parts[0];
883 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
885 $clone->login = substr($parts[0], 0, 1).$parts[1];
888 $clone->context[
'createfromclone'] =
'createfromclone';
889 $id = $clone->create($user);
890 $refalreadyexists = 0;
893 $result = $clone->cloneRights(
$object->id, $id);
896 if (
GETPOST(
'clone_categories')) {
897 $result = $clone->cloneCategories(
$object->id, $id);
899 setEventMessages($langs->trans(
'ErrorUserClone'),
null,
'errors');
900 setEventMessages($clone->error, $clone->errors,
'errors');
905 if ($clone->error ==
'ErrorProductAlreadyExists') {
909 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
910 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
911 setEventMessages($mesg,
null,
'errors');
913 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
917 unset($clone->context[
'createfromclone']);
924 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
935 $triggersendname =
'USER_SENTBYMAIL';
937 $mode =
'emailfromuser';
938 $trackid =
'use'.$id;
939 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
942 $upload_dir =
$conf->user->dir_output;
943 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
946 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
954$form =
new Form($db);
966$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
967$resql = $db->query($sql);
969 $obj = $db->fetch_object($resql);
971 $nbofusers = $obj->nb;
974 dol_print_error($db);
979 $title = $person_name.
" - ".$langs->trans(
'Card');
982 $title = $langs->trans(
"NewEmployee");
984 $title = $langs->trans(
"NewUser");
990llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
992if ($action ==
'create' || $action ==
'adduserldap') {
995 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
1004 $result = $ldap->connectBind();
1006 $required_fields = array(
1026 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1031 if (is_array($ldapusers)) {
1032 foreach ($ldapusers as $key => $ldapuser) {
1035 foreach ($required_fields as $value) {
1037 $label .= $value.
"=******* ";
1039 $label .= $value.
"=".$ldapuser[$value].
" ";
1042 $liste[$key] = $label;
1045 setEventMessages($ldap->error, $ldap->errors,
'errors');
1048 setEventMessages($ldap->error, $ldap->errors,
'errors');
1052 print
"\n\n<!-- Form liste LDAP debut -->\n";
1054 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1055 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1056 print
'<table class="border centpercent"><tr>';
1057 print
'<td width="160">';
1058 print $langs->trans(
"LDAPUsers");
1061 print
'<input type="hidden" name="action" value="adduserldap">';
1062 if (is_array($liste) && count($liste)) {
1063 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1066 print
'</td><td class="center">';
1067 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1068 print
'</td></tr></table>';
1071 print
"\n<!-- Form liste LDAP fin -->\n\n";
1076 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1077 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1078 print
'<input type="hidden" name="action" value="add">';
1079 if (!empty($backtopage)) {
1080 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1082 if (!empty($backtopageforcancel)) {
1083 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1085 if (!empty($ldap_sid)) {
1086 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1088 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1094 print
'<table class="border centpercent">';
1098 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1099 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1105 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1107 if (!empty($ldap_lastname)) {
1108 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1109 print $ldap_lastname;
1111 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1116 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1118 if (!empty($ldap_firstname)) {
1119 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1120 print $ldap_firstname;
1122 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1127 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1129 if (!empty($ldap_login)) {
1130 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1132 } elseif (!empty($ldap_loginsmb)) {
1133 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1134 print $ldap_loginsmb;
1136 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1140 if (!empty(
$conf->use_javascript_ajax)) {
1144 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1145 if ($charforseparator ==
'none') {
1146 $charforseparator =
'';
1149 jQuery(document).ready(function() {
1150 $(".createloginauto").on("keyup", function() {
1151 console.log(".createloginauto change: We generate login when we have a lastname");
1153 lastname = $("#lastname").val().toLowerCase();
1156 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1157 $charforseparator =
'';
1159 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1161 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1167 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1169 login += lastname.replace(/\s+/g, \
'\').trim();
1171 $(
"#login").val(login);
1177 $generated_password = '';
1178 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1179 $generated_password = getRandomPassword(false);
1181 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1184 if (!empty($user->admin)) {
1185 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1187 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1189 if (isModEnabled('multicompany
') && !$user->entity) {
1190 if (!empty($conf->use_javascript_ajax)) {
1191 print '<script
type=
"text/javascript">
1193 $(
"select[name=admin]").change(
function() {
1194 if ( $(
this).val() == 0 ) {
1195 $(
"input[name=superadmin]")
1196 .prop(
"disabled",
true)
1197 .prop(
"checked",
false);
1198 $(
"select[name=entity]")
1199 .prop(
"disabled",
false);
1201 $(
"input[name=superadmin]")
1202 .prop(
"disabled",
false);
1205 $(
"input[name=superadmin]").change(
function() {
1206 if ( $(
this).is(
":checked") ) {
1207 $(
"select[name=entity]")
1208 .prop(
"disabled",
true);
1210 $(
"select[name=entity]")
1211 .prop(
"disabled",
false);
1217 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1218 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1219 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1221 print "</td></tr>\n";
1225 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1227 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1228 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1232 $defaultemployee = '1
';
1234 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1235 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1236 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1240 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1242 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user, 'fk_user
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1246 // Expense report validator
1247 if (isModEnabled('expensereport
')) {
1248 print '<tr><td
class=
"titlefieldcreate">
';
1249 $text = $langs->trans("ForceUserExpenseValidator");
1250 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1253 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1258 // Holiday request validator
1259 if (isModEnabled('holiday
')) {
1260 print '<tr><td
class=
"titlefieldcreate">
';
1261 $text = $langs->trans("ForceUserHolidayValidator");
1262 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1265 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1271 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1273 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1277 print '</
table><hr><
table class=
"border centpercent">
';
1281 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1283 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1287 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1292 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1295 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1296 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1298 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1299 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1301 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1302 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1303 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1304 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1307 $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" spellcheck="false">';
1308 if (!empty(
$conf->use_javascript_ajax)) {
1309 $valuetoshow .= img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1314 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1315 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1317 $valuetoshow = $hookmanager->resPrint;
1319 $valuetoshow .= $hookmanager->resPrint;
1326 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
1327 print
'<tr><td class="titlefieldcreate"></td>';
1330 $permissiontoselfeditpassword = 1;
1331 if ($permissiontoselfeditpassword) {
1332 print
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.(GETPOST(
'forcepasswordchange') ==
'1' ?
' checked="checked"' :
'').
'>';
1333 print
'<label class="opacitymedium" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
1335 print
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey valignmiddle" disabled>';
1336 print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"ForcePasswordChange").
'</span>', $langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword"));
1346 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1348 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" spellcheck="false">';
1349 if (!empty(
$conf->use_javascript_ajax)) {
1350 print img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1356 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1360 print
'</table><hr><table class="border centpercent">';
1364 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1365 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1367 print
'</textarea></td></tr>';
1370 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1371 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1375 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1376 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1380 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1381 print img_picto(
'',
'country',
'class="pictofixedwidth"');
1382 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1384 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1390 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1391 print img_picto(
'',
'state',
'class="pictofixedwidth"');
1392 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1397 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1399 if (!empty($ldap_phone)) {
1400 print img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1401 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1404 print $form->showPhoneInput(
$object->office_phone,
'office_phone',
$object->country_id,
'object_phoning',
'maxwidth200 widthcentpercentminusx');
1409 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1411 if (!empty($ldap_mobile)) {
1412 print img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1413 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1416 print $form->showPhoneInput(
$object->user_mobile,
'user_mobile',
$object->country_id,
'object_phoning_mobile',
'maxwidth200 widthcentpercentminusx');
1421 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1423 if (!empty($ldap_fax)) {
1424 print img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1425 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1428 print $form->showPhoneInput(
$object->office_fax,
'office_fax',
$object->country_id,
'object_phoning_fax',
'maxwidth200 widthcentpercentminusx');
1433 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1435 print img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1436 if (!empty($ldap_mail)) {
1437 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1440 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1446 foreach ($socialnetworks as $key => $value) {
1447 if ($value[
'active']) {
1448 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1450 if (!empty($value[
'icon'])) {
1451 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1453 if (!empty($ldap_social[$key])) {
1454 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1455 print $ldap_social[$key];
1457 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1462 if (!empty($ldap_social[$key])) {
1463 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1465 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1473 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1475 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1481 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1483 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1488 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1489 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1490 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1496 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1497 print
'<td class="maxwidthonsmartphone">'.
"\n";
1498 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');
1504 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1506 if (!method_exists($mc,
'formObjectOptions')) {
1507 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1508 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1509 print
"<td>".$mc->select_entities(
$conf->entity);
1510 print
"</td></tr>\n";
1512 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1518 $parameters = array();
1519 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1522 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1523 print
'<td class="wordbreak">';
1524 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1526 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1527 print $doleditor->Create(1);
1531 print
'<tr><td class="tdtop">';
1532 print $langs->trans(
"NotePublic");
1534 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1535 $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%');
1536 $doleditor->Create();
1537 print
"</td></tr>\n";
1540 print
'<tr><td class="tdtop">';
1541 print $langs->trans(
"NotePrivate");
1543 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1544 $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%');
1545 $doleditor->Create();
1546 print
"</td></tr>\n";
1548 print
'</table><hr><table class="border centpercent">';
1555 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1556 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1561 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1563 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1566 if ($permissiontoseesalary) {
1567 $langs->load(
"salaries");
1571 $text = $langs->trans(
"THM");
1572 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1575 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1581 $text = $langs->trans(
"TJM");
1582 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1585 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1590 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1592 print img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1598 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1600 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1605 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1607 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1611 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1616 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1618 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1626 print $form->buttonsSaveCancel(
"CreateUser");
1632 $res =
$object->fetch($id,
'',
'', 1);
1636 $res =
$object->fetch_optionals();
1642 setEventMessages($langs->trans(
'UserHasNoPermissions'),
null,
'warnings');
1646 $passDoNotExpire = 0;
1648 $userChangePassNextLogon = 0;
1654 $result = $ldap->connectBind();
1656 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1657 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1659 setEventMessages($ldap->error, $ldap->errors,
'errors');
1663 if (count($ldap->uacf) > 0) {
1664 foreach ($ldap->uacf as $key => $statut) {
1665 if ($key == 65536) {
1666 $passDoNotExpire = 1;
1667 $statutUACF = $statut;
1672 $statutUACF =
"ACCOUNTDISABLE";
1675 if ($ldap->pwdlastset == 0) {
1676 $userChangePassNextLogon = 1;
1682 if ($mode ==
'employee') {
1683 $title = $langs->trans(
"Employee");
1684 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1686 $title = $langs->trans(
"User");
1689 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1690 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1697 if ($action ==
'password') {
1698 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1702 if ($action ==
'passwordsend') {
1703 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1707 if ($action ==
'disable') {
1708 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1712 if ($action ==
'enable') {
1713 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1717 if ($action ==
'delete') {
1718 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1722 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1723 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1725 $formquestionclone = array(
1726 'text' => $langs->trans(
"ConfirmClone"),
1727 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1728 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1729 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1732 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1733 array_splice($formquestionclone, 2, 0, array($newElement));
1735 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);
1740 if ($action !=
'edit') {
1741 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1743 $morehtmlref =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/vcard.php', [
'id' =>
$object->id,
'output' =>
'file',
'file' =>
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')]).
'" class="refid valignmiddle" tabindex="-1" rel="noopener">';
1744 $morehtmlref .= img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1745 $morehtmlref .=
'</a>';
1747 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1748 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs), img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1750 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1752 print
'<div class="fichecenter">';
1753 print
'<div class="fichehalfleft">';
1755 print
'<div class="underbanner clearboth"></div>';
1756 print
'<table class="border tableforfield centpercent">';
1759 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1760 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1761 print
'<td class="error">';
1762 print $langs->trans(
"LoginAccountDisableInDolibarr");
1768 $addadmin .= img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1769 } elseif (!empty(
$object->admin)) {
1770 $addadmin .= img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1779 $text = $langs->trans(
"Type");
1780 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1782 $type = $langs->trans(
"Internal");
1784 $type = $langs->trans(
"External");
1786 print
'<span class="badgeneutral">';
1789 print
' ('.$langs->trans(
"DomainUser").
')';
1792 print
'</td></tr>'.
"\n";
1795 if (
$object->ldap_sid && is_object($ldap)) {
1796 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1797 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1798 print
'</td></tr>'.
"\n";
1802 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1804 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1808 print
'</td></tr>'.
"\n";
1811 if ($nbofusers > 1) {
1813 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1815 if (empty(
$object->fk_user)) {
1816 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1818 $huser =
new User($db);
1820 $huser->fetch(
$object->fk_user);
1821 print $huser->getNomUrl(-1);
1823 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1832 $text = $langs->trans(
"ForceUserExpenseValidator");
1833 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1836 if (!empty(
$object->fk_user_expense_validator)) {
1837 $evuser =
new User($db);
1838 $evuser->fetch(
$object->fk_user_expense_validator);
1839 print $evuser->getNomUrl(-1);
1848 $text = $langs->trans(
"ForceUserHolidayValidator");
1849 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1852 if (!empty(
$object->fk_user_holiday_validator)) {
1853 $hvuser =
new User($db);
1854 $hvuser->fetch(
$object->fk_user_holiday_validator);
1855 print $hvuser->getNomUrl(-1);
1863 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1864 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1868 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1875 if ($permissiontoseesalary) {
1876 $langs->load(
"salaries");
1879 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1881 print(
$object->salary !=
'' ? img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1887 $text = $langs->trans(
"THM");
1888 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1891 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1897 $text = $langs->trans(
"TJM");
1898 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1901 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1907 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1909 if (
$object->dateemployment) {
1910 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1913 if (
$object->dateemploymentend) {
1914 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1921 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1929 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1930 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1931 if (
$object->fk_warehouse > 0) {
1932 $warehousestatic =
new Entrepot($db);
1933 $warehousestatic->fetch(
$object->fk_warehouse);
1934 print $warehousestatic->getNomUrl(1);
1942 print
'<div class="fichehalfright">';
1944 print
'<div class="underbanner clearboth"></div>';
1946 print
'<table class="border tableforfield centpercent">';
1950 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1952 print $formother->showColor(
$object->color,
'');
1958 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1959 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1961 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1967 $langs->load(
"languages");
1968 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1970 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1974 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1980 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1981 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1982 print
'<td>'.$object->openid.
'</td>';
1987 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1989 if (!method_exists($mc,
'formObjectOptions')) {
1991 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1993 print $langs->trans(
"AllEntities");
1995 $mc->getInfo(
$object->entity);
1998 print
"</td></tr>\n";
2004 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2008 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2013 $societe->fetch(
$object->socid);
2014 if ($societe->id > 0) {
2015 $s .= $societe->getNomUrl(1,
'');
2018 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2020 if (!empty(
$object->contact_id)) {
2022 $contact->fetch(
$object->contact_id);
2023 if ($contact->id > 0) {
2024 if (
$object->socid > 0 && $s) {
2029 $s .= $contact->getNomUrl(1,
'');
2039 $langs->load(
"members");
2040 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2044 $adh->fetch(
$object->fk_member);
2045 $adh->ref = $adh->getFullname($langs);
2046 print $adh->getNomUrl(-1);
2048 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2055 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2057 if (!empty(
$object->signature)) {
2060 print
"</td></tr>\n";
2071 print
'<!-- credential section -->'.
"\n";
2072 print
'<div class="div-table-responsive-no-min">';
2073 print
'<table class="noborder tableforfield centpercent">';
2076 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2077 print
'<div class="centpercent display-flex">';
2078 print
'<div class="left inline-block">';
2079 print img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2086 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2088 if (
$object->datestartvalidity) {
2089 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2092 if (
$object->dateendvalidity) {
2093 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2100 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2101 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"PasswordToChange"), $langs->trans(
"ForcePasswordChange")).
'</td>';
2103 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2104 if ($permissiontoselfeditpassword) {
2106 print
'<input type="checkbox" class="colorgrey" disabled name="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2108 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2110 print yn(
$object->force_pass_change);
2111 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2114 print
'<input type="checkbox" name="forcepasswordchange" value="1" disabled class="valignmiddle">';
2115 print
'<span class="opacitymedium" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"No").
'</span>';
2123 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2124 if (!empty(
$object->ldap_sid)) {
2125 if ($passDoNotExpire) {
2126 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2127 } elseif ($userChangePassNextLogon) {
2128 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2129 } elseif ($userDisabled) {
2130 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2132 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2135 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2138 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2139 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2143 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2144 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2146 $valuetoshow = $hookmanager->resPrint;
2148 $valuetoshow .= $hookmanager->resPrint;
2152 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2153 print
'<td class="wordbreak">';
2162 if ((
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') || $totpenrollment !==
null) && $permissiontoeditpasswordandsee) {
2163 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2165 print
'<div class="centpercent display-flex">';
2166 if ($totpenrollment !==
null) {
2167 print
'<span class="badge badge-status4 badge-status">'.$langs->trans(
"Enabled").
'</span>';
2168 if (!is_array($totpenrollment)) {
2169 print
' '.img_warning($langs->trans(
"TOTPUnreadableEnrollment"));
2172 print
'<span class="opacitymedium">'.$langs->trans(
"Disabled").
'</span>';
2174 print
'<div class="left inline-block">';
2175 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2177 print
'</div></div>';
2182 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2183 foreach ($tmparrayofauthmode as $tmpauthmode) {
2184 $langs->load(
"oauth");
2186 $tmpauthmode = trim($tmpauthmode);
2187 if (preg_match(
'/oauth/', $tmpauthmode)) {
2188 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2189 print
'<tr class="nooddeven">';
2190 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2191 print
' '.ucfirst($nameofservice).
' ';
2194 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2195 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2203 if (!empty(
$object->email_oauth2)) {
2204 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2214 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin)) {
2215 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2218 print
'<div class="centpercent display-flex">';
2219 print
'<span class="badge badge-info marginleftonly marginrightonly">0</span>';
2223 print
'<div class="left inline-block">';
2224 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2229 if (!empty(
$object->api_key)) {
2230 print
'<span class="opacitymedium marginrightonly">';
2235 print
'<span class="badge badge-info marginleftonly marginrightonly" title="'.$langs->trans(
"TotalAPICall").
'">';
2245 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2247 if (
$object->datepreviouslogin) {
2248 print $form->textwithpicto(
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Previous"));
2251 if (
$object->datepreviouslogin) {
2252 print
' ';
2254 print $form->textwithpicto(
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Currently"));
2264 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2265 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2267 print $hookmanager->resPrint;
2273 print
'<div class="clearboth"></div>';
2282 print
'<div class="tabsAction">';
2284 $parameters = array();
2285 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2286 if (empty($reshook)) {
2290 'class' =>
'classfortooltip'
2294 if (empty($user->socid)) {
2295 $canSendMail =
false;
2297 $langs->load(
"mails");
2298 $canSendMail =
true;
2299 unset($params[
'attr'][
'title']);
2301 $langs->load(
"mails");
2302 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2304 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2309 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2310 print dolGetButtonAction($langs->trans(
'Modify'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF']).
'#',
'',
false, $params);
2312 unset($params[
'attr'][
'title']);
2313 print dolGetButtonAction($langs->trans(
'Modify'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'edit'],
true),
'',
true, $params);
2315 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2317 unset($params[
'attr'][
'title']);
2318 print dolGetButtonAction($langs->trans(
'Modify'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'edit'],
true),
'',
true, $params);
2325 'class' =>
'classfortooltip'
2330 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2331 $cloneButtonId =
'';
2332 $cloneUserUrl = $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=clone&token='.
newToken();
2334 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2335 $cloneButtonId =
'action-clone';
2337 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'), array(
'attr' => array(
'class' =>
'reposition')));
2341 if (
$object->status == $object::STATUS_DISABLED) {
2342 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2343 print dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF']).
'#',
'',
false, $params);
2344 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2346 unset($params[
'attr'][
'title']);
2347 print dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'password'],
true),
'',
true, $params);
2350 if (
$object->status == $object::STATUS_DISABLED) {
2351 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2352 print dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2353 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2356 unset($params[
'attr'][
'title']);
2357 print dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'passwordsend'],
true),
'',
true, $params);
2359 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2360 print dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2365 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2367 unset($params[
'attr'][
'title']);
2368 print dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'enable'],
true),
'',
true, $params);
2371 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2373 unset($params[
'attr'][
'title']);
2374 print dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'disable'],
true),
'',
true, $params);
2376 if ($user->id == $id) {
2377 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2378 print dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2382 if ($user->id != $id && $permissiontodisable &&
2384 if ($user->admin || !
$object->admin) {
2385 unset($params[
'attr'][
'title']);
2386 print dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'delete',
'id' =>
$object->id],
true),
'',
true, array(
'attr' => array(
'class' =>
'reposition')));
2388 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2389 print dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'delete',
'id' =>
$object->id],
true),
'',
false, array(
'attr' => array(
'class' =>
'reposition')));
2399 if (
GETPOST(
'modelselected')) {
2400 $action =
'presend';
2404 $modelmail =
'user';
2405 $defaulttopic =
'Information';
2406 $diroutput =
$conf->user->dir_output;
2407 $trackid =
'use'.$object->id;
2409 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2411 if ($action !=
'presend' && $action !=
'send') {
2416 if ($permissiontoreadgroup) {
2417 print
'<!-- Group section -->'.
"\n";
2425 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2427 if (!empty($groupslist)) {
2428 foreach ($groupslist as $groupforuser) {
2429 $exclude[] = $groupforuser->id;
2434 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2435 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2436 print $hookmanager->resPrint;
2438 if (empty($reshook)) {
2439 if ($permissiontoeditgroup) {
2440 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2441 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2442 print
'<input type="hidden" name="action" value="addgroup" />';
2443 print
'<input type="hidden" name="page_y" value="" />';
2446 print
'<!-- List of groups of the user -->'.
"\n";
2447 print
'<table class="noborder centpercent">'.
"\n";
2448 print
'<tr class="liste_titre">';
2450 print
'<th class="liste_titre right" colspan="2">';
2451 if ($permissiontoeditgroup) {
2452 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2454 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2455 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2457 print
'</th></tr>'.
"\n";
2460 if (!empty($groupslist)) {
2461 foreach ($groupslist as $group) {
2462 print
'<tr class="oddeven">';
2463 print
'<td class="tdoverflowmax200">';
2464 if ($permissiontoeditgroup) {
2465 print $group->getNomUrl(1);
2467 print img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2470 print
'<td class="right">';
2471 if ($permissiontoeditgroup) {
2472 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2473 print img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2478 print
"</td></tr>\n";
2481 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2486 if ($permissiontoeditgroup) {
2498 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2499 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2500 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2501 print
'<input type="hidden" name="action" value="update">';
2502 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2506 print
'<table class="border centpercent">';
2510 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2519 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2521 if ($permissiontoedit && !
$object->ldap_sid) {
2522 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2524 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2531 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2533 if ($permissiontoedit && !
$object->ldap_sid) {
2534 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2536 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2542 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2544 if ($user->admin && !
$object->ldap_sid) {
2545 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2547 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2554 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2556 if ($user->id ==
$object->id || !$user->admin) {
2558 $type = $langs->trans(
"Internal");
2560 $type = $langs->trans(
"External");
2563 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2565 print
' ('.$langs->trans(
"DomainUser").
')';
2574 $eventsCompanyContact = array();
2575 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2577 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2578 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2579 print
'<span class="clearbothonsmartphone"></span>';
2580 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2581 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2583 print
' ('.$langs->trans(
"DomainUser").
')';
2586 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2587 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2588 print
'<span class="clearbothonsmartphone"></span>';
2589 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2590 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2592 print
' ('.$langs->trans(
"DomainUser").
')';
2595 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2596 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2597 print
'<span class="clearbothonsmartphone"></span>';
2598 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2599 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2601 print
' ('.$langs->trans(
"DomainUser").
')';
2604 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2605 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2606 print
'<span class="clearbothonsmartphone"></span>';
2607 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2608 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2614 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2616 $langs->load(
"admin");
2618 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.yn(
$object->admin);
2619 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2623 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2624 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2629 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2632 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2635 if (
$conf->use_javascript_ajax) {
2636 print
'<script type="text/javascript">
2638 var admin = $("select[name=admin]").val();
2640 $("input[name=superadmin]")
2641 .prop("disabled", true)
2642 .prop("checked", false);
2644 if ($("input[name=superadmin]").is(":checked")) {
2645 $("select[name=entity]")
2646 .prop("disabled", true);
2648 $("select[name=admin]").change(function() {
2649 if ( $(this).val() == 0 ) {
2650 $("input[name=superadmin]")
2651 .prop("disabled", true)
2652 .prop("checked", false);
2653 $("select[name=entity]")
2654 .prop("disabled", false);
2656 $("input[name=superadmin]")
2657 .prop("disabled", false);
2660 $("input[name=superadmin]").change(function() {
2661 if ( $(this).is(":checked")) {
2662 $("select[name=entity]")
2663 .prop("disabled", true);
2665 $("select[name=entity]")
2666 .prop("disabled", false);
2673 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2674 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2678 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2679 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2681 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2691 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2692 if ($permissiontoedit && !
$object->ldap_sid) {
2693 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2694 } elseif (
$object->civility_code) {
2695 print $langs->trans(
"Civility".
$object->civility_code);
2701 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2703 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2704 if ($permissiontoedit) {
2707 print $arraygender[
$object->gender];
2713 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2714 if ($permissiontoedit) {
2715 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2718 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2727 if ($nbofusers > 1) {
2729 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2731 if ($permissiontoedit) {
2732 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
GETPOSTISSET(
'fk_user') ?
GETPOSTINT(
'fk_user') :
$object->fk_user,
'fk_user', 1, array(
$object->id), 0,
'',
'', (string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2734 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2735 $huser =
new User($db);
2736 $huser->fetch(
$object->fk_user);
2737 print $huser->getNomUrl(-1);
2744 print
'<tr><td class="titlefieldcreate">';
2745 $text = $langs->trans(
"ForceUserExpenseValidator");
2746 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2749 if ($permissiontoedit) {
2750 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array(
$object->id), 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2752 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2753 $evuser =
new User($db);
2754 $evuser->fetch(
$object->fk_user_expense_validator);
2755 print $evuser->getNomUrl(-1);
2763 print
'<tr><td class="titlefieldcreate">';
2764 $text = $langs->trans(
"ForceUserHolidayValidator");
2765 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2768 if ($permissiontoedit) {
2769 print img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array(
$object->id), 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2771 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2772 $hvuser =
new User($db);
2773 $hvuser->fetch(
$object->fk_user_holiday_validator);
2774 print $hvuser->getNomUrl(-1);
2787 print
'<table class="border centpercent">';
2790 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2792 if ($permissiontoedit) {
2793 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2799 if ($permissiontoedit) {
2800 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2809 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2810 if ($permissiontoselfeditpassword) {
2811 if ($permissiontoedit) {
2812 $sforcepass .=
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2813 $sforcepass .=
'<label class="opacitylow small" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
2815 $sforcepass .=
'<input type="checkbox" name="forcepasswordchange" class="colorgrey" disabled value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2816 $sforcepass .=
'<span class="small">'.$langs->trans(
"ForcePasswordChange").
'</small>';
2819 $sforcepass .=
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey" disabled>';
2820 $sforcepass .=
'<span class="opacitymedium small" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"ForcePasswordChange").
'</span>';
2824 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2827 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2828 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2830 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2831 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2833 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2834 if ($permissiontoeditpasswordandsee) {
2835 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="minwidth300 maxwidth400 widthcentpercentminusx" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password" spellcheck="false">';
2836 if (!empty(
$conf->use_javascript_ajax)) {
2837 $valuetoshow .= img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->transnoentities(
'NoPasswordGenerationRuleConfigured') : $langs->transnoentities(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' ' :
' linkobject').
'"');
2840 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2844 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2845 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2847 $valuetoshow = $hookmanager->resPrint;
2849 $valuetoshow .= $hookmanager->resPrint;
2857 print
"</td></tr>\n";
2860 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2861 print
'<tr class="valigntop">';
2862 if (
$conf->dol_optimize_smallscreen) {
2863 print
'<td colspan="2">';
2875 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2877 if ($permissiontoeditpasswordandsee) {
2878 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off" spellcheck="false">';
2879 if (!empty(
$conf->use_javascript_ajax)) {
2880 print img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2888 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2889 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2891 if ($permissiontoedit) {
2892 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2894 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2906 print
'<table class="border centpercent">';
2909 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2911 if ($permissiontoedit) {
2912 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2915 if ($permissiontoedit) {
2916 print
'</textarea>';
2921 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2922 if ($permissiontoedit) {
2923 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2930 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2931 if ($permissiontoedit) {
2932 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2939 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2940 print img_picto(
'',
'country',
'class="pictofixedwidth"');
2941 if ($permissiontoedit) {
2942 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2944 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2948 print $countrylabel;
2954 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2955 if ($permissiontoedit) {
2956 print img_picto(
'',
'state',
'class="pictofixedwidth"');
2957 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2965 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2967 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2968 print $form->showPhoneInput(
$object->office_phone,
'office_phone',
$object->country_id,
'phoning',
'maxwidth200 widthcentpercentminusx');
2970 print img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2971 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2977 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2979 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2980 print $form->showPhoneInput(
$object->user_mobile,
'user_mobile',
$object->country_id,
'phoning_mobile',
'maxwidth200 widthcentpercentminusx');
2982 print img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2983 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2989 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2991 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2992 print $form->showPhoneInput(
$object->office_fax,
'office_fax',
$object->country_id,
'phoning_fax',
'maxwidth200 widthcentpercentminusx');
2994 print img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2995 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
3001 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
3003 print img_picto(
'',
'object_email',
'class="pictofixedwidth"');
3004 if ($permissiontoedit && empty(
$object->ldap_sid)) {
3005 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
3007 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
3013 foreach ($socialnetworks as $key => $value) {
3014 if ($value[
'active']) {
3015 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
3017 if (!empty($value[
'icon'])) {
3018 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
3020 if ($permissiontoedit && empty(
$object->ldap_sid)) {
3021 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
3023 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
3024 print
$object->socialnetworks[$key];
3029 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
3040 print
'<table class="border centpercent">';
3043 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
3044 print $formproduct->selectWarehouses(
$object->warehouse_id,
'fk_warehouse',
'warehouseopen', 1);
3045 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>';
3052 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
3054 if ($permissiontoedit) {
3055 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3057 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3058 print
$object->accountancy_code;
3066 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
3068 if ($permissiontoedit) {
3069 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
3071 print $formother->showColor(
$object->color,
'');
3078 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
3080 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
3085 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
3086 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
3088 if ($permissiontoedit) {
3089 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
3091 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
3098 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";
3099 print img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
3105 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
3107 print
$object->getLibStatut(4);
3135 $langs->load(
"members");
3136 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3140 $adh->fetch(
$object->fk_member);
3141 $adh->ref = $adh->login;
3142 print $adh->getNomUrl(1);
3144 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3152 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
3154 if (!method_exists($mc,
'formObjectOptions')) {
3155 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
3156 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3157 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3158 print
"</td></tr>\n";
3160 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3166 $parameters = array(
'colspan' =>
' colspan="2"');
3168 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3169 print $hookmanager->resPrint;
3170 if (empty($reshook)) {
3171 if ($permissiontoedit) {
3172 print
$object->showOptionals($extrafields,
'edit');
3174 print
$object->showOptionals($extrafields,
'view');
3179 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3181 if ($permissiontoedit) {
3182 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3184 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3185 print $doleditor->Create(1);
3188 if (!empty(
$object->signature)) {
3200 print
'<table class="border centpercent">';
3206 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3208 if ($permissiontoedit) {
3209 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3211 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3217 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3219 if ($permissiontoedit) {
3220 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3228 if ($permissiontoseesalary) {
3229 $langs->load(
"salaries");
3232 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3234 print img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3235 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3241 $text = $langs->trans(
"THM");
3242 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3245 if ($permissiontoedit) {
3246 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3247 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3256 $text = $langs->trans(
"TJM");
3257 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3260 if ($permissiontoedit) {
3261 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3262 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3271 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3273 if ($permissiontoedit) {
3274 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3279 if ($dateemployment && $dateemploymentend) {
3283 if ($permissiontoedit) {
3284 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3292 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3294 if ($permissiontoedit) {
3295 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3306 print
'<div class="center">';
3307 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3308 print
' ';
3309 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3315 if ($action !=
'edit' && $action !=
'presend') {
3316 print
'<div class="fichecenter"><div class="fichehalfleft">';
3321 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3322 $genallowed = $user->hasRight(
"user",
"user",
"read");
3323 $delallowed = $user->hasRight(
"user",
"user",
"write");
3328 $societe->fetch(
$object->socid);
3333 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'',
'',
'', !is_object($societe) || empty($societe->default_lang) ?
'' : $societe->default_lang);
3334 $somethingshown = $formfile->numoffiles;
3338 $morehtmlcenter =
'<div class="nowraponall">';
3339 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3340 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3341 $morehtmlcenter .=
'</div>';
3343 print
'</div><div class="fichehalfright">';
3346 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3348 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3350 print
'</div></div>';
3360include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
$propal type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='', $placeholder='')
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage members of a foundation.
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.
dolGetSignatureQualityBadge($html, $outputlangs=null)
Build a ready to print HTML badge summarising the quality of an email signature, with a collapsible l...
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.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
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)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
recordNotFound($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Displays an error page when a record is not found.
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...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=2, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
price2num($amount, $rounding='', $option=0, $currencycode='')
Function that return a number with universal decimal format (decimal separator is '.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
currentToken()
Return the value of token currently saved into session with name 'token'.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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)
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).
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_set_focus($selector, $nooutput=0)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
$conf db user
Active Directory does not allow anonymous connections.
$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.
dolTotpGetEnrollment($db, $fk_user)
Load the TOTP enrollment of a user.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
treeview li table
No Email.
div refaddress div address
user_prepare_head(User $object)
Prepare array with list of tabs.