40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
54if (isModEnabled(
'ldap')) {
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
57if (isModEnabled(
'member')) {
58 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
60if (isModEnabled(
'category')) {
61 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63if (isModEnabled(
'stock')) {
64 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
76$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
79$action =
GETPOST(
'action',
'aZ09');
80$mode =
GETPOST(
'mode',
'alpha');
81$confirm =
GETPOST(
'confirm',
'alpha');
83$cancel =
GETPOST(
'cancel',
'alpha');
84$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
86if (empty($id) && $action !=
'add' && $action !=
'create') {
96$childids = $user->getAllChildIds(1);
102$extrafields->fetch_name_optionals_label(
$object->table_element);
107$hookmanager->initHooks(array(
'usercard',
'globalcard'));
114 $res =
$object->fetch($id,
'',
'', 1);
119if ($user->socid > 0) {
120 $socid = $user->socid;
126$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
127$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
128$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
129$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
130$permissiontoreadgroup = $permissiontoread;
131$permissiontoeditgroup = $permissiontoedit;
133 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
134 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
137$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
138$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
139$permissiontocloneuser = $permissiontoadd;
142 $permissiontoclonesuperadmin =
false;
143 $permissiontocloneadmin =
false;
144 $permissiontocloneuser =
false;
147if ($user->id != $id && !$permissiontoread) {
151$caneditpasswordandsee =
false;
152$caneditpasswordandsend =
false;
155$permissiontoeditpasswordandsee =
false;
156$permissiontoeditpasswordandsend =
false;
159 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
160 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
161 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
165$permissiontoseesalary = (empty($user->socid) && (
166 (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
167 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
168 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
169 || (!isModEnabled(
'salaries') && !isModEnabled(
'hrm') && (
$id == 0 || in_array($id, $childids))));
171$passwordismodified =
false;
179$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
180$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
185if (empty($reshook)) {
186 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
188 if (empty($backtopage) || ($cancel && empty($id))) {
189 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
190 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
191 $backtopage = $backurlforlist;
193 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
199 if (!empty($backtopageforcancel)) {
200 header(
"Location: ".$backtopageforcancel);
202 } elseif (!empty($backtopage)) {
203 header(
"Location: ".$backtopage);
209 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
210 if ($id != $user->id) {
212 if (
$object->admin && empty($user->admin)) {
215 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
218 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
224 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
227 if ($id != $user->id) {
230 if (!empty(
$conf->file->main_limit_users)) {
231 $nb =
$object->getNbOfUsers(
"active");
232 if ($nb >=
$conf->file->main_limit_users) {
234 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
240 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
246 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
247 if ($id != $user->id) {
248 if (!GETPOSTISSET(
'token')) {
249 print
'Error, token required for this critical operation';
257 $result =
$object->delete($user);
259 $langs->load(
"errors");
263 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
270 if ($action ==
'add' && $permissiontoadd) {
284 if (!empty(
$conf->file->main_limit_users)) {
285 $nb =
$object->getNbOfUsers(
"active");
286 if ($nb >=
$conf->file->main_limit_users) {
288 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
298 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
312 if (isModEnabled(
'socialnetworks')) {
313 $object->socialnetworks = array();
314 foreach ($socialnetworks as $key => $value) {
315 if (
GETPOST($key,
'alphanohtml')) {
321 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
328 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
330 $langs->load(
"errors");
331 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
334 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
344 if ($permissiontoseesalary) {
351 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
352 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
357 $object->dateemployment = $dateemployment;
358 $object->dateemploymentend = $dateemploymentend;
359 $object->datestartvalidity = $datestartvalidity;
360 $object->dateendvalidity = $dateendvalidity;
368 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
375 if (isModEnabled(
'multicompany')) {
382 $object->entity = ($entity ==
'' ? 1 : $entity);
386 $object->entity = ($entity ==
'' ? 1 : $entity);
397 if (
GETPOST(
'password',
'password')) {
398 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
400 if (is_int($resPass) && $resPass < 0) {
401 $langs->load(
"errors");
406 if (isModEnabled(
"category")) {
408 $usercats =
GETPOST(
'usercats',
'array');
409 $object->setCategories($usercats);
413 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
417 $langs->load(
"errors");
426 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
429 $editgroup->fetch($group);
430 $editgroup->oldcopy = clone $editgroup;
434 if ($action ==
'addgroup') {
435 $result =
$object->SetInGroup($group, $editgroup->entity);
437 if ($action ==
'removegroup') {
438 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
449 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
450 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
452 if ($permissiontoedit) {
455 if (!
GETPOST(
"lastname",
'alpha')) {
460 if (!
GETPOST(
"login",
'alpha')) {
477 if (GETPOSTISSET(
"ref_employee")) {
481 if (GETPOSTISSET(
"national_registration_number")) {
482 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
485 if ($permissiontoeditpasswordandsee) {
488 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
491 if (!empty($user->admin) && $user->id != $id) {
496 if ($user->admin && !
$object->ldap_sid) {
508 if (isModEnabled(
'socialnetworks')) {
509 $object->socialnetworks = array();
510 foreach ($socialnetworks as $key => $value) {
511 if (
GETPOST($key,
'alphanohtml')) {
517 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
524 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
526 $langs->load(
"errors");
527 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
530 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
538 if ($permissiontoseesalary) {
545 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
547 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
552 $object->dateemployment = $dateemployment;
553 $object->dateemploymentend = $dateemploymentend;
554 $object->datestartvalidity = $datestartvalidity;
555 $object->dateendvalidity = $dateendvalidity;
558 if (isModEnabled(
'stock')) {
565 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
579 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
587 if (!empty($_FILES[
'photo'][
'name'])) {
593 $langs->load(
"errors");
595 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
600 $passwordismodified = 0;
603 $passwordismodified = 1;
610 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
611 $langs->load(
"errors");
612 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
620 if (!$error && GETPOSTISSET(
'contactid')) {
624 if ($contactid > 0) {
626 $contact->fetch($contactid);
628 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
629 $sql .=
" SET fk_socpeople=".((int) $contactid);
630 if (!empty($contact->socid)) {
631 $sql .=
", fk_soc=".((int) $contact->socid);
632 } elseif ($socid > 0) {
633 $sql .=
", fk_soc = null";
634 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
636 $sql .=
" WHERE rowid = ".((int)
$object->id);
637 } elseif ($socid > 0) {
638 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
639 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
640 $sql .=
" WHERE rowid = ".((int)
$object->id);
642 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
643 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
644 $sql .=
" WHERE rowid = ".((int)
$object->id);
647 $resql = $db->query($sql);
654 if (!$error && !count(
$object->errors)) {
663 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
671 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
673 if (!($result > 0)) {
681 $langs->load(
"errors");
682 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
687 if (!$error && !count(
$object->errors)) {
689 $categories =
GETPOST(
'usercats',
'array');
690 $object->setCategories($categories);
693 if (!$error && !count(
$object->errors)) {
697 $login = $_SESSION[
"dol_login"];
700 $langs->load(
"errors");
701 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
703 if ($passwordismodified &&
$object->login == $user->login) {
705 $langs->load(
"errors");
706 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
707 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
715 if ($permissiontoeditpasswordandsee) {
716 dol_syslog(
"Not allowed to change fields, only password");
720 if (
GETPOST(
"password",
"password")) {
723 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
724 if (is_int($ret) && $ret < 0) {
733 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
734 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
738 $newpassword =
$object->setPassword($user,
'');
739 if (is_int($newpassword) && $newpassword < 0) {
741 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
744 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
745 if (
$object->send_password($user, $newpassword) > 0) {
751 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
757 if ($action ==
'adduserldap' && $permissiontoadd) {
758 $selecteduser =
GETPOST(
'users');
760 $required_fields = array(
776 if (isModEnabled(
'socialnetworks')) {
777 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
778 foreach ($arrayofsocialnetworks as $socialnetwork) {
784 $result = $ldap->connectBind();
787 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
792 if (is_array($ldapusers)) {
793 foreach ($ldapusers as $key => $attribute) {
805 $ldap_social = array();
807 if (isModEnabled(
'socialnetworks')) {
808 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
809 foreach ($arrayofsocialnetworks as $socialnetwork) {
810 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
820 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
823 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
827 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
835 $clone->api_key =
'';
837 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
838 $clone->firstname = $parts[0];
839 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
841 $clone->login = substr($parts[0], 0, 1).$parts[1];
844 $clone->context[
'createfromclone'] =
'createfromclone';
845 $id = $clone->create($user);
846 $refalreadyexists = 0;
849 $result = $clone->cloneRights(
$object->id, $id);
852 if (
GETPOST(
'clone_categories')) {
853 $result = $clone->cloneCategories(
$object->id, $id);
861 if ($clone->error ==
'ErrorProductAlreadyExists') {
865 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
866 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
869 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
873 unset($clone->context[
'createfromclone']);
880 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
891 $triggersendname =
'USER_SENTBYMAIL';
893 $mode =
'emailfromuser';
894 $trackid =
'use'.$id;
895 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
898 $upload_dir =
$conf->user->dir_output;
899 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
907$form =
new Form($db);
912if (isModEnabled(
'stock')) {
918$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
919$resql = $db->query($sql);
921 $obj = $db->fetch_object($resql);
923 $nbofusers = $obj->nb;
931 $title = $person_name.
" - ".$langs->trans(
'Card');
934 $title = $langs->trans(
"NewEmployee");
936 $title = $langs->trans(
"NewUser");
942llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
944if ($action ==
'create' || $action ==
'adduserldap') {
947 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
951 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
956 $result = $ldap->connectBind();
958 $required_fields = array(
978 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
983 if (is_array($ldapusers)) {
984 foreach ($ldapusers as $key => $ldapuser) {
987 foreach ($required_fields as $value) {
989 $label .= $value.
"=******* ";
991 $label .= $value.
"=".$ldapuser[$value].
" ";
994 $liste[$key] = $label;
1004 print
"\n\n<!-- Form liste LDAP debut -->\n";
1006 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1007 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1008 print
'<table class="border centpercent"><tr>';
1009 print
'<td width="160">';
1010 print $langs->trans(
"LDAPUsers");
1013 print
'<input type="hidden" name="action" value="adduserldap">';
1014 if (is_array($liste) && count($liste)) {
1015 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1018 print
'</td><td class="center">';
1019 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1020 print
'</td></tr></table>';
1023 print
"\n<!-- Form liste LDAP fin -->\n\n";
1028 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1029 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1030 print
'<input type="hidden" name="action" value="add">';
1031 if (!empty($ldap_sid)) {
1032 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1034 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1040 print
'<table class="border centpercent">';
1043 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1044 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1049 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1051 if (!empty($ldap_lastname)) {
1052 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1053 print $ldap_lastname;
1055 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1060 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1062 if (!empty($ldap_firstname)) {
1063 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1064 print $ldap_firstname;
1066 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1071 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1073 if (!empty($ldap_login)) {
1074 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1076 } elseif (!empty($ldap_loginsmb)) {
1077 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1078 print $ldap_loginsmb;
1080 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1084 if (!empty(
$conf->use_javascript_ajax)) {
1088 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1089 if ($charforseparator ==
'none') {
1090 $charforseparator =
'';
1093 jQuery(document).ready(function() {
1094 $(".createloginauto").on("keyup", function() {
1095 console.log(".createloginauto change: We generate login when we have a lastname");
1097 lastname = $("#lastname").val().toLowerCase();
1100 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1102 print
' firstname = $("#firstname").val().toLowerCase();';
1108 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1112 $(
"#login").val(login);
1118 $generated_password = '';
1119 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1120 $generated_password = getRandomPassword(false);
1122 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1125 if (!empty($user->admin)) {
1126 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1128 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1130 if (isModEnabled('multicompany
') && !$user->entity) {
1131 if (!empty($conf->use_javascript_ajax)) {
1132 print '<script
type=
"text/javascript">
1134 $(
"select[name=admin]").change(
function() {
1135 if ( $(
this).val() == 0 ) {
1136 $(
"input[name=superadmin]")
1137 .prop(
"disabled",
true)
1138 .prop(
"checked",
false);
1139 $(
"select[name=entity]")
1140 .prop(
"disabled",
false);
1142 $(
"input[name=superadmin]")
1143 .prop(
"disabled",
false);
1146 $(
"input[name=superadmin]").change(
function() {
1147 if ( $(
this).is(
":checked") ) {
1148 $(
"select[name=entity]")
1149 .prop(
"disabled",
true);
1151 $(
"select[name=entity]")
1152 .prop(
"disabled",
false);
1158 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1159 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1160 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1162 print "</td></tr>\n";
1166 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1168 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1169 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1173 $defaultemployee = '1
';
1175 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1176 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1177 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1181 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1183 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user, 'fk_user
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1187 // Expense report validator
1188 if (isModEnabled('expensereport
')) {
1189 print '<tr><td
class=
"titlefieldcreate">
';
1190 $text = $langs->trans("ForceUserExpenseValidator");
1191 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1194 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1199 // Holiday request validator
1200 if (isModEnabled('holiday
')) {
1201 print '<tr><td
class=
"titlefieldcreate">
';
1202 $text = $langs->trans("ForceUserHolidayValidator");
1203 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1206 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1212 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1214 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1218 print '</
table><hr><
table class=
"border centpercent">
';
1222 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1224 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1228 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1233 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1236 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1237 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1239 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1240 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1242 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1243 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1244 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1245 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1248 $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">';
1249 if (!empty(
$conf->use_javascript_ajax)) {
1250 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1256 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1257 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1259 $valuetoshow = $hookmanager->resPrint;
1261 $valuetoshow .= $hookmanager->resPrint;
1267 if (isModEnabled(
'api')) {
1270 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1272 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">';
1273 if (!empty(
$conf->use_javascript_ajax)) {
1274 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1280 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1284 print
'</table><hr><table class="border centpercent">';
1288 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1289 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1291 print
'</textarea></td></tr>';
1294 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1295 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1299 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1300 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1304 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1305 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1306 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1308 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1314 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1315 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1316 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1321 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1323 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1324 if (!empty($ldap_phone)) {
1325 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1328 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1333 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1335 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1336 if (!empty($ldap_mobile)) {
1337 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1340 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1345 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1347 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1348 if (!empty($ldap_fax)) {
1349 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1352 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1357 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1359 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1360 if (!empty($ldap_mail)) {
1361 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1364 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1369 if (isModEnabled(
'socialnetworks')) {
1370 foreach ($socialnetworks as $key => $value) {
1371 if ($value[
'active']) {
1372 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1374 if (!empty($value[
'icon'])) {
1375 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1377 if (!empty($ldap_social[$key])) {
1378 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1379 print $ldap_social[$key];
1381 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1386 if (!empty($ldap_social[$key])) {
1387 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1389 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1396 if (isModEnabled(
'accounting')) {
1397 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1399 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1404 if (isModEnabled(
'agenda')) {
1405 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1407 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1412 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1413 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1414 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1415 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1421 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1422 print
'<td class="maxwidthonsmartphone">'.
"\n";
1423 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');
1429 if (isModEnabled(
'multicompany') && is_object($mc)) {
1431 if (!method_exists($mc,
'formObjectOptions')) {
1432 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1433 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1434 print
"<td>".$mc->select_entities(
$conf->entity);
1435 print
"</td></tr>\n";
1437 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1443 $parameters = array();
1444 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1447 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1448 print
'<td class="wordbreak">';
1449 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1451 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1452 print $doleditor->Create(1);
1456 print
'<tr><td class="tdtop">';
1457 print $langs->trans(
"NotePublic");
1459 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1460 $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%');
1461 $doleditor->Create();
1462 print
"</td></tr>\n";
1465 print
'<tr><td class="tdtop">';
1466 print $langs->trans(
"NotePrivate");
1468 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1469 $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%');
1470 $doleditor->Create();
1471 print
"</td></tr>\n";
1473 print
'</table><hr><table class="border centpercent">';
1480 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1481 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1486 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1488 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1491 if ($permissiontoseesalary) {
1492 $langs->load(
"salaries");
1496 $text = $langs->trans(
"THM");
1497 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1500 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1506 $text = $langs->trans(
"TJM");
1507 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1510 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1515 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1517 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1523 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1525 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1530 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1532 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1536 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1541 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1543 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1551 print $form->buttonsSaveCancel(
"CreateUser");
1557 $res =
$object->fetch($id,
'',
'', 1);
1562 $res =
$object->fetch_optionals();
1572 $passDoNotExpire = 0;
1574 $userChangePassNextLogon = 0;
1578 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1580 $result = $ldap->connectBind();
1582 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1583 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1589 if (count($ldap->uacf) > 0) {
1590 foreach ($ldap->uacf as $key => $statut) {
1591 if ($key == 65536) {
1592 $passDoNotExpire = 1;
1593 $statutUACF = $statut;
1598 $statutUACF =
"ACCOUNTDISABLE";
1601 if ($ldap->pwdlastset == 0) {
1602 $userChangePassNextLogon = 1;
1608 if ($mode ==
'employee') {
1609 $title = $langs->trans(
"Employee");
1610 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1612 $title = $langs->trans(
"User");
1615 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1616 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1625 if ($action ==
'password') {
1626 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1632 if ($action ==
'passwordsend') {
1633 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1639 if ($action ==
'disable') {
1640 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1646 if ($action ==
'enable') {
1647 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1651 if ($action ==
'delete') {
1652 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1658 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1659 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1661 $formquestionclone = array(
1662 'text' => $langs->trans(
"ConfirmClone"),
1663 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1664 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1665 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1668 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1669 array_splice($formquestionclone, 2, 0, array($newElement));
1671 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);
1678 if ($action !=
'edit') {
1681 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid valignmiddle" rel="noopener">';
1682 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1683 $morehtmlref .=
'</a>';
1685 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1686 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1688 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1690 print
'<div class="fichecenter">';
1691 print
'<div class="fichehalfleft">';
1693 print
'<div class="underbanner clearboth"></div>';
1694 print
'<table class="border tableforfield centpercent">';
1697 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1699 print
'<td class="error">';
1700 print $langs->trans(
"LoginAccountDisableInDolibarr");
1705 if (property_exists(
$object,
'admin')) {
1706 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1707 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1708 } elseif (!empty(
$object->admin)) {
1709 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1719 $text = $langs->trans(
"Type");
1720 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1722 $type = $langs->trans(
"Internal");
1724 $type = $langs->trans(
"External");
1726 print
'<span class="badgeneutral">';
1729 print
' ('.$langs->trans(
"DomainUser").
')';
1732 print
'</td></tr>'.
"\n";
1735 if (
$object->ldap_sid && is_object($ldap)) {
1736 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1737 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1738 print
'</td></tr>'.
"\n";
1742 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1744 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1748 print
'</td></tr>'.
"\n";
1751 if ($nbofusers > 1) {
1753 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1755 if (empty(
$object->fk_user)) {
1756 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1758 $huser =
new User($db);
1760 $huser->fetch(
$object->fk_user);
1761 print $huser->getNomUrl(-1);
1763 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1770 if (isModEnabled(
'expensereport')) {
1772 $text = $langs->trans(
"ForceUserExpenseValidator");
1773 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1776 if (!empty(
$object->fk_user_expense_validator)) {
1777 $evuser =
new User($db);
1778 $evuser->fetch(
$object->fk_user_expense_validator);
1779 print $evuser->getNomUrl(-1);
1786 if (isModEnabled(
'holiday')) {
1788 $text = $langs->trans(
"ForceUserHolidayValidator");
1789 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1792 if (!empty(
$object->fk_user_holiday_validator)) {
1793 $hvuser =
new User($db);
1794 $hvuser->fetch(
$object->fk_user_holiday_validator);
1795 print $hvuser->getNomUrl(-1);
1803 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1804 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1808 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1815 if ($permissiontoseesalary) {
1816 $langs->load(
"salaries");
1819 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1821 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1827 $text = $langs->trans(
"THM");
1828 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1837 $text = $langs->trans(
"TJM");
1838 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1847 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1849 if (
$object->dateemployment) {
1850 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1853 if (
$object->dateemploymentend) {
1854 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1861 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1869 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1870 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1871 if (
$object->fk_warehouse > 0) {
1872 $warehousestatic =
new Entrepot($db);
1873 $warehousestatic->fetch(
$object->fk_warehouse);
1874 print $warehousestatic->getNomUrl(1);
1882 print
'<div class="fichehalfright">';
1884 print
'<div class="underbanner clearboth"></div>';
1886 print
'<table class="border tableforfield centpercent">';
1889 if (isModEnabled(
'agenda')) {
1890 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1892 print $formother->showColor(
$object->color,
'');
1898 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1899 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1901 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1907 $langs->load(
"languages");
1908 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1910 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1914 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1920 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1921 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1922 print
'<td>'.$object->openid.
'</td>';
1927 if (isModEnabled(
'multicompany') && is_object($mc)) {
1929 if (!method_exists($mc,
'formObjectOptions')) {
1930 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1931 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1933 print $langs->trans(
"AllEntities");
1935 $mc->getInfo(
$object->entity);
1938 print
"</td></tr>\n";
1944 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1947 if (isModEnabled(
"societe")) {
1948 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1953 $societe->fetch(
$object->socid);
1954 if ($societe->id > 0) {
1955 $s .= $societe->getNomUrl(1,
'');
1958 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1960 if (!empty(
$object->contact_id)) {
1962 $contact->fetch(
$object->contact_id);
1963 if ($contact->id > 0) {
1964 if (
$object->socid > 0 && $s) {
1969 $s .= $contact->getNomUrl(1,
'');
1978 if (isModEnabled(
'member')) {
1979 $langs->load(
"members");
1980 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1984 $adh->fetch(
$object->fk_member);
1985 $adh->ref = $adh->getFullname($langs);
1986 print $adh->getNomUrl(-1);
1988 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1995 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1997 print
"</td></tr>\n";
2005 print
'<div class="div-table-responsive-no-min">';
2006 print
'<table class="noborder tableforfield centpercent">';
2008 print
'<tr class="liste_titre"><th class="liste_titre">';
2009 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
2011 print
'<th class="liste_titre"></th>';
2015 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2017 if (
$object->datestartvalidity) {
2018 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2021 if (
$object->dateendvalidity) {
2022 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2029 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
2030 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2039 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2040 if (!empty(
$object->ldap_sid)) {
2041 if ($passDoNotExpire) {
2042 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2043 } elseif ($userChangePassNextLogon) {
2044 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2045 } elseif ($userDisabled) {
2046 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2048 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2051 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2054 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2055 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2076 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2077 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2079 $valuetoshow = $hookmanager->resPrint;
2081 $valuetoshow .= $hookmanager->resPrint;
2085 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2086 print
'<td class="wordbreak">';
2093 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2094 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2096 if (!empty(
$object->api_key)) {
2097 print
'<span class="opacitymedium">';
2104 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2106 if (
$object->datepreviouslogin) {
2107 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2110 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2121 print
'<div class="clearboth"></div>';
2130 print
'<div class="tabsAction">';
2132 $parameters = array();
2133 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2134 if (empty($reshook)) {
2138 'class' =>
'classfortooltip'
2142 if (empty($user->socid)) {
2143 $canSendMail =
false;
2145 $langs->load(
"mails");
2146 $canSendMail =
true;
2147 unset($params[
'attr'][
'title']);
2149 $langs->load(
"mails");
2150 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2152 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2155 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2157 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2158 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2160 unset($params[
'attr'][
'title']);
2163 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2165 unset($params[
'attr'][
'title']);
2166 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2173 'class' =>
'classfortooltip'
2178 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2179 $cloneButtonId =
'';
2182 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2184 $cloneButtonId =
'action-clone';
2186 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2190 if (
$object->status == $object::STATUS_DISABLED) {
2191 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2192 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2193 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2195 unset($params[
'attr'][
'title']);
2196 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2199 if (
$object->status == $object::STATUS_DISABLED) {
2200 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2201 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2202 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2205 unset($params[
'attr'][
'title']);
2206 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2208 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2209 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2214 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2216 unset($params[
'attr'][
'title']);
2217 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2220 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2222 unset($params[
'attr'][
'title']);
2223 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2225 if ($user->id == $id) {
2226 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2227 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2231 if ($user->id != $id && $permissiontodisable &&
2233 if ($user->admin || !
$object->admin) {
2234 unset($params[
'attr'][
'title']);
2235 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2237 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2238 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2248 if (
GETPOST(
'modelselected')) {
2249 $action =
'presend';
2253 $modelmail =
'user';
2254 $defaulttopic =
'Information';
2255 $diroutput =
$conf->user->dir_output;
2256 $trackid =
'use'.$object->id;
2258 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2260 if ($action !=
'presend' && $action !=
'send') {
2265 if ($permissiontoreadgroup) {
2266 print
'<!-- Group section -->'.
"\n";
2274 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2276 if (!empty($groupslist)) {
2277 foreach ($groupslist as $groupforuser) {
2278 $exclude[] = $groupforuser->id;
2283 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2284 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2285 print $hookmanager->resPrint;
2287 if (empty($reshook)) {
2288 if ($permissiontoeditgroup) {
2289 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2290 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2291 print
'<input type="hidden" name="action" value="addgroup" />';
2292 print
'<input type="hidden" name="page_y" value="" />';
2295 print
'<!-- List of groups of the user -->'.
"\n";
2296 print
'<table class="noborder centpercent">'.
"\n";
2297 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2298 print
'<th class="liste_titre right">';
2299 if ($permissiontoeditgroup) {
2300 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(),
$object->entity,
false,
'maxwidth150');
2302 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2303 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2305 print
'</th></tr>'.
"\n";
2308 if (!empty($groupslist)) {
2309 foreach ($groupslist as $group) {
2310 print
'<tr class="oddeven">';
2311 print
'<td class="tdoverflowmax200">';
2312 if ($permissiontoeditgroup) {
2313 print $group->getNomUrl(1);
2315 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2318 print
'<td class="right">';
2319 if ($permissiontoeditgroup) {
2320 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2321 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2326 print
"</td></tr>\n";
2329 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2334 if ($permissiontoeditgroup) {
2346 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2347 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2348 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2349 print
'<input type="hidden" name="action" value="update">';
2350 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2354 print
'<table class="border centpercent">';
2358 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2366 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2367 if ($permissiontoedit && !
$object->ldap_sid) {
2368 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2369 } elseif (
$object->civility_code) {
2370 print $langs->trans(
"Civility".
$object->civility_code);
2376 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2378 if ($permissiontoedit && !
$object->ldap_sid) {
2379 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2381 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2388 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2390 if ($permissiontoedit && !
$object->ldap_sid) {
2391 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2393 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2399 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2401 if ($user->admin && !
$object->ldap_sid) {
2402 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2404 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2411 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2413 $langs->load(
"admin");
2415 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2416 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2420 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2421 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2427 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2428 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2431 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2433 if (isModEnabled(
'multicompany') && !$user->entity) {
2434 if (
$conf->use_javascript_ajax) {
2435 print
'<script type="text/javascript">
2437 var admin = $("select[name=admin]").val();
2439 $("input[name=superadmin]")
2440 .prop("disabled", true)
2441 .prop("checked", false);
2443 if ($("input[name=superadmin]").is(":checked")) {
2444 $("select[name=entity]")
2445 .prop("disabled", true);
2447 $("select[name=admin]").change(function() {
2448 if ( $(this).val() == 0 ) {
2449 $("input[name=superadmin]")
2450 .prop("disabled", true)
2451 .prop("checked", false);
2452 $("select[name=entity]")
2453 .prop("disabled", false);
2455 $("input[name=superadmin]")
2456 .prop("disabled", false);
2459 $("input[name=superadmin]").change(function() {
2460 if ( $(this).is(":checked")) {
2461 $("select[name=entity]")
2462 .prop("disabled", true);
2464 $("select[name=entity]")
2465 .prop("disabled", false);
2472 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2473 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2477 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2478 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2479 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2480 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2489 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2491 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2492 if ($permissiontoedit) {
2493 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2495 print $arraygender[
$object->gender];
2501 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2502 if ($permissiontoedit) {
2503 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2506 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2515 if ($nbofusers > 1) {
2517 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2519 if ($permissiontoedit) {
2520 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user,
'fk_user', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2522 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2523 $huser =
new User($db);
2524 $huser->fetch(
$object->fk_user);
2525 print $huser->getNomUrl(-1);
2531 if (isModEnabled(
'expensereport')) {
2532 print
'<tr><td class="titlefieldcreate">';
2533 $text = $langs->trans(
"ForceUserExpenseValidator");
2534 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2537 if ($permissiontoedit) {
2538 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2540 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2541 $evuser =
new User($db);
2542 $evuser->fetch(
$object->fk_user_expense_validator);
2543 print $evuser->getNomUrl(-1);
2550 if (isModEnabled(
'holiday')) {
2551 print
'<tr><td class="titlefieldcreate">';
2552 $text = $langs->trans(
"ForceUserHolidayValidator");
2553 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2556 if ($permissiontoedit) {
2557 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2559 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2560 $hvuser =
new User($db);
2561 $hvuser->fetch(
$object->fk_user_holiday_validator);
2562 print $hvuser->getNomUrl(-1);
2570 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2572 if ($user->id ==
$object->id || !$user->admin) {
2574 $type = $langs->trans(
"Internal");
2576 $type = $langs->trans(
"External");
2579 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2581 print
' ('.$langs->trans(
"DomainUser").
')';
2590 $eventsCompanyContact = array();
2591 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2593 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2594 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2595 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2596 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2598 print
' ('.$langs->trans(
"DomainUser").
')';
2601 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2602 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2603 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2604 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2606 print
' ('.$langs->trans(
"DomainUser").
')';
2609 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2610 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2611 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2612 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2614 print
' ('.$langs->trans(
"DomainUser").
')';
2617 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2618 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2619 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2620 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2629 print
'<table class="border centpercent">';
2632 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2634 if ($permissiontoedit) {
2635 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2641 if ($permissiontoedit) {
2642 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2650 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2653 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2654 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2656 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2657 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2659 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2660 if ($permissiontoeditpasswordandsee) {
2661 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="flat" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password">';
2662 if (!empty(
$conf->use_javascript_ajax)) {
2663 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->trans(
'NoPasswordGenerationRuleConfigured') : $langs->trans(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2666 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2670 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2671 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2673 $valuetoshow = $hookmanager->resPrint;
2675 $valuetoshow .= $hookmanager->resPrint;
2679 print
"</td></tr>\n";
2682 if (isModEnabled(
'api')) {
2683 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2685 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2686 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2687 if (!empty(
$conf->use_javascript_ajax)) {
2688 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2695 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2696 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2698 if ($permissiontoedit) {
2699 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2701 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2707 print
'</table><hr><table class="border centpercent">';
2711 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2713 if ($permissiontoedit) {
2714 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2717 if ($permissiontoedit) {
2718 print
'</textarea>';
2723 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2724 if ($permissiontoedit) {
2725 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2732 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2733 if ($permissiontoedit) {
2734 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2741 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2742 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2743 if ($permissiontoedit) {
2744 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2746 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2750 print $countrylabel;
2756 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2757 if ($permissiontoedit) {
2758 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2759 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2767 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2769 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2770 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2771 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2773 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2779 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2781 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2782 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2783 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2785 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2791 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2793 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2794 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2795 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2797 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2803 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2805 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2806 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2807 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2809 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2814 if (isModEnabled(
'socialnetworks')) {
2815 foreach ($socialnetworks as $key => $value) {
2816 if ($value[
'active']) {
2817 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2819 if (!empty($value[
'icon'])) {
2820 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2822 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2823 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2825 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2826 print
$object->socialnetworks[$key];
2831 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2836 print
'</table><hr><table class="border centpercent">';
2840 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2841 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2842 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>';
2847 if (isModEnabled(
'accounting')) {
2849 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2851 if ($permissiontoedit) {
2852 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2854 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2855 print
$object->accountancy_code;
2862 if (isModEnabled(
'agenda')) {
2863 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2865 if ($permissiontoedit) {
2866 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2868 print $formother->showColor(
$object->color,
'');
2875 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2877 print $form->showphoto(
'userphoto',
$object, 60, 0, $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2882 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2883 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2885 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2886 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
'',
'', 0, 0, 1);
2888 $cats =
$c->containing(
$object->id, Categorie::TYPE_USER);
2889 $arrayselected = array();
2890 foreach ($cats as $cat) {
2891 $arrayselected[] = $cat->id;
2893 if ($permissiontoedit) {
2894 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected, 0, 0,
'', 0,
'90%');
2896 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2903 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";
2904 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2910 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2912 print
$object->getLibStatut(4);
2939 if (isModEnabled(
'member')) {
2940 $langs->load(
"members");
2941 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2945 $adh->fetch(
$object->fk_member);
2946 $adh->ref = $adh->login;
2947 print $adh->getNomUrl(1);
2949 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2957 if (isModEnabled(
'multicompany') && is_object($mc)) {
2959 if (!method_exists($mc,
'formObjectOptions')) {
2960 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2961 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2962 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2963 print
"</td></tr>\n";
2965 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2971 $parameters = array(
'colspan' =>
' colspan="2"');
2973 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2974 print $hookmanager->resPrint;
2975 if (empty($reshook)) {
2976 if ($permissiontoedit) {
2977 print
$object->showOptionals($extrafields,
'edit');
2979 print
$object->showOptionals($extrafields,
'view');
2984 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2986 if ($permissiontoedit) {
2987 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2989 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2990 print $doleditor->Create(1);
3002 print
'<table class="border centpercent">';
3008 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3010 if ($permissiontoedit) {
3011 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3013 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3019 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3021 if ($permissiontoedit) {
3022 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3030 if ($permissiontoseesalary) {
3031 $langs->load(
"salaries");
3034 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3036 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3042 $text = $langs->trans(
"THM");
3043 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3046 if ($permissiontoedit) {
3047 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3056 $text = $langs->trans(
"TJM");
3057 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3060 if ($permissiontoedit) {
3061 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3070 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3072 if ($permissiontoedit) {
3073 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3078 if ($dateemployment && $dateemploymentend) {
3082 if ($permissiontoedit) {
3083 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3091 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3093 if ($permissiontoedit) {
3094 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3105 print
'<div class="center">';
3106 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3107 print
' ';
3108 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3114 if ($action !=
'edit' && $action !=
'presend') {
3115 print
'<div class="fichecenter"><div class="fichehalfleft">';
3120 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3121 $genallowed = $user->hasRight(
"user",
"user",
"read");
3122 $delallowed = $user->hasRight(
"user",
"user",
"write");
3127 $societe->fetch(
$object->socid);
3132 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', !is_object($societe) || empty($societe->default_lang) ?
'' : $societe->default_lang);
3133 $somethingshown = $formfile->numoffiles;
3136 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3137 $linktoelem = $tmparray[
'linktoelem'];
3138 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3139 print $htmltoenteralink;
3141 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3145 $morehtmlcenter =
'<div class="nowraponall">';
3146 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3147 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3148 $morehtmlcenter .=
'</div>';
3150 print
'</div><div class="fichehalfright">';
3153 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3155 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3157 print
'</div></div>';
3160 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3167include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3169if (isModEnabled(
'api')) {
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.