40require
'../main.inc.php';
52require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.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');
89$forcepasswordchange =
GETPOSTINT(
'forcepasswordchange');
91if (empty($id) && $action !=
'add' && $action !=
'create') {
101$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) {
253 print
'Error, token required for this critical operation';
260 if (
$object->admin && empty($user->admin)) {
263 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
264 } elseif (
$object->admin && empty(
$object->entity) && !empty($user->entity)) {
267 setEventMessages($langs->trans(
"OnlySuperAdminUsersCanDeleteSuperAdminUsers"),
null,
'errors');
271 $result =
$object->delete($user);
273 $langs->load(
"errors");
277 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
285 if ($action ==
'add' && $permissiontoadd) {
299 if (!empty(
$conf->file->main_limit_users)) {
300 $nb =
$object->getNbOfUsers(
"active");
301 if ($nb >=
$conf->file->main_limit_users) {
303 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
313 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
328 $object->socialnetworks = array();
329 foreach ($socialnetworks as $key => $value) {
330 if (
GETPOST($key,
'alphanohtml')) {
336 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
343 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
345 $langs->load(
"errors");
346 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
349 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
358 if ($permissiontoseesalary) {
371 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
373 $object->dateemployment = $dateemployment;
374 $object->dateemploymentend = $dateemploymentend;
375 $object->datestartvalidity = $datestartvalidity;
376 $object->dateendvalidity = $dateendvalidity;
378 $object->force_pass_change = $forcepasswordchange;
385 $ret = $extrafields->setOptionalsFromPost(
null, $object);
399 $object->entity = ($entity ==
'' ? 1 : $entity);
403 $object->entity = ($entity ==
'' ? 1 : $entity);
414 if (
GETPOST(
'password',
'password')) {
415 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
417 if (is_int($resPass) && $resPass < 0) {
418 $langs->load(
"errors");
425 $usercats =
GETPOST(
'usercats',
'array:int');
426 $object->setCategories($usercats);
430 if (!empty($backtopage)) {
431 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
433 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
435 header(
"Location: ".$url);
439 $langs->load(
"errors");
448 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
451 $editgroup->fetch($group);
452 $editgroup->oldcopy = clone $editgroup;
456 if ($action ==
'addgroup') {
457 $result =
$object->SetInGroup($group, $editgroup->entity);
459 if ($action ==
'removegroup') {
460 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
471 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
472 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
474 if ($permissiontoedit) {
477 if (!
GETPOST(
"lastname",
'alpha')) {
482 if (!
GETPOST(
"login",
'alpha')) {
504 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
507 if ($permissiontoeditpasswordandsee) {
510 if ($permissiontoeditpasswordandsee) {
513 if (!empty($user->admin) && $user->id != $id) {
518 if ($user->admin && !
$object->ldap_sid) {
531 $object->socialnetworks = array();
532 foreach ($socialnetworks as $key => $value) {
533 if (
GETPOST($key,
'alphanohtml')) {
539 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
546 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
548 $langs->load(
"errors");
549 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
552 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
560 if ($permissiontoseesalary) {
573 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
574 $object->dateemployment = $dateemployment;
575 $object->dateemploymentend = $dateemploymentend;
576 $object->datestartvalidity = $datestartvalidity;
577 $object->dateendvalidity = $dateendvalidity;
579 $object->force_pass_change = $forcepasswordchange;
588 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
602 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
610 if (!empty($_FILES[
'photo'][
'name'])) {
614 if (
$object->id == $user->id) {
619 $langs->load(
"errors");
621 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
626 $passwordismodified = 0;
629 $passwordismodified = 1;
636 if (
$db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
637 $langs->load(
"errors");
638 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
650 if ($contactid > 0) {
652 $contact->fetch($contactid);
654 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
655 $sql .=
" SET fk_socpeople=".((int) $contactid);
656 if (!empty($contact->socid)) {
657 $sql .=
", fk_soc=".((int) $contact->socid);
658 } elseif ($socid > 0) {
659 $sql .=
", fk_soc = null";
660 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
662 $sql .=
" WHERE rowid = ".((int)
$object->id);
663 } elseif ($socid > 0) {
664 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
665 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
666 $sql .=
" WHERE rowid = ".((int)
$object->id);
668 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
669 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
670 $sql .=
" WHERE rowid = ".((int)
$object->id);
673 $resql =
$db->query($sql);
680 if (!$error && !count(
$object->errors)) {
682 $fileimg =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
685 $dirthumbs =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
689 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
690 $dir =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
697 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
700 if (!is_numeric($result) || $result <= 0) {
708 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
717 $langs->load(
"errors");
718 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
723 if (!$error && !count(
$object->errors)) {
725 $categories =
GETPOST(
'usercats',
'array:int');
726 $object->setCategories($categories);
729 if (!$error && !count(
$object->errors)) {
733 $login = $_SESSION[
"dol_login"];
736 $langs->load(
"errors");
737 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
739 if ($passwordismodified &&
$object->login == $user->login) {
741 $langs->load(
"errors");
742 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
743 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
751 if ($permissiontoeditpasswordandsee) {
752 dol_syslog(
"Not allowed to change fields, only password");
756 if (
GETPOST(
"password",
"password")) {
759 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
760 if (is_int($ret) && $ret < 0) {
769 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
770 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
774 $newpassword =
$object->setPassword($user,
'');
775 if (is_int($newpassword) && $newpassword < 0) {
777 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
780 if ($action ==
'confirm_passwordsend') {
781 if (
$object->send_password($user, $newpassword) > 0) {
787 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
793 if ($action ==
'adduserldap' && $permissiontoadd) {
794 $selecteduser =
GETPOST(
'users');
796 $required_fields = array(
813 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
814 foreach ($arrayofsocialnetworks as $socialnetwork) {
820 $result = $ldap->connectBind();
823 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
828 if (is_array($ldapusers)) {
829 foreach ($ldapusers as $key => $attribute) {
841 $ldap_social = array();
844 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
845 foreach ($arrayofsocialnetworks as $socialnetwork) {
846 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
856 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
859 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
863 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
871 $clone->api_key =
'';
872 $clone->admin = ($user->admin ?
$object->admin : 0);
874 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
875 $clone->firstname = $parts[0];
876 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
878 $clone->login = substr($parts[0], 0, 1).$parts[1];
881 $clone->context[
'createfromclone'] =
'createfromclone';
882 $id = $clone->create($user);
883 $refalreadyexists = 0;
886 $result = $clone->cloneRights(
$object->id, $id);
889 if (
GETPOST(
'clone_categories')) {
890 $result = $clone->cloneCategories(
$object->id, $id);
898 if ($clone->error ==
'ErrorProductAlreadyExists') {
902 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
903 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
906 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
910 unset($clone->context[
'createfromclone']);
917 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
928 $triggersendname =
'USER_SENTBYMAIL';
930 $mode =
'emailfromuser';
931 $trackid =
'use'.$id;
932 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
935 $upload_dir =
$conf->user->dir_output;
936 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
939 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
959$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
960$resql =
$db->query($sql);
962 $obj =
$db->fetch_object($resql);
964 $nbofusers = $obj->nb;
972 $title = $person_name.
" - ".$langs->trans(
'Card');
975 $title = $langs->trans(
"NewEmployee");
977 $title = $langs->trans(
"NewUser");
983llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
985if ($action ==
'create' || $action ==
'adduserldap') {
988 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
997 $result = $ldap->connectBind();
999 $required_fields = array(
1019 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1024 if (is_array($ldapusers)) {
1025 foreach ($ldapusers as $key => $ldapuser) {
1028 foreach ($required_fields as $value) {
1030 $label .= $value.
"=******* ";
1032 $label .= $value.
"=".$ldapuser[$value].
" ";
1035 $liste[$key] = $label;
1045 print
"\n\n<!-- Form liste LDAP debut -->\n";
1047 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1048 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1049 print
'<table class="border centpercent"><tr>';
1050 print
'<td width="160">';
1051 print $langs->trans(
"LDAPUsers");
1054 print
'<input type="hidden" name="action" value="adduserldap">';
1055 if (is_array($liste) && count($liste)) {
1056 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1059 print
'</td><td class="center">';
1060 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1061 print
'</td></tr></table>';
1064 print
"\n<!-- Form liste LDAP fin -->\n\n";
1069 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1070 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1071 print
'<input type="hidden" name="action" value="add">';
1072 if (!empty($backtopage)) {
1073 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1075 if (!empty($backtopageforcancel)) {
1076 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1078 if (!empty($ldap_sid)) {
1079 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1081 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1087 print
'<table class="border centpercent">';
1091 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1092 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1098 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1100 if (!empty($ldap_lastname)) {
1101 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1102 print $ldap_lastname;
1104 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1109 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1111 if (!empty($ldap_firstname)) {
1112 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1113 print $ldap_firstname;
1115 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1120 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1122 if (!empty($ldap_login)) {
1123 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1125 } elseif (!empty($ldap_loginsmb)) {
1126 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1127 print $ldap_loginsmb;
1129 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1133 if (!empty(
$conf->use_javascript_ajax)) {
1137 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1138 if ($charforseparator ==
'none') {
1139 $charforseparator =
'';
1142 jQuery(document).ready(function() {
1143 $(".createloginauto").on("keyup", function() {
1144 console.log(".createloginauto change: We generate login when we have a lastname");
1146 lastname = $("#lastname").val().toLowerCase();
1149 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1150 $charforseparator =
'';
1152 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1154 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1160 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1162 login += lastname.replace(/\s+/g, \
'\').trim();
1164 $(
"#login").val(login);
1170 $generated_password = '';
1171 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1172 $generated_password = getRandomPassword(false);
1174 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1177 if (!empty($user->admin)) {
1178 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1180 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1182 if (isModEnabled('multicompany
') && !$user->entity) {
1183 if (!empty($conf->use_javascript_ajax)) {
1184 print '<script
type=
"text/javascript">
1186 $(
"select[name=admin]").change(
function() {
1187 if ( $(
this).val() == 0 ) {
1188 $(
"input[name=superadmin]")
1189 .prop(
"disabled",
true)
1190 .prop(
"checked",
false);
1191 $(
"select[name=entity]")
1192 .prop(
"disabled",
false);
1194 $(
"input[name=superadmin]")
1195 .prop(
"disabled",
false);
1198 $(
"input[name=superadmin]").change(
function() {
1199 if ( $(
this).is(
":checked") ) {
1200 $(
"select[name=entity]")
1201 .prop(
"disabled",
true);
1203 $(
"select[name=entity]")
1204 .prop(
"disabled",
false);
1210 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1211 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1212 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1214 print "</td></tr>\n";
1218 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1220 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1221 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1225 $defaultemployee = '1
';
1227 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1228 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1229 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1233 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1235 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
');
1239 // Expense report validator
1240 if (isModEnabled('expensereport
')) {
1241 print '<tr><td
class=
"titlefieldcreate">
';
1242 $text = $langs->trans("ForceUserExpenseValidator");
1243 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1246 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
');
1251 // Holiday request validator
1252 if (isModEnabled('holiday
')) {
1253 print '<tr><td
class=
"titlefieldcreate">
';
1254 $text = $langs->trans("ForceUserHolidayValidator");
1255 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1258 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
');
1264 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1266 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1270 print '</
table><hr><
table class=
"border centpercent">
';
1274 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1276 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1280 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1285 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1288 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1289 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1291 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1292 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1294 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1295 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1296 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1297 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1300 $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">';
1301 if (!empty(
$conf->use_javascript_ajax)) {
1302 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1307 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1308 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1310 $valuetoshow = $hookmanager->resPrint;
1312 $valuetoshow .= $hookmanager->resPrint;
1319 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
1320 print
'<tr><td class="titlefieldcreate"></td>';
1323 $permissiontoselfeditpassword = 1;
1324 if ($permissiontoselfeditpassword) {
1325 print
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.(GETPOST(
'forcepasswordchange') ==
'1' ?
' checked="checked"' :
'').
'>';
1326 print
'<label class="opacitymedium" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
1328 print
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey valignmiddle" disabled>';
1329 print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"ForcePasswordChange").
'</span>', $langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword"));
1339 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1341 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">';
1342 if (!empty(
$conf->use_javascript_ajax)) {
1343 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1349 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1353 print
'</table><hr><table class="border centpercent">';
1357 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1358 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1360 print
'</textarea></td></tr>';
1363 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1364 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1368 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1369 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1373 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1374 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1375 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1377 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1383 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1384 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1385 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1390 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1392 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1393 if (!empty($ldap_phone)) {
1394 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1397 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1402 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1404 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1405 if (!empty($ldap_mobile)) {
1406 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1409 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'" spellcheck="false">';
1414 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1416 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1417 if (!empty($ldap_fax)) {
1418 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1421 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1426 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1428 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1429 if (!empty($ldap_mail)) {
1430 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1433 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1439 foreach ($socialnetworks as $key => $value) {
1440 if ($value[
'active']) {
1441 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1443 if (!empty($value[
'icon'])) {
1444 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1446 if (!empty($ldap_social[$key])) {
1447 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1448 print $ldap_social[$key];
1450 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1455 if (!empty($ldap_social[$key])) {
1456 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1458 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1466 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1468 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1474 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1476 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1481 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1482 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1483 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1489 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1490 print
'<td class="maxwidthonsmartphone">'.
"\n";
1491 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');
1497 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1499 if (!method_exists($mc,
'formObjectOptions')) {
1500 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1501 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1502 print
"<td>".$mc->select_entities(
$conf->entity);
1503 print
"</td></tr>\n";
1505 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1511 $parameters = array();
1512 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1515 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1516 print
'<td class="wordbreak">';
1517 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1519 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1520 print $doleditor->Create(1);
1524 print
'<tr><td class="tdtop">';
1525 print $langs->trans(
"NotePublic");
1527 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1528 $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%');
1529 $doleditor->Create();
1530 print
"</td></tr>\n";
1533 print
'<tr><td class="tdtop">';
1534 print $langs->trans(
"NotePrivate");
1536 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1537 $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%');
1538 $doleditor->Create();
1539 print
"</td></tr>\n";
1541 print
'</table><hr><table class="border centpercent">';
1548 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1549 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1554 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1556 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1559 if ($permissiontoseesalary) {
1560 $langs->load(
"salaries");
1564 $text = $langs->trans(
"THM");
1565 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1568 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1574 $text = $langs->trans(
"TJM");
1575 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1578 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1583 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1585 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>';
1591 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1593 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1598 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1600 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1604 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1609 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1611 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1619 print $form->buttonsSaveCancel(
"CreateUser");
1625 $res =
$object->fetch($id,
'',
'', 1);
1630 $res =
$object->fetch_optionals();
1640 $passDoNotExpire = 0;
1642 $userChangePassNextLogon = 0;
1648 $result = $ldap->connectBind();
1650 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1651 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1657 if (count($ldap->uacf) > 0) {
1658 foreach ($ldap->uacf as $key => $statut) {
1659 if ($key == 65536) {
1660 $passDoNotExpire = 1;
1661 $statutUACF = $statut;
1666 $statutUACF =
"ACCOUNTDISABLE";
1669 if ($ldap->pwdlastset == 0) {
1670 $userChangePassNextLogon = 1;
1676 if ($mode ==
'employee') {
1677 $title = $langs->trans(
"Employee");
1678 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1680 $title = $langs->trans(
"User");
1683 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1684 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1691 if ($action ==
'password') {
1692 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1696 if ($action ==
'passwordsend') {
1697 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1701 if ($action ==
'disable') {
1702 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1706 if ($action ==
'enable') {
1707 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1711 if ($action ==
'delete') {
1712 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1716 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1717 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1719 $formquestionclone = array(
1720 'text' => $langs->trans(
"ConfirmClone"),
1721 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1722 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1723 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1726 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1727 array_splice($formquestionclone, 2, 0, array($newElement));
1729 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);
1734 if ($action !=
'edit') {
1735 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1737 $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">';
1738 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1739 $morehtmlref .=
'</a>';
1741 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1742 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1744 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1746 print
'<div class="fichecenter">';
1747 print
'<div class="fichehalfleft">';
1749 print
'<div class="underbanner clearboth"></div>';
1750 print
'<table class="border tableforfield centpercent">';
1753 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1754 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1755 print
'<td class="error">';
1756 print $langs->trans(
"LoginAccountDisableInDolibarr");
1762 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1763 } elseif (!empty(
$object->admin)) {
1764 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1773 $text = $langs->trans(
"Type");
1774 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1776 $type = $langs->trans(
"Internal");
1778 $type = $langs->trans(
"External");
1780 print
'<span class="badgeneutral">';
1783 print
' ('.$langs->trans(
"DomainUser").
')';
1786 print
'</td></tr>'.
"\n";
1789 if (
$object->ldap_sid && is_object($ldap)) {
1790 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1791 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1792 print
'</td></tr>'.
"\n";
1796 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1798 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1802 print
'</td></tr>'.
"\n";
1805 if ($nbofusers > 1) {
1807 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1809 if (empty(
$object->fk_user)) {
1810 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1814 $huser->fetch(
$object->fk_user);
1815 print $huser->getNomUrl(-1);
1817 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1826 $text = $langs->trans(
"ForceUserExpenseValidator");
1827 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1830 if (!empty(
$object->fk_user_expense_validator)) {
1832 $evuser->fetch(
$object->fk_user_expense_validator);
1833 print $evuser->getNomUrl(-1);
1842 $text = $langs->trans(
"ForceUserHolidayValidator");
1843 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1846 if (!empty(
$object->fk_user_holiday_validator)) {
1848 $hvuser->fetch(
$object->fk_user_holiday_validator);
1849 print $hvuser->getNomUrl(-1);
1857 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1858 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1862 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1869 if ($permissiontoseesalary) {
1870 $langs->load(
"salaries");
1873 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1875 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1881 $text = $langs->trans(
"THM");
1882 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1885 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1891 $text = $langs->trans(
"TJM");
1892 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1895 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1901 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1903 if (
$object->dateemployment) {
1904 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1907 if (
$object->dateemploymentend) {
1908 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1915 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1923 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1924 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1925 if (
$object->fk_warehouse > 0) {
1927 $warehousestatic->fetch(
$object->fk_warehouse);
1928 print $warehousestatic->getNomUrl(1);
1936 print
'<div class="fichehalfright">';
1938 print
'<div class="underbanner clearboth"></div>';
1940 print
'<table class="border tableforfield centpercent">';
1944 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1946 print $formother->showColor(
$object->color,
'');
1952 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1953 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1955 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1961 $langs->load(
"languages");
1962 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1964 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1968 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1974 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1975 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1976 print
'<td>'.$object->openid.
'</td>';
1981 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1983 if (!method_exists($mc,
'formObjectOptions')) {
1985 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1987 print $langs->trans(
"AllEntities");
1989 $mc->getInfo(
$object->entity);
1992 print
"</td></tr>\n";
1998 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2002 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2007 $societe->fetch(
$object->socid);
2008 if ($societe->id > 0) {
2009 $s .= $societe->getNomUrl(1,
'');
2012 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2014 if (!empty(
$object->contact_id)) {
2016 $contact->fetch(
$object->contact_id);
2017 if ($contact->id > 0) {
2018 if (
$object->socid > 0 && $s) {
2023 $s .= $contact->getNomUrl(1,
'');
2033 $langs->load(
"members");
2034 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2038 $adh->fetch(
$object->fk_member);
2039 $adh->ref = $adh->getFullname($langs);
2040 print $adh->getNomUrl(-1);
2042 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2049 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2051 print
"</td></tr>\n";
2062 print
'<!-- credential section -->'.
"\n";
2063 print
'<div class="div-table-responsive-no-min">';
2064 print
'<table class="noborder tableforfield centpercent">';
2067 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2068 print
'<div class="centpercent display-flex">';
2069 print
'<div class="left inline-block">';
2070 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2077 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2079 if (
$object->datestartvalidity) {
2080 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2083 if (
$object->dateendvalidity) {
2084 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2091 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2092 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"PasswordToChange"), $langs->trans(
"ForcePasswordChange")).
'</td>';
2094 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2095 if ($permissiontoselfeditpassword) {
2097 print
'<input type="checkbox" class="colorgrey" disabled name="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2099 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2102 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2105 print
'<input type="checkbox" name="forcepasswordchange" value="1" disabled class="valignmiddle">';
2106 print
'<span class="opacitymedium" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"No").
'</span>';
2114 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2115 if (!empty(
$object->ldap_sid)) {
2116 if ($passDoNotExpire) {
2117 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2118 } elseif ($userChangePassNextLogon) {
2119 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2120 } elseif ($userDisabled) {
2121 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2123 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2126 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2129 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2130 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2134 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2135 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2137 $valuetoshow = $hookmanager->resPrint;
2139 $valuetoshow .= $hookmanager->resPrint;
2143 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2144 print
'<td class="wordbreak">';
2151 if (
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') && $permissiontoeditpasswordandsee) {
2152 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2154 print
'<div class="centpercent display-flex">';
2155 print
'<span class="badge badge-info">999</span>';
2156 print
'<div class="left inline-block">';
2157 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2159 print
'</span></span>';
2164 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2165 foreach ($tmparrayofauthmode as $tmpauthmode) {
2166 $langs->load(
"oauth");
2168 $tmpauthmode = trim($tmpauthmode);
2169 if (preg_match(
'/oauth/', $tmpauthmode)) {
2170 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2171 print
'<tr class="nooddeven">';
2172 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2173 print
' '.ucfirst($nameofservice).
' ';
2176 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2177 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2185 if (!empty(
$object->email_oauth2)) {
2186 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2196 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin)) {
2197 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2200 print
'<div class="centpercent display-flex">';
2201 print
'<span class="badge badge-info">999</span>';
2205 print
'<div class="left inline-block">';
2206 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2211 if (!empty(
$object->api_key)) {
2212 print
'<span class="opacitymedium">';
2217 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">';
2227 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2229 if (
$object->datepreviouslogin) {
2230 print $form->textwithpicto(
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Previous"));
2233 if (
$object->datepreviouslogin) {
2234 print
' ';
2236 print $form->textwithpicto(
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Currently"));
2246 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2247 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2249 print $hookmanager->resPrint;
2255 print
'<div class="clearboth"></div>';
2264 print
'<div class="tabsAction">';
2266 $parameters = array();
2267 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2268 if (empty($reshook)) {
2272 'class' =>
'classfortooltip'
2276 if (empty($user->socid)) {
2277 $canSendMail =
false;
2279 $langs->load(
"mails");
2280 $canSendMail =
true;
2281 unset($params[
'attr'][
'title']);
2283 $langs->load(
"mails");
2284 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2286 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2291 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2294 unset($params[
'attr'][
'title']);
2297 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2299 unset($params[
'attr'][
'title']);
2307 'class' =>
'classfortooltip'
2312 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2313 $cloneButtonId =
'';
2316 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2318 $cloneButtonId =
'action-clone';
2320 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2324 if (
$object->status == $object::STATUS_DISABLED) {
2325 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2327 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2329 unset($params[
'attr'][
'title']);
2330 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2333 if (
$object->status == $object::STATUS_DISABLED) {
2334 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2335 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2336 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2339 unset($params[
'attr'][
'title']);
2340 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2342 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2343 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2348 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2350 unset($params[
'attr'][
'title']);
2351 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2354 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2356 unset($params[
'attr'][
'title']);
2357 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2359 if ($user->id == $id) {
2360 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2361 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2365 if ($user->id != $id && $permissiontodisable &&
2367 if ($user->admin || !
$object->admin) {
2368 unset($params[
'attr'][
'title']);
2369 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2371 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2372 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2382 if (
GETPOST(
'modelselected')) {
2383 $action =
'presend';
2387 $modelmail =
'user';
2388 $defaulttopic =
'Information';
2389 $diroutput =
$conf->user->dir_output;
2390 $trackid =
'use'.$object->id;
2392 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2394 if ($action !=
'presend' && $action !=
'send') {
2399 if ($permissiontoreadgroup) {
2400 print
'<!-- Group section -->'.
"\n";
2408 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2410 if (!empty($groupslist)) {
2411 foreach ($groupslist as $groupforuser) {
2412 $exclude[] = $groupforuser->id;
2417 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2418 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2419 print $hookmanager->resPrint;
2421 if (empty($reshook)) {
2422 if ($permissiontoeditgroup) {
2423 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2424 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2425 print
'<input type="hidden" name="action" value="addgroup" />';
2426 print
'<input type="hidden" name="page_y" value="" />';
2429 print
'<!-- List of groups of the user -->'.
"\n";
2430 print
'<table class="noborder centpercent">'.
"\n";
2431 print
'<tr class="liste_titre">';
2433 print
'<th class="liste_titre right" colspan="2">';
2434 if ($permissiontoeditgroup) {
2435 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2437 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2438 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2440 print
'</th></tr>'.
"\n";
2443 if (!empty($groupslist)) {
2444 foreach ($groupslist as $group) {
2445 print
'<tr class="oddeven">';
2446 print
'<td class="tdoverflowmax200">';
2447 if ($permissiontoeditgroup) {
2448 print $group->getNomUrl(1);
2450 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2453 print
'<td class="right">';
2454 if ($permissiontoeditgroup) {
2455 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2456 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2461 print
"</td></tr>\n";
2464 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2469 if ($permissiontoeditgroup) {
2481 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2482 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2483 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2484 print
'<input type="hidden" name="action" value="update">';
2485 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2489 print
'<table class="border centpercent">';
2493 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2502 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2504 if ($permissiontoedit && !
$object->ldap_sid) {
2505 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2507 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2514 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2516 if ($permissiontoedit && !
$object->ldap_sid) {
2517 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2519 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2525 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2527 if ($user->admin && !
$object->ldap_sid) {
2528 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2530 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2537 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2539 if ($user->id ==
$object->id || !$user->admin) {
2541 $type = $langs->trans(
"Internal");
2543 $type = $langs->trans(
"External");
2546 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2548 print
' ('.$langs->trans(
"DomainUser").
')';
2557 $eventsCompanyContact = array();
2558 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2560 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2561 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2562 print
'<span class="clearbothonsmartphone"></span>';
2563 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2564 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2566 print
' ('.$langs->trans(
"DomainUser").
')';
2569 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2570 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2571 print
'<span class="clearbothonsmartphone"></span>';
2572 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2573 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2575 print
' ('.$langs->trans(
"DomainUser").
')';
2578 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2579 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2580 print
'<span class="clearbothonsmartphone"></span>';
2581 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2582 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2584 print
' ('.$langs->trans(
"DomainUser").
')';
2587 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2588 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2589 print
'<span class="clearbothonsmartphone"></span>';
2590 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2591 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2597 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2599 $langs->load(
"admin");
2601 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2602 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2606 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2607 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2614 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2617 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2620 if (
$conf->use_javascript_ajax) {
2621 print
'<script type="text/javascript">
2623 var admin = $("select[name=admin]").val();
2625 $("input[name=superadmin]")
2626 .prop("disabled", true)
2627 .prop("checked", false);
2629 if ($("input[name=superadmin]").is(":checked")) {
2630 $("select[name=entity]")
2631 .prop("disabled", true);
2633 $("select[name=admin]").change(function() {
2634 if ( $(this).val() == 0 ) {
2635 $("input[name=superadmin]")
2636 .prop("disabled", true)
2637 .prop("checked", false);
2638 $("select[name=entity]")
2639 .prop("disabled", false);
2641 $("input[name=superadmin]")
2642 .prop("disabled", false);
2645 $("input[name=superadmin]").change(function() {
2646 if ( $(this).is(":checked")) {
2647 $("select[name=entity]")
2648 .prop("disabled", true);
2650 $("select[name=entity]")
2651 .prop("disabled", false);
2658 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2659 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2663 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2664 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2666 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2676 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2677 if ($permissiontoedit && !
$object->ldap_sid) {
2678 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2679 } elseif (
$object->civility_code) {
2680 print $langs->trans(
"Civility".
$object->civility_code);
2686 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2688 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2689 if ($permissiontoedit) {
2692 print $arraygender[
$object->gender];
2698 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2699 if ($permissiontoedit) {
2700 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2703 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2712 if ($nbofusers > 1) {
2714 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2716 if ($permissiontoedit) {
2717 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');
2719 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2721 $huser->fetch(
$object->fk_user);
2722 print $huser->getNomUrl(-1);
2729 print
'<tr><td class="titlefieldcreate">';
2730 $text = $langs->trans(
"ForceUserExpenseValidator");
2731 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2734 if ($permissiontoedit) {
2735 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');
2737 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2739 $evuser->fetch(
$object->fk_user_expense_validator);
2740 print $evuser->getNomUrl(-1);
2748 print
'<tr><td class="titlefieldcreate">';
2749 $text = $langs->trans(
"ForceUserHolidayValidator");
2750 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2753 if ($permissiontoedit) {
2754 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');
2756 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2758 $hvuser->fetch(
$object->fk_user_holiday_validator);
2759 print $hvuser->getNomUrl(-1);
2770 print
'<table class="border centpercent">';
2773 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2775 if ($permissiontoedit) {
2776 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2782 if ($permissiontoedit) {
2783 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2792 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2795 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2796 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2798 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2799 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((
string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (
string) $dolibarr_main_authentication), 1,
'warning');
2801 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2802 if ($permissiontoeditpasswordandsee) {
2803 $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">';
2804 if (!empty(
$conf->use_javascript_ajax)) {
2805 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->transnoentities(
'NoPasswordGenerationRuleConfigured') : $langs->transnoentities(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' ' :
' linkobject').
'"');
2808 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2812 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2813 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2815 $valuetoshow = $hookmanager->resPrint;
2817 $valuetoshow .= $hookmanager->resPrint;
2821 print
"</td></tr>\n";
2824 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2826 print
'<td></td><td>';
2827 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2828 if ($permissiontoselfeditpassword) {
2829 if ($permissiontoedit) {
2830 print
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2831 print
'<label class="opacitylow" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
2833 print
'<input type="checkbox" name="forcepasswordchange" class="colorgrey" disabled value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2834 print $langs->trans(
"ForcePasswordChange");
2837 print
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey" disabled>';
2838 print
'<span class="opacitymedium" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"ForcePasswordChange").
'</span>';
2847 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2849 if ($permissiontoeditpasswordandsee) {
2850 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">';
2851 if (!empty(
$conf->use_javascript_ajax)) {
2852 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2860 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2861 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2863 if ($permissiontoedit) {
2864 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2866 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2872 print
'</table><hr><table class="border centpercent">';
2876 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2878 if ($permissiontoedit) {
2879 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2882 if ($permissiontoedit) {
2883 print
'</textarea>';
2888 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2889 if ($permissiontoedit) {
2890 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2897 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2898 if ($permissiontoedit) {
2899 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2906 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2907 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2908 if ($permissiontoedit) {
2909 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2911 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2915 print $countrylabel;
2921 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2922 if ($permissiontoedit) {
2923 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2924 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2932 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2934 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2935 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2936 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2938 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2944 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2946 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2947 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2948 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'" spellcheck="false">';
2950 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2956 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2958 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2959 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2960 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2962 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2968 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2970 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2971 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2972 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2974 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2980 foreach ($socialnetworks as $key => $value) {
2981 if ($value[
'active']) {
2982 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2984 if (!empty($value[
'icon'])) {
2985 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2987 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2988 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2990 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2991 print
$object->socialnetworks[$key];
2996 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
3001 print
'</table><hr><table class="border centpercent">';
3005 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
3006 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
3007 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>';
3014 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
3016 if ($permissiontoedit) {
3017 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3019 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3020 print
$object->accountancy_code;
3028 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
3030 if ($permissiontoedit) {
3031 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
3033 print $formother->showColor(
$object->color,
'');
3040 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
3042 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
3047 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
3048 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
3050 if ($permissiontoedit) {
3051 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
3053 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
3060 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";
3061 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
3067 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
3069 print
$object->getLibStatut(4);
3097 $langs->load(
"members");
3098 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3102 $adh->fetch(
$object->fk_member);
3103 $adh->ref = $adh->login;
3104 print $adh->getNomUrl(1);
3106 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3114 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
3116 if (!method_exists($mc,
'formObjectOptions')) {
3117 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
3118 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3119 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3120 print
"</td></tr>\n";
3122 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3128 $parameters = array(
'colspan' =>
' colspan="2"');
3130 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3131 print $hookmanager->resPrint;
3132 if (empty($reshook)) {
3133 if ($permissiontoedit) {
3134 print
$object->showOptionals($extrafields,
'edit');
3136 print
$object->showOptionals($extrafields,
'view');
3141 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3143 if ($permissiontoedit) {
3144 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3146 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3147 print $doleditor->Create(1);
3159 print
'<table class="border centpercent">';
3165 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3167 if ($permissiontoedit) {
3168 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3170 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3176 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3178 if ($permissiontoedit) {
3179 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3187 if ($permissiontoseesalary) {
3188 $langs->load(
"salaries");
3191 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3193 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3194 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3200 $text = $langs->trans(
"THM");
3201 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3204 if ($permissiontoedit) {
3205 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3206 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3215 $text = $langs->trans(
"TJM");
3216 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3219 if ($permissiontoedit) {
3220 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3221 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3230 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3232 if ($permissiontoedit) {
3233 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3238 if ($dateemployment && $dateemploymentend) {
3242 if ($permissiontoedit) {
3243 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3251 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3253 if ($permissiontoedit) {
3254 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3265 print
'<div class="center">';
3266 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3267 print
' ';
3268 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3274 if ($action !=
'edit' && $action !=
'presend') {
3275 print
'<div class="fichecenter"><div class="fichehalfleft">';
3280 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3281 $genallowed = $user->hasRight(
"user",
"user",
"read");
3282 $delallowed = $user->hasRight(
"user",
"user",
"write");
3287 $societe->fetch(
$object->socid);
3292 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);
3293 $somethingshown = $formfile->numoffiles;
3297 $morehtmlcenter =
'<div class="nowraponall">';
3298 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3299 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3300 $morehtmlcenter .=
'</div>';
3302 print
'</div><div class="fichehalfright">';
3305 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3307 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3309 print
'</div></div>';
3319include_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)
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
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'.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
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'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
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.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
$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.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
user_prepare_head(User $object)
Prepare array with list of tabs.