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"),
null,
'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);
401 $object->entity = ($entity ==
'' ? 1 : $entity);
405 $object->entity = ($entity ==
'' ? 1 : $entity);
416 if (
GETPOST(
'password',
'password')) {
417 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
419 if (is_int($resPass) && $resPass < 0) {
420 $langs->load(
"errors");
427 $usercats =
GETPOST(
'usercats',
'array:int');
428 $object->setCategories($usercats);
432 if (!empty($backtopage)) {
433 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
435 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
437 header(
"Location: ".$url);
441 $langs->load(
"errors");
450 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
453 $editgroup->fetch($group);
454 $editgroup->oldcopy = clone $editgroup;
458 if ($action ==
'addgroup') {
459 $result =
$object->SetInGroup($group, $editgroup->entity);
461 if ($action ==
'removegroup') {
462 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
473 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
474 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
476 if ($permissiontoedit) {
479 if (!
GETPOST(
"lastname",
'alpha')) {
480 setEventMessages($langs->trans(
"NameNotDefined"),
null,
'errors');
484 if (!
GETPOST(
"login",
'alpha')) {
485 setEventMessages($langs->trans(
"LoginNotDefined"),
null,
'errors');
506 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
509 if ($permissiontoeditpasswordandsee) {
512 if ($permissiontoeditpasswordandsee) {
515 if (!empty($user->admin) && $user->id != $id) {
520 if ($user->admin && !
$object->ldap_sid) {
533 $object->socialnetworks = array();
534 foreach ($socialnetworks as $key => $value) {
535 if (
GETPOST($key,
'alphanohtml')) {
541 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
548 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
550 $langs->load(
"errors");
551 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
554 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
562 if ($permissiontoseesalary) {
575 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
576 $object->dateemployment = $dateemployment;
577 $object->dateemploymentend = $dateemploymentend;
578 $object->datestartvalidity = $datestartvalidity;
579 $object->dateendvalidity = $dateendvalidity;
581 $object->force_pass_change = $forcepasswordchange;
590 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
604 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
612 if (!empty($_FILES[
'photo'][
'name'])) {
616 if (
$object->id == $user->id) {
621 $langs->load(
"errors");
622 setEventMessages($langs->trans(
"ErrorBadImageFormat"),
null,
'errors');
623 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
628 $passwordismodified = 0;
631 $passwordismodified = 1;
638 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
639 $langs->load(
"errors");
640 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
652 if ($contactid > 0) {
654 $contact->fetch($contactid);
656 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
657 $sql .=
" SET fk_socpeople=".((int) $contactid);
658 if (!empty($contact->socid)) {
659 $sql .=
", fk_soc=".((int) $contact->socid);
660 } elseif ($socid > 0) {
661 $sql .=
", fk_soc = null";
662 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
664 $sql .=
" WHERE rowid = ".((int)
$object->id);
665 } elseif ($socid > 0) {
666 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
667 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
668 $sql .=
" WHERE rowid = ".((int)
$object->id);
670 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
671 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
672 $sql .=
" WHERE rowid = ".((int)
$object->id);
675 $resql = $db->query($sql);
678 setEventMessages($db->lasterror(),
null,
'errors');
682 if (!$error && !count(
$object->errors)) {
684 $fileimg =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
687 $dirthumbs =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
691 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
692 $dir =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
699 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
702 if (!is_numeric($result) || $result <= 0) {
703 setEventMessages($langs->trans(
"ErrorFailedToSaveFile"),
null,
'errors');
710 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
719 $langs->load(
"errors");
720 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
725 if (!$error && !count(
$object->errors)) {
727 $categories =
GETPOST(
'usercats',
'array:int');
728 $object->setCategories($categories);
731 if (!$error && !count(
$object->errors)) {
732 setEventMessages($langs->trans(
"UserModified"),
null,
'mesgs');
735 $login = $_SESSION[
"dol_login"];
738 $langs->load(
"errors");
739 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
741 if ($passwordismodified &&
$object->login == $user->login) {
743 $langs->load(
"errors");
744 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
745 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
753 if ($permissiontoeditpasswordandsee) {
754 dol_syslog(
"Not allowed to change fields, only password");
758 if (
GETPOST(
"password",
"password")) {
761 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
762 if (is_int($ret) && $ret < 0) {
771 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
772 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
776 $newpassword =
$object->setPassword($user,
'');
777 if (is_int($newpassword) && $newpassword < 0) {
779 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
782 if ($action ==
'confirm_passwordsend') {
783 if (
$object->send_password($user, $newpassword) > 0) {
784 setEventMessages($langs->trans(
"PasswordChangedAndSentTo",
$object->email),
null,
'mesgs');
789 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
795 if ($action ==
'adduserldap' && $permissiontoadd) {
796 $selecteduser =
GETPOST(
'users');
798 $required_fields = array(
815 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
816 foreach ($arrayofsocialnetworks as $socialnetwork) {
822 $result = $ldap->connectBind();
825 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
830 if (is_array($ldapusers)) {
831 foreach ($ldapusers as $key => $attribute) {
843 $ldap_social = array();
846 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
847 foreach ($arrayofsocialnetworks as $socialnetwork) {
848 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
854 setEventMessages($ldap->error, $ldap->errors,
'errors');
858 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
861 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
863 setEventMessages($langs->trans(
'ErrorNoCloneWithoutName'),
null,
'errors');
865 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
873 $clone->api_key =
'';
874 $clone->admin = ($user->admin ?
$object->admin : 0);
876 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
877 $clone->firstname = $parts[0];
878 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
880 $clone->login = substr($parts[0], 0, 1).$parts[1];
883 $clone->context[
'createfromclone'] =
'createfromclone';
884 $id = $clone->create($user);
885 $refalreadyexists = 0;
888 $result = $clone->cloneRights(
$object->id, $id);
891 if (
GETPOST(
'clone_categories')) {
892 $result = $clone->cloneCategories(
$object->id, $id);
894 setEventMessages($langs->trans(
'ErrorUserClone'),
null,
'errors');
895 setEventMessages($clone->error, $clone->errors,
'errors');
900 if ($clone->error ==
'ErrorProductAlreadyExists') {
904 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
905 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
906 setEventMessages($mesg,
null,
'errors');
908 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
912 unset($clone->context[
'createfromclone']);
919 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
930 $triggersendname =
'USER_SENTBYMAIL';
932 $mode =
'emailfromuser';
933 $trackid =
'use'.$id;
934 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
937 $upload_dir =
$conf->user->dir_output;
938 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
941 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
949$form =
new Form($db);
961$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
962$resql = $db->query($sql);
964 $obj = $db->fetch_object($resql);
966 $nbofusers = $obj->nb;
969 dol_print_error($db);
974 $title = $person_name.
" - ".$langs->trans(
'Card');
977 $title = $langs->trans(
"NewEmployee");
979 $title = $langs->trans(
"NewUser");
985llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
987if ($action ==
'create' || $action ==
'adduserldap') {
990 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
999 $result = $ldap->connectBind();
1001 $required_fields = array(
1021 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1026 if (is_array($ldapusers)) {
1027 foreach ($ldapusers as $key => $ldapuser) {
1030 foreach ($required_fields as $value) {
1032 $label .= $value.
"=******* ";
1034 $label .= $value.
"=".$ldapuser[$value].
" ";
1037 $liste[$key] = $label;
1040 setEventMessages($ldap->error, $ldap->errors,
'errors');
1043 setEventMessages($ldap->error, $ldap->errors,
'errors');
1047 print
"\n\n<!-- Form liste LDAP debut -->\n";
1049 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1050 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1051 print
'<table class="border centpercent"><tr>';
1052 print
'<td width="160">';
1053 print $langs->trans(
"LDAPUsers");
1056 print
'<input type="hidden" name="action" value="adduserldap">';
1057 if (is_array($liste) && count($liste)) {
1058 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1061 print
'</td><td class="center">';
1062 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1063 print
'</td></tr></table>';
1066 print
"\n<!-- Form liste LDAP fin -->\n\n";
1071 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1072 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1073 print
'<input type="hidden" name="action" value="add">';
1074 if (!empty($backtopage)) {
1075 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1077 if (!empty($backtopageforcancel)) {
1078 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1080 if (!empty($ldap_sid)) {
1081 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1083 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1089 print
'<table class="border centpercent">';
1093 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1094 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1100 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1102 if (!empty($ldap_lastname)) {
1103 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1104 print $ldap_lastname;
1106 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1111 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1113 if (!empty($ldap_firstname)) {
1114 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1115 print $ldap_firstname;
1117 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1122 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1124 if (!empty($ldap_login)) {
1125 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1127 } elseif (!empty($ldap_loginsmb)) {
1128 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1129 print $ldap_loginsmb;
1131 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1135 if (!empty(
$conf->use_javascript_ajax)) {
1139 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1140 if ($charforseparator ==
'none') {
1141 $charforseparator =
'';
1144 jQuery(document).ready(function() {
1145 $(".createloginauto").on("keyup", function() {
1146 console.log(".createloginauto change: We generate login when we have a lastname");
1148 lastname = $("#lastname").val().toLowerCase();
1151 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1152 $charforseparator =
'';
1154 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1156 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1162 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1164 login += lastname.replace(/\s+/g, \
'\').trim();
1166 $(
"#login").val(login);
1172 $generated_password = '';
1173 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1174 $generated_password = getRandomPassword(false);
1176 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1179 if (!empty($user->admin)) {
1180 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1182 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1184 if (isModEnabled('multicompany
') && !$user->entity) {
1185 if (!empty($conf->use_javascript_ajax)) {
1186 print '<script
type=
"text/javascript">
1188 $(
"select[name=admin]").change(
function() {
1189 if ( $(
this).val() == 0 ) {
1190 $(
"input[name=superadmin]")
1191 .prop(
"disabled",
true)
1192 .prop(
"checked",
false);
1193 $(
"select[name=entity]")
1194 .prop(
"disabled",
false);
1196 $(
"input[name=superadmin]")
1197 .prop(
"disabled",
false);
1200 $(
"input[name=superadmin]").change(
function() {
1201 if ( $(
this).is(
":checked") ) {
1202 $(
"select[name=entity]")
1203 .prop(
"disabled",
true);
1205 $(
"select[name=entity]")
1206 .prop(
"disabled",
false);
1212 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1213 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1214 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1216 print "</td></tr>\n";
1220 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1222 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1223 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1227 $defaultemployee = '1
';
1229 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1230 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1231 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1235 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1237 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
');
1241 // Expense report validator
1242 if (isModEnabled('expensereport
')) {
1243 print '<tr><td
class=
"titlefieldcreate">
';
1244 $text = $langs->trans("ForceUserExpenseValidator");
1245 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1248 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
');
1253 // Holiday request validator
1254 if (isModEnabled('holiday
')) {
1255 print '<tr><td
class=
"titlefieldcreate">
';
1256 $text = $langs->trans("ForceUserHolidayValidator");
1257 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1260 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
');
1266 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1268 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1272 print '</
table><hr><
table class=
"border centpercent">
';
1276 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1278 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1282 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1287 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1290 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1291 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1293 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1294 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1296 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1297 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1298 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1299 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1302 $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">';
1303 if (!empty(
$conf->use_javascript_ajax)) {
1304 $valuetoshow .= img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1309 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1310 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1312 $valuetoshow = $hookmanager->resPrint;
1314 $valuetoshow .= $hookmanager->resPrint;
1321 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
1322 print
'<tr><td class="titlefieldcreate"></td>';
1325 $permissiontoselfeditpassword = 1;
1326 if ($permissiontoselfeditpassword) {
1327 print
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.(GETPOST(
'forcepasswordchange') ==
'1' ?
' checked="checked"' :
'').
'>';
1328 print
'<label class="opacitymedium" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
1330 print
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey valignmiddle" disabled>';
1331 print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"ForcePasswordChange").
'</span>', $langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword"));
1341 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1343 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">';
1344 if (!empty(
$conf->use_javascript_ajax)) {
1345 print img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1351 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1355 print
'</table><hr><table class="border centpercent">';
1359 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1360 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1362 print
'</textarea></td></tr>';
1365 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1366 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1370 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1371 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1375 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1376 print img_picto(
'',
'country',
'class="pictofixedwidth"');
1377 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1379 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1385 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1386 print img_picto(
'',
'state',
'class="pictofixedwidth"');
1387 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1392 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1394 if (!empty($ldap_phone)) {
1395 print img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1396 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1399 print $form->showPhoneInput(
$object->office_phone,
'office_phone',
$object->country_id,
'object_phoning',
'maxwidth200 widthcentpercentminusx');
1404 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1406 if (!empty($ldap_mobile)) {
1407 print img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1408 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1411 print $form->showPhoneInput(
$object->user_mobile,
'user_mobile',
$object->country_id,
'object_phoning_mobile',
'maxwidth200 widthcentpercentminusx');
1416 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1418 if (!empty($ldap_fax)) {
1419 print img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1420 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1423 print $form->showPhoneInput(
$object->office_fax,
'office_fax',
$object->country_id,
'object_phoning_fax',
'maxwidth200 widthcentpercentminusx');
1428 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1430 print img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1431 if (!empty($ldap_mail)) {
1432 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1435 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1441 foreach ($socialnetworks as $key => $value) {
1442 if ($value[
'active']) {
1443 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1445 if (!empty($value[
'icon'])) {
1446 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1448 if (!empty($ldap_social[$key])) {
1449 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1450 print $ldap_social[$key];
1452 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1457 if (!empty($ldap_social[$key])) {
1458 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1460 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1468 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1470 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1476 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1478 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1483 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1484 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1485 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1491 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1492 print
'<td class="maxwidthonsmartphone">'.
"\n";
1493 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');
1499 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1501 if (!method_exists($mc,
'formObjectOptions')) {
1502 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1503 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1504 print
"<td>".$mc->select_entities(
$conf->entity);
1505 print
"</td></tr>\n";
1507 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1513 $parameters = array();
1514 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1517 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1518 print
'<td class="wordbreak">';
1519 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1521 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1522 print $doleditor->Create(1);
1526 print
'<tr><td class="tdtop">';
1527 print $langs->trans(
"NotePublic");
1529 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1530 $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%');
1531 $doleditor->Create();
1532 print
"</td></tr>\n";
1535 print
'<tr><td class="tdtop">';
1536 print $langs->trans(
"NotePrivate");
1538 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1539 $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%');
1540 $doleditor->Create();
1541 print
"</td></tr>\n";
1543 print
'</table><hr><table class="border centpercent">';
1550 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1551 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1556 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1558 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1561 if ($permissiontoseesalary) {
1562 $langs->load(
"salaries");
1566 $text = $langs->trans(
"THM");
1567 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1570 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1576 $text = $langs->trans(
"TJM");
1577 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1580 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1585 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1587 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>';
1593 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1595 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1600 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1602 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1606 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1611 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1613 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1621 print $form->buttonsSaveCancel(
"CreateUser");
1627 $res =
$object->fetch($id,
'',
'', 1);
1631 $res =
$object->fetch_optionals();
1637 setEventMessages($langs->trans(
'UserHasNoPermissions'),
null,
'warnings');
1641 $passDoNotExpire = 0;
1643 $userChangePassNextLogon = 0;
1649 $result = $ldap->connectBind();
1651 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1652 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1654 setEventMessages($ldap->error, $ldap->errors,
'errors');
1658 if (count($ldap->uacf) > 0) {
1659 foreach ($ldap->uacf as $key => $statut) {
1660 if ($key == 65536) {
1661 $passDoNotExpire = 1;
1662 $statutUACF = $statut;
1667 $statutUACF =
"ACCOUNTDISABLE";
1670 if ($ldap->pwdlastset == 0) {
1671 $userChangePassNextLogon = 1;
1677 if ($mode ==
'employee') {
1678 $title = $langs->trans(
"Employee");
1679 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1681 $title = $langs->trans(
"User");
1684 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1685 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1692 if ($action ==
'password') {
1693 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1697 if ($action ==
'passwordsend') {
1698 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1702 if ($action ==
'disable') {
1703 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1707 if ($action ==
'enable') {
1708 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1712 if ($action ==
'delete') {
1713 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1717 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1718 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1720 $formquestionclone = array(
1721 'text' => $langs->trans(
"ConfirmClone"),
1722 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1723 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1724 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1727 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1728 array_splice($formquestionclone, 2, 0, array($newElement));
1730 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);
1735 if ($action !=
'edit') {
1736 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1738 $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" rel="noopener">';
1739 $morehtmlref .= img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1740 $morehtmlref .=
'</a>';
1742 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1743 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs), img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1745 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1747 print
'<div class="fichecenter">';
1748 print
'<div class="fichehalfleft">';
1750 print
'<div class="underbanner clearboth"></div>';
1751 print
'<table class="border tableforfield centpercent">';
1754 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1755 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1756 print
'<td class="error">';
1757 print $langs->trans(
"LoginAccountDisableInDolibarr");
1763 $addadmin .= img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1764 } elseif (!empty(
$object->admin)) {
1765 $addadmin .= img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1774 $text = $langs->trans(
"Type");
1775 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1777 $type = $langs->trans(
"Internal");
1779 $type = $langs->trans(
"External");
1781 print
'<span class="badgeneutral">';
1784 print
' ('.$langs->trans(
"DomainUser").
')';
1787 print
'</td></tr>'.
"\n";
1790 if (
$object->ldap_sid && is_object($ldap)) {
1791 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1792 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1793 print
'</td></tr>'.
"\n";
1797 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1799 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1803 print
'</td></tr>'.
"\n";
1806 if ($nbofusers > 1) {
1808 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1810 if (empty(
$object->fk_user)) {
1811 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1813 $huser =
new User($db);
1815 $huser->fetch(
$object->fk_user);
1816 print $huser->getNomUrl(-1);
1818 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1827 $text = $langs->trans(
"ForceUserExpenseValidator");
1828 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1831 if (!empty(
$object->fk_user_expense_validator)) {
1832 $evuser =
new User($db);
1833 $evuser->fetch(
$object->fk_user_expense_validator);
1834 print $evuser->getNomUrl(-1);
1843 $text = $langs->trans(
"ForceUserHolidayValidator");
1844 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1847 if (!empty(
$object->fk_user_holiday_validator)) {
1848 $hvuser =
new User($db);
1849 $hvuser->fetch(
$object->fk_user_holiday_validator);
1850 print $hvuser->getNomUrl(-1);
1858 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1859 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1863 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1870 if ($permissiontoseesalary) {
1871 $langs->load(
"salaries");
1874 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1876 print(
$object->salary !=
'' ? img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1882 $text = $langs->trans(
"THM");
1883 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1886 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1892 $text = $langs->trans(
"TJM");
1893 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1896 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1902 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1904 if (
$object->dateemployment) {
1905 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1908 if (
$object->dateemploymentend) {
1909 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1916 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1924 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1925 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1926 if (
$object->fk_warehouse > 0) {
1927 $warehousestatic =
new Entrepot($db);
1928 $warehousestatic->fetch(
$object->fk_warehouse);
1929 print $warehousestatic->getNomUrl(1);
1937 print
'<div class="fichehalfright">';
1939 print
'<div class="underbanner clearboth"></div>';
1941 print
'<table class="border tableforfield centpercent">';
1945 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1947 print $formother->showColor(
$object->color,
'');
1953 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1954 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1956 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1962 $langs->load(
"languages");
1963 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1965 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1969 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1975 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1976 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1977 print
'<td>'.$object->openid.
'</td>';
1982 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1984 if (!method_exists($mc,
'formObjectOptions')) {
1986 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1988 print $langs->trans(
"AllEntities");
1990 $mc->getInfo(
$object->entity);
1993 print
"</td></tr>\n";
1999 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2003 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2008 $societe->fetch(
$object->socid);
2009 if ($societe->id > 0) {
2010 $s .= $societe->getNomUrl(1,
'');
2013 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2015 if (!empty(
$object->contact_id)) {
2017 $contact->fetch(
$object->contact_id);
2018 if ($contact->id > 0) {
2019 if (
$object->socid > 0 && $s) {
2024 $s .= $contact->getNomUrl(1,
'');
2034 $langs->load(
"members");
2035 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2039 $adh->fetch(
$object->fk_member);
2040 $adh->ref = $adh->getFullname($langs);
2041 print $adh->getNomUrl(-1);
2043 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2050 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2052 if (!empty(
$object->signature)) {
2055 print
"</td></tr>\n";
2066 print
'<!-- credential section -->'.
"\n";
2067 print
'<div class="div-table-responsive-no-min">';
2068 print
'<table class="noborder tableforfield centpercent">';
2071 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2072 print
'<div class="centpercent display-flex">';
2073 print
'<div class="left inline-block">';
2074 print img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2081 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2083 if (
$object->datestartvalidity) {
2084 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2087 if (
$object->dateendvalidity) {
2088 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2095 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2096 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"PasswordToChange"), $langs->trans(
"ForcePasswordChange")).
'</td>';
2098 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2099 if ($permissiontoselfeditpassword) {
2101 print
'<input type="checkbox" class="colorgrey" disabled name="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2103 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2105 print yn(
$object->force_pass_change);
2106 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2109 print
'<input type="checkbox" name="forcepasswordchange" value="1" disabled class="valignmiddle">';
2110 print
'<span class="opacitymedium" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"No").
'</span>';
2118 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2119 if (!empty(
$object->ldap_sid)) {
2120 if ($passDoNotExpire) {
2121 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2122 } elseif ($userChangePassNextLogon) {
2123 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2124 } elseif ($userDisabled) {
2125 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2127 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2130 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2133 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2134 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2138 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2139 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2141 $valuetoshow = $hookmanager->resPrint;
2143 $valuetoshow .= $hookmanager->resPrint;
2147 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2148 print
'<td class="wordbreak">';
2155 if (
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') && $permissiontoeditpasswordandsee) {
2156 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2158 print
'<div class="centpercent display-flex">';
2159 print
'<span class="badge badge-info">999</span>';
2160 print
'<div class="left inline-block">';
2161 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2163 print
'</span></span>';
2168 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2169 foreach ($tmparrayofauthmode as $tmpauthmode) {
2170 $langs->load(
"oauth");
2172 $tmpauthmode = trim($tmpauthmode);
2173 if (preg_match(
'/oauth/', $tmpauthmode)) {
2174 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2175 print
'<tr class="nooddeven">';
2176 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2177 print
' '.ucfirst($nameofservice).
' ';
2180 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2181 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2189 if (!empty(
$object->email_oauth2)) {
2190 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2200 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin)) {
2201 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2204 print
'<div class="centpercent display-flex">';
2205 print
'<span class="badge badge-info marginleftonly marginrightonly">0</span>';
2209 print
'<div class="left inline-block">';
2210 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2215 if (!empty(
$object->api_key)) {
2216 print
'<span class="opacitymedium marginrightonly">';
2221 print
'<span class="badge badge-info marginleftonly marginrightonly" title="'.$langs->trans(
"TotalAPICall").
'">';
2231 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2233 if (
$object->datepreviouslogin) {
2234 print $form->textwithpicto(
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Previous"));
2237 if (
$object->datepreviouslogin) {
2238 print
' ';
2240 print $form->textwithpicto(
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Currently"));
2250 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2251 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2253 print $hookmanager->resPrint;
2259 print
'<div class="clearboth"></div>';
2268 print
'<div class="tabsAction">';
2270 $parameters = array();
2271 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2272 if (empty($reshook)) {
2276 'class' =>
'classfortooltip'
2280 if (empty($user->socid)) {
2281 $canSendMail =
false;
2283 $langs->load(
"mails");
2284 $canSendMail =
true;
2285 unset($params[
'attr'][
'title']);
2287 $langs->load(
"mails");
2288 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2290 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2295 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2296 print dolGetButtonAction($langs->trans(
'Modify'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF']).
'#',
'',
false, $params);
2298 unset($params[
'attr'][
'title']);
2299 print dolGetButtonAction($langs->trans(
'Modify'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'edit'],
true),
'',
true, $params);
2301 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2303 unset($params[
'attr'][
'title']);
2304 print dolGetButtonAction($langs->trans(
'Modify'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'edit'],
true),
'',
true, $params);
2311 'class' =>
'classfortooltip'
2316 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2317 $cloneButtonId =
'';
2320 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2322 $cloneButtonId =
'action-clone';
2324 print dolGetButtonAction($langs->trans(
'ToClone'), $langs->trans(
'ToClone'),
'clone', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'), array(
'attr' => array(
'class' =>
'reposition')));
2328 if (
$object->status == $object::STATUS_DISABLED) {
2329 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2330 print dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF']).
'#',
'',
false, $params);
2331 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2333 unset($params[
'attr'][
'title']);
2334 print dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'password'],
true),
'',
true, $params);
2337 if (
$object->status == $object::STATUS_DISABLED) {
2338 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2339 print dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2340 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2343 unset($params[
'attr'][
'title']);
2344 print dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'passwordsend'],
true),
'',
true, $params);
2346 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2347 print dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2352 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2354 unset($params[
'attr'][
'title']);
2355 print dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'enable'],
true),
'',
true, $params);
2358 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2360 unset($params[
'attr'][
'title']);
2361 print dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'disable'],
true),
'',
true, $params);
2363 if ($user->id == $id) {
2364 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2365 print dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2369 if ($user->id != $id && $permissiontodisable &&
2371 if ($user->admin || !
$object->admin) {
2372 unset($params[
'attr'][
'title']);
2373 print dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'delete',
'id' =>
$object->id],
true),
'',
true, array(
'attr' => array(
'class' =>
'reposition')));
2375 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2376 print dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'action' =>
'delete',
'id' =>
$object->id],
true),
'',
false, array(
'attr' => array(
'class' =>
'reposition')));
2386 if (
GETPOST(
'modelselected')) {
2387 $action =
'presend';
2391 $modelmail =
'user';
2392 $defaulttopic =
'Information';
2393 $diroutput =
$conf->user->dir_output;
2394 $trackid =
'use'.$object->id;
2396 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2398 if ($action !=
'presend' && $action !=
'send') {
2403 if ($permissiontoreadgroup) {
2404 print
'<!-- Group section -->'.
"\n";
2412 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2414 if (!empty($groupslist)) {
2415 foreach ($groupslist as $groupforuser) {
2416 $exclude[] = $groupforuser->id;
2421 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2422 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2423 print $hookmanager->resPrint;
2425 if (empty($reshook)) {
2426 if ($permissiontoeditgroup) {
2427 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2428 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2429 print
'<input type="hidden" name="action" value="addgroup" />';
2430 print
'<input type="hidden" name="page_y" value="" />';
2433 print
'<!-- List of groups of the user -->'.
"\n";
2434 print
'<table class="noborder centpercent">'.
"\n";
2435 print
'<tr class="liste_titre">';
2437 print
'<th class="liste_titre right" colspan="2">';
2438 if ($permissiontoeditgroup) {
2439 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2441 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2442 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2444 print
'</th></tr>'.
"\n";
2447 if (!empty($groupslist)) {
2448 foreach ($groupslist as $group) {
2449 print
'<tr class="oddeven">';
2450 print
'<td class="tdoverflowmax200">';
2451 if ($permissiontoeditgroup) {
2452 print $group->getNomUrl(1);
2454 print img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2457 print
'<td class="right">';
2458 if ($permissiontoeditgroup) {
2459 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2460 print img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2465 print
"</td></tr>\n";
2468 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2473 if ($permissiontoeditgroup) {
2485 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2486 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2487 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2488 print
'<input type="hidden" name="action" value="update">';
2489 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2493 print
'<table class="border centpercent">';
2497 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2506 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2508 if ($permissiontoedit && !
$object->ldap_sid) {
2509 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2511 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2518 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2520 if ($permissiontoedit && !
$object->ldap_sid) {
2521 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2523 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2529 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2531 if ($user->admin && !
$object->ldap_sid) {
2532 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2534 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2541 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2543 if ($user->id ==
$object->id || !$user->admin) {
2545 $type = $langs->trans(
"Internal");
2547 $type = $langs->trans(
"External");
2550 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2552 print
' ('.$langs->trans(
"DomainUser").
')';
2561 $eventsCompanyContact = array();
2562 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2564 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2565 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2566 print
'<span class="clearbothonsmartphone"></span>';
2567 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2568 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2570 print
' ('.$langs->trans(
"DomainUser").
')';
2573 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2574 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2575 print
'<span class="clearbothonsmartphone"></span>';
2576 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2577 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2579 print
' ('.$langs->trans(
"DomainUser").
')';
2582 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2583 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2584 print
'<span class="clearbothonsmartphone"></span>';
2585 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2586 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2588 print
' ('.$langs->trans(
"DomainUser").
')';
2591 print img_picto(
'',
'company',
'class="pictofixedwidth"');
2592 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2593 print
'<span class="clearbothonsmartphone"></span>';
2594 print img_picto(
'',
'contact',
'class="pictofixedwidth"');
2595 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2601 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2603 $langs->load(
"admin");
2605 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.yn(
$object->admin);
2606 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2610 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2611 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2616 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2619 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2622 if (
$conf->use_javascript_ajax) {
2623 print
'<script type="text/javascript">
2625 var admin = $("select[name=admin]").val();
2627 $("input[name=superadmin]")
2628 .prop("disabled", true)
2629 .prop("checked", false);
2631 if ($("input[name=superadmin]").is(":checked")) {
2632 $("select[name=entity]")
2633 .prop("disabled", true);
2635 $("select[name=admin]").change(function() {
2636 if ( $(this).val() == 0 ) {
2637 $("input[name=superadmin]")
2638 .prop("disabled", true)
2639 .prop("checked", false);
2640 $("select[name=entity]")
2641 .prop("disabled", false);
2643 $("input[name=superadmin]")
2644 .prop("disabled", false);
2647 $("input[name=superadmin]").change(function() {
2648 if ( $(this).is(":checked")) {
2649 $("select[name=entity]")
2650 .prop("disabled", true);
2652 $("select[name=entity]")
2653 .prop("disabled", false);
2660 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2661 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2665 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2666 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2668 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2678 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2679 if ($permissiontoedit && !
$object->ldap_sid) {
2680 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2681 } elseif (
$object->civility_code) {
2682 print $langs->trans(
"Civility".
$object->civility_code);
2688 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2690 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2691 if ($permissiontoedit) {
2694 print $arraygender[
$object->gender];
2700 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2701 if ($permissiontoedit) {
2702 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2705 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2714 if ($nbofusers > 1) {
2716 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2718 if ($permissiontoedit) {
2719 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');
2721 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2722 $huser =
new User($db);
2723 $huser->fetch(
$object->fk_user);
2724 print $huser->getNomUrl(-1);
2731 print
'<tr><td class="titlefieldcreate">';
2732 $text = $langs->trans(
"ForceUserExpenseValidator");
2733 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2736 if ($permissiontoedit) {
2737 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');
2739 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2740 $evuser =
new User($db);
2741 $evuser->fetch(
$object->fk_user_expense_validator);
2742 print $evuser->getNomUrl(-1);
2750 print
'<tr><td class="titlefieldcreate">';
2751 $text = $langs->trans(
"ForceUserHolidayValidator");
2752 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2755 if ($permissiontoedit) {
2756 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');
2758 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2759 $hvuser =
new User($db);
2760 $hvuser->fetch(
$object->fk_user_holiday_validator);
2761 print $hvuser->getNomUrl(-1);
2774 print
'<table class="border centpercent">';
2777 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2779 if ($permissiontoedit) {
2780 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2786 if ($permissiontoedit) {
2787 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2796 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2797 if ($permissiontoselfeditpassword) {
2798 if ($permissiontoedit) {
2799 $sforcepass .=
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2800 $sforcepass .=
'<label class="opacitylow small" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
2802 $sforcepass .=
'<input type="checkbox" name="forcepasswordchange" class="colorgrey" disabled value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2803 $sforcepass .=
'<span class="small">'.$langs->trans(
"ForcePasswordChange").
'</small>';
2806 $sforcepass .=
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey" disabled>';
2807 $sforcepass .=
'<span class="opacitymedium small" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"ForcePasswordChange").
'</span>';
2811 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2814 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2815 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2817 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2818 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2820 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2821 if ($permissiontoeditpasswordandsee) {
2822 $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">';
2823 if (!empty(
$conf->use_javascript_ajax)) {
2824 $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').
'"');
2827 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2831 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2832 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2834 $valuetoshow = $hookmanager->resPrint;
2836 $valuetoshow .= $hookmanager->resPrint;
2844 print
"</td></tr>\n";
2847 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2848 print
'<tr class="valigntop">';
2849 if (
$conf->dol_optimize_smallscreen) {
2850 print
'<td colspan="2">';
2862 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2864 if ($permissiontoeditpasswordandsee) {
2865 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">';
2866 if (!empty(
$conf->use_javascript_ajax)) {
2867 print img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2875 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2876 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2878 if ($permissiontoedit) {
2879 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2881 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2893 print
'<table class="border centpercent">';
2896 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2898 if ($permissiontoedit) {
2899 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2902 if ($permissiontoedit) {
2903 print
'</textarea>';
2908 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2909 if ($permissiontoedit) {
2910 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2917 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2918 if ($permissiontoedit) {
2919 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2926 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2927 print img_picto(
'',
'country',
'class="pictofixedwidth"');
2928 if ($permissiontoedit) {
2929 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2931 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2935 print $countrylabel;
2941 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2942 if ($permissiontoedit) {
2943 print img_picto(
'',
'state',
'class="pictofixedwidth"');
2944 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2952 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2954 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2955 print $form->showPhoneInput(
$object->office_phone,
'office_phone',
$object->country_id,
'phoning',
'maxwidth200 widthcentpercentminusx');
2957 print img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2958 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2964 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2966 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2967 print $form->showPhoneInput(
$object->user_mobile,
'user_mobile',
$object->country_id,
'phoning_mobile',
'maxwidth200 widthcentpercentminusx');
2969 print img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2970 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2976 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2978 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2979 print $form->showPhoneInput(
$object->office_fax,
'office_fax',
$object->country_id,
'phoning_fax',
'maxwidth200 widthcentpercentminusx');
2981 print img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2982 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2988 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2990 print img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2991 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2992 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2994 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
3000 foreach ($socialnetworks as $key => $value) {
3001 if ($value[
'active']) {
3002 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
3004 if (!empty($value[
'icon'])) {
3005 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
3007 if ($permissiontoedit && empty(
$object->ldap_sid)) {
3008 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
3010 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
3011 print
$object->socialnetworks[$key];
3016 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
3027 print
'<table class="border centpercent">';
3030 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
3031 print $formproduct->selectWarehouses(
$object->warehouse_id,
'fk_warehouse',
'warehouseopen', 1);
3032 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>';
3039 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
3041 if ($permissiontoedit) {
3042 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3044 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3045 print
$object->accountancy_code;
3053 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
3055 if ($permissiontoedit) {
3056 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
3058 print $formother->showColor(
$object->color,
'');
3065 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
3067 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
3072 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
3073 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
3075 if ($permissiontoedit) {
3076 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
3078 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
3085 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";
3086 print img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
3092 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
3094 print
$object->getLibStatut(4);
3122 $langs->load(
"members");
3123 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3127 $adh->fetch(
$object->fk_member);
3128 $adh->ref = $adh->login;
3129 print $adh->getNomUrl(1);
3131 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3139 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
3141 if (!method_exists($mc,
'formObjectOptions')) {
3142 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
3143 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3144 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3145 print
"</td></tr>\n";
3147 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3153 $parameters = array(
'colspan' =>
' colspan="2"');
3155 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3156 print $hookmanager->resPrint;
3157 if (empty($reshook)) {
3158 if ($permissiontoedit) {
3159 print
$object->showOptionals($extrafields,
'edit');
3161 print
$object->showOptionals($extrafields,
'view');
3166 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3168 if ($permissiontoedit) {
3169 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3171 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3172 print $doleditor->Create(1);
3175 if (!empty(
$object->signature)) {
3187 print
'<table class="border centpercent">';
3193 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3195 if ($permissiontoedit) {
3196 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3198 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3204 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3206 if ($permissiontoedit) {
3207 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3215 if ($permissiontoseesalary) {
3216 $langs->load(
"salaries");
3219 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3221 print img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3222 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3228 $text = $langs->trans(
"THM");
3229 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3232 if ($permissiontoedit) {
3233 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3234 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3243 $text = $langs->trans(
"TJM");
3244 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3247 if ($permissiontoedit) {
3248 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3249 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3258 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3260 if ($permissiontoedit) {
3261 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3266 if ($dateemployment && $dateemploymentend) {
3270 if ($permissiontoedit) {
3271 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3279 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3281 if ($permissiontoedit) {
3282 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3293 print
'<div class="center">';
3294 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3295 print
' ';
3296 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3302 if ($action !=
'edit' && $action !=
'presend') {
3303 print
'<div class="fichecenter"><div class="fichehalfleft">';
3308 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3309 $genallowed = $user->hasRight(
"user",
"user",
"read");
3310 $delallowed = $user->hasRight(
"user",
"user",
"write");
3315 $societe->fetch(
$object->socid);
3320 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);
3321 $somethingshown = $formfile->numoffiles;
3325 $morehtmlcenter =
'<div class="nowraponall">';
3326 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3327 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3328 $morehtmlcenter .=
'</div>';
3330 print
'</div><div class="fichehalfright">';
3333 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3335 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3337 print
'</div></div>';
3347include_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.
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.
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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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)
treeview li table
No Email.
div refaddress div address
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.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
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,...
user_prepare_head(User $object)
Prepare array with list of tabs.