40require
'../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
65 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
68 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
78$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
81$action =
GETPOST(
'action',
'aZ09');
82$mode =
GETPOST(
'mode',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
85$cancel =
GETPOST(
'cancel',
'alpha');
86$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'usercard';
87$backtopage =
GETPOST(
'backtopage');
88$backtopageforcancel =
GETPOST(
'backtopageforcancel');
90if (empty($id) && $action !=
'add' && $action !=
'create') {
100$childids = $user->getAllChildIds(1);
106$extrafields->fetch_name_optionals_label(
$object->table_element);
111$hookmanager->initHooks(array(
'usercard',
'globalcard'));
118 $res =
$object->fetch($id,
'',
'', 1);
123if ($user->socid > 0) {
124 $socid = $user->socid;
130$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
134$permissiontoreadgroup = $permissiontoread;
135$permissiontoeditgroup = $permissiontoedit;
137 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
138 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
141$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
142$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
143$permissiontocloneuser = $permissiontoadd;
146 $permissiontoclonesuperadmin =
false;
147 $permissiontocloneadmin =
false;
148 $permissiontocloneuser =
false;
151if ($user->id != $id && !$permissiontoread) {
155$caneditpasswordandsee =
false;
156$caneditpasswordandsend =
false;
159$permissiontoeditpasswordandsee =
false;
160$permissiontoeditpasswordandsend =
false;
163 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
164 $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);
165 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
169$permissiontoseesalary = (empty($user->socid) && (
170 (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
171 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
172 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
175$passwordismodified =
false;
183$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
184$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
189if (empty($reshook)) {
190 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
192 if (empty($backtopage) || ($cancel && empty($id))) {
193 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
194 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
195 $backtopage = $backurlforlist;
197 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
203 if (!empty($backtopageforcancel)) {
204 header(
"Location: ".$backtopageforcancel);
206 } elseif (!empty($backtopage)) {
207 header(
"Location: ".$backtopage);
213 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
214 if ($id != $user->id) {
216 if (
$object->admin && empty($user->admin)) {
219 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
222 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
228 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
231 if ($id != $user->id) {
234 if (!empty($conf->file->main_limit_users)) {
235 $nb =
$object->getNbOfUsers(
"active");
236 if ($nb >= $conf->file->main_limit_users) {
238 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
244 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
250 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
251 if ($id != $user->id) {
252 if (!GETPOSTISSET(
'token')) {
253 print
'Error, token required for this critical operation';
260 if (
$object->admin && empty($user->admin)) {
263 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
267 $result =
$object->delete($user);
269 $langs->load(
"errors");
273 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
281 if ($action ==
'add' && $permissiontoadd) {
295 if (!empty($conf->file->main_limit_users)) {
296 $nb =
$object->getNbOfUsers(
"active");
297 if ($nb >= $conf->file->main_limit_users) {
299 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
309 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
324 $object->socialnetworks = array();
325 foreach ($socialnetworks as $key => $value) {
326 if (
GETPOST($key,
'alphanohtml')) {
332 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
339 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
341 $langs->load(
"errors");
342 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
345 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
354 if ($permissiontoseesalary) {
367 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
369 $object->dateemployment = $dateemployment;
370 $object->dateemploymentend = $dateemploymentend;
371 $object->datestartvalidity = $datestartvalidity;
372 $object->dateendvalidity = $dateendvalidity;
380 $ret = $extrafields->setOptionalsFromPost(
null, $object);
394 $object->entity = ($entity ==
'' ? 1 : $entity);
398 $object->entity = ($entity ==
'' ? 1 : $entity);
409 if (
GETPOST(
'password',
'password')) {
410 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
412 if (is_int($resPass) && $resPass < 0) {
413 $langs->load(
"errors");
420 $usercats =
GETPOST(
'usercats',
'array:int');
421 $object->setCategories($usercats);
425 if (!empty($backtopage)) {
426 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
428 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
430 header(
"Location: ".$url);
434 $langs->load(
"errors");
443 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
446 $editgroup->fetch($group);
447 $editgroup->oldcopy = clone $editgroup;
451 if ($action ==
'addgroup') {
452 $result =
$object->SetInGroup($group, $editgroup->entity);
454 if ($action ==
'removegroup') {
455 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
466 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
467 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
469 if ($permissiontoedit) {
472 if (!
GETPOST(
"lastname",
'alpha')) {
477 if (!
GETPOST(
"login",
'alpha')) {
494 if (GETPOSTISSET(
"ref_employee")) {
498 if (GETPOSTISSET(
"national_registration_number")) {
499 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
502 if ($permissiontoeditpasswordandsee) {
505 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
508 if (!empty($user->admin) && $user->id != $id) {
513 if ($user->admin && !
$object->ldap_sid) {
526 $object->socialnetworks = array();
527 foreach ($socialnetworks as $key => $value) {
528 if (
GETPOST($key,
'alphanohtml')) {
534 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
541 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
543 $langs->load(
"errors");
544 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
547 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
555 if ($permissiontoseesalary) {
568 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
569 $object->dateemployment = $dateemployment;
570 $object->dateemploymentend = $dateemploymentend;
571 $object->datestartvalidity = $datestartvalidity;
572 $object->dateendvalidity = $dateendvalidity;
582 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
596 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
604 if (!empty($_FILES[
'photo'][
'name'])) {
608 if (
$object->id == $user->id) {
613 $langs->load(
"errors");
615 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
620 $passwordismodified = 0;
623 $passwordismodified = 1;
630 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
631 $langs->load(
"errors");
632 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
640 if (!$error && GETPOSTISSET(
'contactid')) {
644 if ($contactid > 0) {
646 $contact->fetch($contactid);
648 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
649 $sql .=
" SET fk_socpeople=".((int) $contactid);
650 if (!empty($contact->socid)) {
651 $sql .=
", fk_soc=".((int) $contact->socid);
652 } elseif ($socid > 0) {
653 $sql .=
", fk_soc = null";
654 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
656 $sql .=
" WHERE rowid = ".((int)
$object->id);
657 } elseif ($socid > 0) {
658 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
659 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
660 $sql .=
" WHERE rowid = ".((int)
$object->id);
662 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
663 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
664 $sql .=
" WHERE rowid = ".((int)
$object->id);
667 $resql = $db->query($sql);
674 if (!$error && !count(
$object->errors)) {
676 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
679 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
683 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
684 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
691 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
694 if (!is_numeric($result) || $result <= 0) {
702 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
711 $langs->load(
"errors");
712 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
717 if (!$error && !count(
$object->errors)) {
719 $categories =
GETPOST(
'usercats',
'array:int');
720 $object->setCategories($categories);
723 if (!$error && !count(
$object->errors)) {
727 $login = $_SESSION[
"dol_login"];
730 $langs->load(
"errors");
731 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
733 if ($passwordismodified &&
$object->login == $user->login) {
735 $langs->load(
"errors");
736 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
737 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
745 if ($permissiontoeditpasswordandsee) {
746 dol_syslog(
"Not allowed to change fields, only password");
750 if (
GETPOST(
"password",
"password")) {
753 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
754 if (is_int($ret) && $ret < 0) {
763 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
764 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
768 $newpassword =
$object->setPassword($user,
'');
769 if (is_int($newpassword) && $newpassword < 0) {
771 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
774 if ($action ==
'confirm_passwordsend') {
775 if (
$object->send_password($user, $newpassword) > 0) {
781 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
787 if ($action ==
'adduserldap' && $permissiontoadd) {
788 $selecteduser =
GETPOST(
'users');
790 $required_fields = array(
807 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
808 foreach ($arrayofsocialnetworks as $socialnetwork) {
814 $result = $ldap->connectBind();
817 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
822 if (is_array($ldapusers)) {
823 foreach ($ldapusers as $key => $attribute) {
835 $ldap_social = array();
838 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
839 foreach ($arrayofsocialnetworks as $socialnetwork) {
840 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
850 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
853 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
857 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
865 $clone->api_key =
'';
866 $clone->admin = ($user->admin ?
$object->admin : 0);
868 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
869 $clone->firstname = $parts[0];
870 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
872 $clone->login = substr($parts[0], 0, 1).$parts[1];
875 $clone->context[
'createfromclone'] =
'createfromclone';
876 $id = $clone->create($user);
877 $refalreadyexists = 0;
880 $result = $clone->cloneRights(
$object->id, $id);
883 if (
GETPOST(
'clone_categories')) {
884 $result = $clone->cloneCategories(
$object->id, $id);
892 if ($clone->error ==
'ErrorProductAlreadyExists') {
896 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
897 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
900 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
904 unset($clone->context[
'createfromclone']);
911 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
922 $triggersendname =
'USER_SENTBYMAIL';
924 $mode =
'emailfromuser';
925 $trackid =
'use'.$id;
926 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
929 $upload_dir = $conf->user->dir_output;
930 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
933 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
941$form =
new Form($db);
953$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
954$resql = $db->query($sql);
956 $obj = $db->fetch_object($resql);
958 $nbofusers = $obj->nb;
966 $title = $person_name.
" - ".$langs->trans(
'Card');
969 $title = $langs->trans(
"NewEmployee");
971 $title = $langs->trans(
"NewUser");
977llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
979if ($action ==
'create' || $action ==
'adduserldap') {
982 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
991 $result = $ldap->connectBind();
993 $required_fields = array(
1013 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1018 if (is_array($ldapusers)) {
1019 foreach ($ldapusers as $key => $ldapuser) {
1022 foreach ($required_fields as $value) {
1024 $label .= $value.
"=******* ";
1026 $label .= $value.
"=".$ldapuser[$value].
" ";
1029 $liste[$key] = $label;
1039 print
"\n\n<!-- Form liste LDAP debut -->\n";
1041 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1042 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1043 print
'<table class="border centpercent"><tr>';
1044 print
'<td width="160">';
1045 print $langs->trans(
"LDAPUsers");
1048 print
'<input type="hidden" name="action" value="adduserldap">';
1049 if (is_array($liste) && count($liste)) {
1050 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1053 print
'</td><td class="center">';
1054 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1055 print
'</td></tr></table>';
1058 print
"\n<!-- Form liste LDAP fin -->\n\n";
1063 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1064 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1065 print
'<input type="hidden" name="action" value="add">';
1066 if (!empty($backtopage)) {
1067 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1069 if (!empty($backtopageforcancel)) {
1070 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1072 if (!empty($ldap_sid)) {
1073 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1075 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1081 print
'<table class="border centpercent">';
1085 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1086 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1092 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1094 if (!empty($ldap_lastname)) {
1095 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1096 print $ldap_lastname;
1098 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1103 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1105 if (!empty($ldap_firstname)) {
1106 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1107 print $ldap_firstname;
1109 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1114 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1116 if (!empty($ldap_login)) {
1117 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1119 } elseif (!empty($ldap_loginsmb)) {
1120 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1121 print $ldap_loginsmb;
1123 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1127 if (!empty($conf->use_javascript_ajax)) {
1131 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1132 if ($charforseparator ==
'none') {
1133 $charforseparator =
'';
1136 jQuery(document).ready(function() {
1137 $(".createloginauto").on("keyup", function() {
1138 console.log(".createloginauto change: We generate login when we have a lastname");
1140 lastname = $("#lastname").val().toLowerCase();
1143 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1145 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1151 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1153 login += lastname.replace(/\s+/g, \
'\').trim();
1155 $(
"#login").val(login);
1161 $generated_password = '';
1162 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1163 $generated_password = getRandomPassword(false);
1165 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1168 if (!empty($user->admin)) {
1169 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1171 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1173 if (isModEnabled('multicompany
') && !$user->entity) {
1174 if (!empty($conf->use_javascript_ajax)) {
1175 print '<script
type=
"text/javascript">
1177 $(
"select[name=admin]").change(
function() {
1178 if ( $(
this).val() == 0 ) {
1179 $(
"input[name=superadmin]")
1180 .prop(
"disabled",
true)
1181 .prop(
"checked",
false);
1182 $(
"select[name=entity]")
1183 .prop(
"disabled",
false);
1185 $(
"input[name=superadmin]")
1186 .prop(
"disabled",
false);
1189 $(
"input[name=superadmin]").change(
function() {
1190 if ( $(
this).is(
":checked") ) {
1191 $(
"select[name=entity]")
1192 .prop(
"disabled",
true);
1194 $(
"select[name=entity]")
1195 .prop(
"disabled",
false);
1201 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1202 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1203 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1205 print "</td></tr>\n";
1209 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1211 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1212 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1216 $defaultemployee = '1
';
1218 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1219 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1220 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1224 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1226 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user, 'fk_user
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1230 // Expense report validator
1231 if (isModEnabled('expensereport
')) {
1232 print '<tr><td
class=
"titlefieldcreate">
';
1233 $text = $langs->trans("ForceUserExpenseValidator");
1234 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1237 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1242 // Holiday request validator
1243 if (isModEnabled('holiday
')) {
1244 print '<tr><td
class=
"titlefieldcreate">
';
1245 $text = $langs->trans("ForceUserHolidayValidator");
1246 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1249 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1255 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1257 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1261 print '</
table><hr><
table class=
"border centpercent">
';
1265 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1267 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1271 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1276 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1279 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1280 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1282 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1283 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1285 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1286 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1287 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1288 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1291 $valuetoshow .= ($valuetoshow ?
' + '.$langs->trans(
"DolibarrPassword") :
'').
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxlength="128" type="text" id="password" name="password" value="'.
dol_escape_htmltag($password).
'" autocomplete="new-password" spellcheck="false">';
1292 if (!empty($conf->use_javascript_ajax)) {
1293 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1299 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1300 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1302 $valuetoshow = $hookmanager->resPrint;
1304 $valuetoshow .= $hookmanager->resPrint;
1314 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1316 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off" spellcheck="false">';
1317 if (!empty($conf->use_javascript_ajax)) {
1318 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1324 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1328 print
'</table><hr><table class="border centpercent">';
1332 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1333 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1335 print
'</textarea></td></tr>';
1338 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1339 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1343 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1344 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1348 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1349 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1350 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1352 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1358 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1359 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1360 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1365 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1367 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1368 if (!empty($ldap_phone)) {
1369 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1372 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1377 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1379 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1380 if (!empty($ldap_mobile)) {
1381 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1384 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'" spellcheck="false">';
1389 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1391 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1392 if (!empty($ldap_fax)) {
1393 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1396 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1401 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1403 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1404 if (!empty($ldap_mail)) {
1405 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1408 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1414 foreach ($socialnetworks as $key => $value) {
1415 if ($value[
'active']) {
1416 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1418 if (!empty($value[
'icon'])) {
1419 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1421 if (!empty($ldap_social[$key])) {
1422 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1423 print $ldap_social[$key];
1425 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1430 if (!empty($ldap_social[$key])) {
1431 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1433 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1441 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1443 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1449 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1451 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1456 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1457 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1458 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1464 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1465 print
'<td class="maxwidthonsmartphone">'.
"\n";
1466 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');
1474 if (!method_exists($mc,
'formObjectOptions')) {
1475 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1476 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1477 print
"<td>".$mc->select_entities($conf->entity);
1478 print
"</td></tr>\n";
1480 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1486 $parameters = array();
1487 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1490 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1491 print
'<td class="wordbreak">';
1492 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1494 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1495 print $doleditor->Create(1);
1499 print
'<tr><td class="tdtop">';
1500 print $langs->trans(
"NotePublic");
1502 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1503 $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%');
1504 $doleditor->Create();
1505 print
"</td></tr>\n";
1508 print
'<tr><td class="tdtop">';
1509 print $langs->trans(
"NotePrivate");
1511 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1512 $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%');
1513 $doleditor->Create();
1514 print
"</td></tr>\n";
1516 print
'</table><hr><table class="border centpercent">';
1523 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1524 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1529 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1531 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1534 if ($permissiontoseesalary) {
1535 $langs->load(
"salaries");
1539 $text = $langs->trans(
"THM");
1540 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1543 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1549 $text = $langs->trans(
"TJM");
1550 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1553 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1558 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1560 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1566 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1568 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1573 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1575 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1579 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1584 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1586 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1594 print $form->buttonsSaveCancel(
"CreateUser");
1600 $res =
$object->fetch($id,
'',
'', 1);
1605 $res =
$object->fetch_optionals();
1615 $passDoNotExpire = 0;
1617 $userChangePassNextLogon = 0;
1623 $result = $ldap->connectBind();
1625 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1626 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1632 if (count($ldap->uacf) > 0) {
1633 foreach ($ldap->uacf as $key => $statut) {
1634 if ($key == 65536) {
1635 $passDoNotExpire = 1;
1636 $statutUACF = $statut;
1641 $statutUACF =
"ACCOUNTDISABLE";
1644 if ($ldap->pwdlastset == 0) {
1645 $userChangePassNextLogon = 1;
1651 if ($mode ==
'employee') {
1652 $title = $langs->trans(
"Employee");
1653 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1655 $title = $langs->trans(
"User");
1658 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1659 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1666 if ($action ==
'password') {
1667 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1671 if ($action ==
'passwordsend') {
1672 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1676 if ($action ==
'disable') {
1677 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1681 if ($action ==
'enable') {
1682 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1686 if ($action ==
'delete') {
1687 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1691 if (($action ==
'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile)))
1692 || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
1694 $formquestionclone = array(
1695 'text' => $langs->trans(
"ConfirmClone"),
1696 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1697 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1698 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1701 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1702 array_splice($formquestionclone, 2, 0, array($newElement));
1704 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);
1709 if ($action !=
'edit') {
1710 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1712 $morehtmlref =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/vcard.php', [
'id' =>
$object->id,
'output' =>
'file',
'file' =>
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')]).
'" class="refid valignmiddle" rel="noopener">';
1713 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1714 $morehtmlref .=
'</a>';
1716 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1717 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1719 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1721 print
'<div class="fichecenter">';
1722 print
'<div class="fichehalfleft">';
1724 print
'<div class="underbanner clearboth"></div>';
1725 print
'<table class="border tableforfield centpercent">';
1728 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1729 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1730 print
'<td class="error">';
1731 print $langs->trans(
"LoginAccountDisableInDolibarr");
1737 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1738 } elseif (!empty(
$object->admin)) {
1739 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1748 $text = $langs->trans(
"Type");
1749 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1751 $type = $langs->trans(
"Internal");
1753 $type = $langs->trans(
"External");
1755 print
'<span class="badgeneutral">';
1758 print
' ('.$langs->trans(
"DomainUser").
')';
1761 print
'</td></tr>'.
"\n";
1764 if (
$object->ldap_sid && is_object($ldap)) {
1765 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1766 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1767 print
'</td></tr>'.
"\n";
1771 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1773 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1777 print
'</td></tr>'.
"\n";
1780 if ($nbofusers > 1) {
1782 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1784 if (empty(
$object->fk_user)) {
1785 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1787 $huser =
new User($db);
1789 $huser->fetch(
$object->fk_user);
1790 print $huser->getNomUrl(-1);
1792 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1801 $text = $langs->trans(
"ForceUserExpenseValidator");
1802 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1805 if (!empty(
$object->fk_user_expense_validator)) {
1806 $evuser =
new User($db);
1807 $evuser->fetch(
$object->fk_user_expense_validator);
1808 print $evuser->getNomUrl(-1);
1817 $text = $langs->trans(
"ForceUserHolidayValidator");
1818 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1821 if (!empty(
$object->fk_user_holiday_validator)) {
1822 $hvuser =
new User($db);
1823 $hvuser->fetch(
$object->fk_user_holiday_validator);
1824 print $hvuser->getNomUrl(-1);
1832 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1833 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1837 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1844 if ($permissiontoseesalary) {
1845 $langs->load(
"salaries");
1848 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1850 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1856 $text = $langs->trans(
"THM");
1857 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1860 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency).
'</span>' :
'');
1866 $text = $langs->trans(
"TJM");
1867 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1870 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency).
'</span>' :
'');
1876 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1878 if (
$object->dateemployment) {
1879 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1882 if (
$object->dateemploymentend) {
1883 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1890 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1898 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1899 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1900 if (
$object->fk_warehouse > 0) {
1901 $warehousestatic =
new Entrepot($db);
1902 $warehousestatic->fetch(
$object->fk_warehouse);
1903 print $warehousestatic->getNomUrl(1);
1911 print
'<div class="fichehalfright">';
1913 print
'<div class="underbanner clearboth"></div>';
1915 print
'<table class="border tableforfield centpercent">';
1919 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1921 print $formother->showColor(
$object->color,
'');
1927 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1928 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1930 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1936 $langs->load(
"languages");
1937 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1939 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1943 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1949 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1950 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1951 print
'<td>'.$object->openid.
'</td>';
1958 if (!method_exists($mc,
'formObjectOptions')) {
1959 if (
isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1960 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1962 print $langs->trans(
"AllEntities");
1964 $mc->getInfo(
$object->entity);
1967 print
"</td></tr>\n";
1973 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1977 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1982 $societe->fetch(
$object->socid);
1983 if ($societe->id > 0) {
1984 $s .= $societe->getNomUrl(1,
'');
1987 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1989 if (!empty(
$object->contact_id)) {
1991 $contact->fetch(
$object->contact_id);
1992 if ($contact->id > 0) {
1993 if (
$object->socid > 0 && $s) {
1998 $s .= $contact->getNomUrl(1,
'');
2008 $langs->load(
"members");
2009 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2013 $adh->fetch(
$object->fk_member);
2014 $adh->ref = $adh->getFullname($langs);
2015 print $adh->getNomUrl(-1);
2017 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2024 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2026 print
"</td></tr>\n";
2037 print
'<!-- credential section -->'.
"\n";
2038 print
'<div class="div-table-responsive-no-min">';
2039 print
'<table class="noborder tableforfield centpercent">';
2042 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2043 print
'<div class="centpercent display-flex">';
2044 print
'<div class="left inline-block">';
2045 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2052 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2054 if (
$object->datestartvalidity) {
2055 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2058 if (
$object->dateendvalidity) {
2059 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2067 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2068 if (!empty(
$object->ldap_sid)) {
2069 if ($passDoNotExpire) {
2070 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2071 } elseif ($userChangePassNextLogon) {
2072 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2073 } elseif ($userDisabled) {
2074 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2076 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2079 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2082 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2083 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2087 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2088 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2090 $valuetoshow = $hookmanager->resPrint;
2092 $valuetoshow .= $hookmanager->resPrint;
2096 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2097 print
'<td class="wordbreak">';
2104 if (
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') && $permissiontoeditpasswordandsee) {
2105 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2107 print
'<div class="centpercent display-flex">';
2108 print
'<span class="badge badge-info">999</span>';
2109 print
'<div class="left inline-block">';
2110 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2112 print
'</span></span>';
2117 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2118 foreach ($tmparrayofauthmode as $tmpauthmode) {
2119 $langs->load(
"oauth");
2121 $tmpauthmode = trim($tmpauthmode);
2122 if (preg_match(
'/oauth/', $tmpauthmode)) {
2123 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2124 print
'<tr class="nooddeven">';
2125 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2126 print
' '.ucfirst($nameofservice).
' ';
2129 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2130 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2138 if (!empty(
$object->email_oauth2)) {
2139 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2149 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2150 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2153 print
'<div class="centpercent display-flex">';
2154 print
'<span class="badge badge-info">999</span>';
2158 print
'<div class="left inline-block">';
2159 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2164 if (!empty(
$object->api_key)) {
2165 print
'<span class="opacitymedium">';
2170 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">';
2180 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2182 if (
$object->datepreviouslogin) {
2183 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2186 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2196 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2197 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2199 print $hookmanager->resPrint;
2205 print
'<div class="clearboth"></div>';
2214 print
'<div class="tabsAction">';
2216 $parameters = array();
2217 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2218 if (empty($reshook)) {
2222 'class' =>
'classfortooltip'
2226 if (empty($user->socid)) {
2227 $canSendMail =
false;
2229 $langs->load(
"mails");
2230 $canSendMail =
true;
2231 unset($params[
'attr'][
'title']);
2233 $langs->load(
"mails");
2234 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2236 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2241 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2244 unset($params[
'attr'][
'title']);
2247 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2249 unset($params[
'attr'][
'title']);
2257 'class' =>
'classfortooltip'
2262 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2263 $cloneButtonId =
'';
2266 if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
2268 $cloneButtonId =
'action-clone';
2270 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2274 if (
$object->status == $object::STATUS_DISABLED) {
2275 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2277 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2279 unset($params[
'attr'][
'title']);
2280 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2283 if (
$object->status == $object::STATUS_DISABLED) {
2284 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2285 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2286 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2289 unset($params[
'attr'][
'title']);
2290 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2292 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2293 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2298 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2300 unset($params[
'attr'][
'title']);
2301 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2304 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2306 unset($params[
'attr'][
'title']);
2307 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2309 if ($user->id == $id) {
2310 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2311 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2315 if ($user->id != $id && $permissiontodisable &&
2317 if ($user->admin || !
$object->admin) {
2318 unset($params[
'attr'][
'title']);
2319 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2321 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2322 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2332 if (
GETPOST(
'modelselected')) {
2333 $action =
'presend';
2337 $modelmail =
'user';
2338 $defaulttopic =
'Information';
2339 $diroutput = $conf->user->dir_output;
2340 $trackid =
'use'.$object->id;
2342 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2344 if ($action !=
'presend' && $action !=
'send') {
2349 if ($permissiontoreadgroup) {
2350 print
'<!-- Group section -->'.
"\n";
2358 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2360 if (!empty($groupslist)) {
2361 foreach ($groupslist as $groupforuser) {
2362 $exclude[] = $groupforuser->id;
2367 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2368 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2369 print $hookmanager->resPrint;
2371 if (empty($reshook)) {
2372 if ($permissiontoeditgroup) {
2373 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2374 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2375 print
'<input type="hidden" name="action" value="addgroup" />';
2376 print
'<input type="hidden" name="page_y" value="" />';
2379 print
'<!-- List of groups of the user -->'.
"\n";
2380 print
'<table class="noborder centpercent">'.
"\n";
2381 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2382 print
'<th class="liste_titre right">';
2383 if ($permissiontoeditgroup) {
2384 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2386 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2387 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2389 print
'</th></tr>'.
"\n";
2392 if (!empty($groupslist)) {
2393 foreach ($groupslist as $group) {
2394 print
'<tr class="oddeven">';
2395 print
'<td class="tdoverflowmax200">';
2396 if ($permissiontoeditgroup) {
2397 print $group->getNomUrl(1);
2399 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2402 print
'<td class="right">';
2403 if ($permissiontoeditgroup) {
2404 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2405 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2410 print
"</td></tr>\n";
2413 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2418 if ($permissiontoeditgroup) {
2430 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2431 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2432 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2433 print
'<input type="hidden" name="action" value="update">';
2434 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2438 print
'<table class="border centpercent">';
2442 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2451 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2453 if ($permissiontoedit && !
$object->ldap_sid) {
2454 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2456 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2463 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2465 if ($permissiontoedit && !
$object->ldap_sid) {
2466 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2468 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2474 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2476 if ($user->admin && !
$object->ldap_sid) {
2477 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2479 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2486 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2488 if ($user->id ==
$object->id || !$user->admin) {
2490 $type = $langs->trans(
"Internal");
2492 $type = $langs->trans(
"External");
2495 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2497 print
' ('.$langs->trans(
"DomainUser").
')';
2506 $eventsCompanyContact = array();
2507 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2509 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2510 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2511 print
'<span class="clearbothonsmartphone"></span>';
2512 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2513 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2515 print
' ('.$langs->trans(
"DomainUser").
')';
2518 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2519 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2520 print
'<span class="clearbothonsmartphone"></span>';
2521 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2522 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2524 print
' ('.$langs->trans(
"DomainUser").
')';
2527 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2528 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2529 print
'<span class="clearbothonsmartphone"></span>';
2530 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2531 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2533 print
' ('.$langs->trans(
"DomainUser").
')';
2536 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2537 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2538 print
'<span class="clearbothonsmartphone"></span>';
2539 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2540 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2546 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2548 $langs->load(
"admin");
2550 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2551 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2555 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2556 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2563 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2566 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2569 if ($conf->use_javascript_ajax) {
2570 print
'<script type="text/javascript">
2572 var admin = $("select[name=admin]").val();
2574 $("input[name=superadmin]")
2575 .prop("disabled", true)
2576 .prop("checked", false);
2578 if ($("input[name=superadmin]").is(":checked")) {
2579 $("select[name=entity]")
2580 .prop("disabled", true);
2582 $("select[name=admin]").change(function() {
2583 if ( $(this).val() == 0 ) {
2584 $("input[name=superadmin]")
2585 .prop("disabled", true)
2586 .prop("checked", false);
2587 $("select[name=entity]")
2588 .prop("disabled", false);
2590 $("input[name=superadmin]")
2591 .prop("disabled", false);
2594 $("input[name=superadmin]").change(function() {
2595 if ( $(this).is(":checked")) {
2596 $("select[name=entity]")
2597 .prop("disabled", true);
2599 $("select[name=entity]")
2600 .prop("disabled", false);
2607 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2608 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2612 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2613 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2615 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2625 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2626 if ($permissiontoedit && !
$object->ldap_sid) {
2627 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2628 } elseif (
$object->civility_code) {
2629 print $langs->trans(
"Civility".
$object->civility_code);
2635 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2637 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2638 if ($permissiontoedit) {
2639 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2641 print $arraygender[
$object->gender];
2647 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2648 if ($permissiontoedit) {
2649 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2652 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2661 if ($nbofusers > 1) {
2663 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2665 if ($permissiontoedit) {
2666 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(GETPOSTISSET(
'fk_user') ?
GETPOSTINT(
'fk_user') :
$object->fk_user,
'fk_user', 1, array(
$object->id), 0,
'',
'', (string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2668 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2669 $huser =
new User($db);
2670 $huser->fetch(
$object->fk_user);
2671 print $huser->getNomUrl(-1);
2678 print
'<tr><td class="titlefieldcreate">';
2679 $text = $langs->trans(
"ForceUserExpenseValidator");
2680 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2683 if ($permissiontoedit) {
2684 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array(
$object->id), 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2686 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2687 $evuser =
new User($db);
2688 $evuser->fetch(
$object->fk_user_expense_validator);
2689 print $evuser->getNomUrl(-1);
2697 print
'<tr><td class="titlefieldcreate">';
2698 $text = $langs->trans(
"ForceUserHolidayValidator");
2699 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2702 if ($permissiontoedit) {
2703 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array(
$object->id), 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2705 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2706 $hvuser =
new User($db);
2707 $hvuser->fetch(
$object->fk_user_holiday_validator);
2708 print $hvuser->getNomUrl(-1);
2719 print
'<table class="border centpercent">';
2722 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2724 if ($permissiontoedit) {
2725 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2731 if ($permissiontoedit) {
2732 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2740 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2743 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2744 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2746 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2747 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2749 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2750 if ($permissiontoeditpasswordandsee) {
2751 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="minwidth300 maxwidth400 widthcentpercentminusx" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password" spellcheck="false">';
2752 if (!empty($conf->use_javascript_ajax)) {
2753 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->transnoentities(
'NoPasswordGenerationRuleConfigured') : $langs->transnoentities(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2756 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2760 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2761 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2763 $valuetoshow = $hookmanager->resPrint;
2765 $valuetoshow .= $hookmanager->resPrint;
2769 print
"</td></tr>\n";
2774 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2776 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2777 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off" spellcheck="false">';
2778 if (!empty($conf->use_javascript_ajax)) {
2779 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2787 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2788 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2790 if ($permissiontoedit) {
2791 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2793 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2799 print
'</table><hr><table class="border centpercent">';
2803 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2805 if ($permissiontoedit) {
2806 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2809 if ($permissiontoedit) {
2810 print
'</textarea>';
2815 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2816 if ($permissiontoedit) {
2817 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2824 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2825 if ($permissiontoedit) {
2826 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2833 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2834 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2835 if ($permissiontoedit) {
2836 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2838 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2842 print $countrylabel;
2848 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2849 if ($permissiontoedit) {
2850 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2851 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2859 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2861 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2862 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2863 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2865 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2871 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2873 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2874 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2875 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'" spellcheck="false">';
2877 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2883 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2885 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2886 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2887 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2889 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2895 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2897 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2898 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2899 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2901 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2907 foreach ($socialnetworks as $key => $value) {
2908 if ($value[
'active']) {
2909 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2911 if (!empty($value[
'icon'])) {
2912 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2914 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2915 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2917 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2918 print
$object->socialnetworks[$key];
2923 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2928 print
'</table><hr><table class="border centpercent">';
2932 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2933 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2934 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>';
2941 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2943 if ($permissiontoedit) {
2944 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2946 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2947 print
$object->accountancy_code;
2955 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2957 if ($permissiontoedit) {
2958 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2960 print $formother->showColor(
$object->color,
'');
2967 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2969 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2974 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2975 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
2977 if ($permissiontoedit) {
2978 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
2980 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2987 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";
2988 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2994 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2996 print
$object->getLibStatut(4);
3024 $langs->load(
"members");
3025 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3029 $adh->fetch(
$object->fk_member);
3030 $adh->ref = $adh->login;
3031 print $adh->getNomUrl(1);
3033 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3043 if (!method_exists($mc,
'formObjectOptions')) {
3044 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
3045 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3046 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3047 print
"</td></tr>\n";
3049 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3055 $parameters = array(
'colspan' =>
' colspan="2"');
3057 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3058 print $hookmanager->resPrint;
3059 if (empty($reshook)) {
3060 if ($permissiontoedit) {
3061 print
$object->showOptionals($extrafields,
'edit');
3063 print
$object->showOptionals($extrafields,
'view');
3068 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3070 if ($permissiontoedit) {
3071 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3073 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3074 print $doleditor->Create(1);
3086 print
'<table class="border centpercent">';
3092 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3094 if ($permissiontoedit) {
3095 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3097 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3103 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3105 if ($permissiontoedit) {
3106 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3114 if ($permissiontoseesalary) {
3115 $langs->load(
"salaries");
3118 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3120 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3121 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3127 $text = $langs->trans(
"THM");
3128 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3131 if ($permissiontoedit) {
3132 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3133 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3135 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
3142 $text = $langs->trans(
"TJM");
3143 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3146 if ($permissiontoedit) {
3147 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3148 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3150 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
3157 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3159 if ($permissiontoedit) {
3160 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3165 if ($dateemployment && $dateemploymentend) {
3169 if ($permissiontoedit) {
3170 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3178 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3180 if ($permissiontoedit) {
3181 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3192 print
'<div class="center">';
3193 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3194 print
' ';
3195 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3201 if ($action !=
'edit' && $action !=
'presend') {
3202 print
'<div class="fichecenter"><div class="fichehalfleft">';
3207 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3208 $genallowed = $user->hasRight(
"user",
"user",
"read");
3209 $delallowed = $user->hasRight(
"user",
"user",
"write");
3214 $societe->fetch(
$object->socid);
3219 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'',
'',
'', !is_object($societe) || empty($societe->default_lang) ?
'' : $societe->default_lang);
3220 $somethingshown = $formfile->numoffiles;
3223 $tmparray = $form->showLinkToObjectBlock($object, array(), array(), 1);
3224 $linktoelem = $tmparray[
'linktoelem'];
3225 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3226 print $htmltoenteralink;
3228 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
3232 $morehtmlcenter =
'<div class="nowraponall">';
3233 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3234 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3235 $morehtmlcenter .=
'</div>';
3237 print
'</div><div class="fichehalfright">';
3240 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3242 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3244 print
'</div></div>';
3254include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
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 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.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=2, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
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.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
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 '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
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)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
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'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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.
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$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.