40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
54if (isModEnabled(
'ldap')) {
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
57if (isModEnabled(
'member')) {
58 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
60if (isModEnabled(
'category')) {
61 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63if (isModEnabled(
'stock')) {
64 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
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') :
'useracard';
87$backtopage =
GETPOST(
'backtopage');
89if (empty($id) && $action !=
'add' && $action !=
'create') {
99$childids = $user->getAllChildIds(1);
105$extrafields->fetch_name_optionals_label(
$object->table_element);
110$hookmanager->initHooks(array(
'usercard',
'globalcard'));
117 $res =
$object->fetch($id,
'',
'', 1);
122if ($user->socid > 0) {
123 $socid = $user->socid;
129$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
130$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontoreadgroup = $permissiontoread;
134$permissiontoeditgroup = $permissiontoedit;
136 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
137 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
140$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
141$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
142$permissiontocloneuser = $permissiontoadd;
145 $permissiontoclonesuperadmin =
false;
146 $permissiontocloneadmin =
false;
147 $permissiontocloneuser =
false;
150if ($user->id != $id && !$permissiontoread) {
154$caneditpasswordandsee =
false;
155$caneditpasswordandsend =
false;
158$permissiontoeditpasswordandsee =
false;
159$permissiontoeditpasswordandsend =
false;
162 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
163 $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);
164 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
168$permissiontoseesalary = (empty($user->socid) && (
169 (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
170 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
171 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
172 || (!isModEnabled(
'salaries') && !isModEnabled(
'hrm') && (
$id == 0 || in_array($id, $childids))));
174$passwordismodified =
false;
182$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
183$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
188if (empty($reshook)) {
189 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
191 if (empty($backtopage) || ($cancel && empty($id))) {
192 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
193 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
194 $backtopage = $backurlforlist;
196 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
202 if (!empty($backtopageforcancel)) {
203 header(
"Location: ".$backtopageforcancel);
205 } elseif (!empty($backtopage)) {
206 header(
"Location: ".$backtopage);
212 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
213 if ($id != $user->id) {
215 if (
$object->admin && empty($user->admin)) {
218 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
221 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
227 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
230 if ($id != $user->id) {
233 if (!empty(
$conf->file->main_limit_users)) {
234 $nb =
$object->getNbOfUsers(
"active");
235 if ($nb >=
$conf->file->main_limit_users) {
237 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
243 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
249 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
250 if ($id != $user->id) {
251 if (!GETPOSTISSET(
'token')) {
252 print
'Error, token required for this critical operation';
259 if (
$object->admin && empty($user->admin)) {
262 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
266 $result =
$object->delete($user);
268 $langs->load(
"errors");
272 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
280 if ($action ==
'add' && $permissiontoadd) {
294 if (!empty(
$conf->file->main_limit_users)) {
295 $nb =
$object->getNbOfUsers(
"active");
296 if ($nb >=
$conf->file->main_limit_users) {
298 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
308 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
322 if (isModEnabled(
'socialnetworks')) {
323 $object->socialnetworks = array();
324 foreach ($socialnetworks as $key => $value) {
325 if (
GETPOST($key,
'alphanohtml')) {
331 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
338 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
340 $langs->load(
"errors");
341 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
344 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
354 if ($permissiontoseesalary) {
361 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
362 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
367 $object->dateemployment = $dateemployment;
368 $object->dateemploymentend = $dateemploymentend;
369 $object->datestartvalidity = $datestartvalidity;
370 $object->dateendvalidity = $dateendvalidity;
378 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
385 if (isModEnabled(
'multicompany')) {
392 $object->entity = ($entity ==
'' ? 1 : $entity);
396 $object->entity = ($entity ==
'' ? 1 : $entity);
407 if (
GETPOST(
'password',
'password')) {
408 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
410 if (is_int($resPass) && $resPass < 0) {
411 $langs->load(
"errors");
416 if (isModEnabled(
"category")) {
418 $usercats =
GETPOST(
'usercats',
'array');
419 $object->setCategories($usercats);
423 if (!empty($backtopage)) {
424 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
426 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
428 header(
"Location: ".$url);
432 $langs->load(
"errors");
441 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
444 $editgroup->fetch($group);
445 $editgroup->oldcopy = clone $editgroup;
449 if ($action ==
'addgroup') {
450 $result =
$object->SetInGroup($group, $editgroup->entity);
452 if ($action ==
'removegroup') {
453 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
464 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
465 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
467 if ($permissiontoedit) {
470 if (!
GETPOST(
"lastname",
'alpha')) {
475 if (!
GETPOST(
"login",
'alpha')) {
492 if (GETPOSTISSET(
"ref_employee")) {
496 if (GETPOSTISSET(
"national_registration_number")) {
497 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
500 if ($permissiontoeditpasswordandsee) {
503 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
506 if (!empty($user->admin) && $user->id != $id) {
511 if ($user->admin && !
$object->ldap_sid) {
523 if (isModEnabled(
'socialnetworks')) {
524 $object->socialnetworks = array();
525 foreach ($socialnetworks as $key => $value) {
526 if (
GETPOST($key,
'alphanohtml')) {
532 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
539 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
541 $langs->load(
"errors");
542 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
545 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
553 if ($permissiontoseesalary) {
560 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
562 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
567 $object->dateemployment = $dateemployment;
568 $object->dateemploymentend = $dateemploymentend;
569 $object->datestartvalidity = $datestartvalidity;
570 $object->dateendvalidity = $dateendvalidity;
573 if (isModEnabled(
'stock')) {
580 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
594 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
602 if (!empty($_FILES[
'photo'][
'name'])) {
606 if (
$object->id == $user->id) {
611 $langs->load(
"errors");
613 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
618 $passwordismodified = 0;
621 $passwordismodified = 1;
628 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
629 $langs->load(
"errors");
630 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
638 if (!$error && GETPOSTISSET(
'contactid')) {
642 if ($contactid > 0) {
644 $contact->fetch($contactid);
646 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
647 $sql .=
" SET fk_socpeople=".((int) $contactid);
648 if (!empty($contact->socid)) {
649 $sql .=
", fk_soc=".((int) $contact->socid);
650 } elseif ($socid > 0) {
651 $sql .=
", fk_soc = null";
652 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
654 $sql .=
" WHERE rowid = ".((int)
$object->id);
655 } elseif ($socid > 0) {
656 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
657 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
658 $sql .=
" WHERE rowid = ".((int)
$object->id);
660 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
661 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
662 $sql .=
" WHERE rowid = ".((int)
$object->id);
665 $resql = $db->query($sql);
672 if (!$error && !count(
$object->errors)) {
681 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
689 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
692 if (!is_numeric($result) || $result <= 0) {
700 $langs->load(
"errors");
701 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
706 if (!$error && !count(
$object->errors)) {
708 $categories =
GETPOST(
'usercats',
'array');
709 $object->setCategories($categories);
712 if (!$error && !count(
$object->errors)) {
716 $login = $_SESSION[
"dol_login"];
719 $langs->load(
"errors");
720 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
722 if ($passwordismodified &&
$object->login == $user->login) {
724 $langs->load(
"errors");
725 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
726 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
734 if ($permissiontoeditpasswordandsee) {
735 dol_syslog(
"Not allowed to change fields, only password");
739 if (
GETPOST(
"password",
"password")) {
742 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
743 if (is_int($ret) && $ret < 0) {
752 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
753 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
757 $newpassword =
$object->setPassword($user,
'');
758 if (is_int($newpassword) && $newpassword < 0) {
760 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
763 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
764 if (
$object->send_password($user, $newpassword) > 0) {
770 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
776 if ($action ==
'adduserldap' && $permissiontoadd) {
777 $selecteduser =
GETPOST(
'users');
779 $required_fields = array(
795 if (isModEnabled(
'socialnetworks')) {
796 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
797 foreach ($arrayofsocialnetworks as $socialnetwork) {
803 $result = $ldap->connectBind();
806 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
811 if (is_array($ldapusers)) {
812 foreach ($ldapusers as $key => $attribute) {
824 $ldap_social = array();
826 if (isModEnabled(
'socialnetworks')) {
827 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
828 foreach ($arrayofsocialnetworks as $socialnetwork) {
829 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
839 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
842 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
846 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
854 $clone->api_key =
'';
856 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
857 $clone->firstname = $parts[0];
858 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
860 $clone->login = substr($parts[0], 0, 1).$parts[1];
863 $clone->context[
'createfromclone'] =
'createfromclone';
864 $id = $clone->create($user);
865 $refalreadyexists = 0;
868 $result = $clone->cloneRights(
$object->id, $id);
871 if (
GETPOST(
'clone_categories')) {
872 $result = $clone->cloneCategories(
$object->id, $id);
880 if ($clone->error ==
'ErrorProductAlreadyExists') {
884 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
885 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
888 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
892 unset($clone->context[
'createfromclone']);
899 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
910 $triggersendname =
'USER_SENTBYMAIL';
912 $mode =
'emailfromuser';
913 $trackid =
'use'.$id;
914 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
917 $upload_dir =
$conf->user->dir_output;
918 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
926$form =
new Form($db);
932if (isModEnabled(
'stock')) {
938$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
939$resql = $db->query($sql);
941 $obj = $db->fetch_object($resql);
943 $nbofusers = $obj->nb;
951 $title = $person_name.
" - ".$langs->trans(
'Card');
954 $title = $langs->trans(
"NewEmployee");
956 $title = $langs->trans(
"NewUser");
962llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
964if ($action ==
'create' || $action ==
'adduserldap') {
967 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
971 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
976 $result = $ldap->connectBind();
978 $required_fields = array(
998 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1003 if (is_array($ldapusers)) {
1004 foreach ($ldapusers as $key => $ldapuser) {
1007 foreach ($required_fields as $value) {
1009 $label .= $value.
"=******* ";
1011 $label .= $value.
"=".$ldapuser[$value].
" ";
1014 $liste[$key] = $label;
1024 print
"\n\n<!-- Form liste LDAP debut -->\n";
1026 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1027 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1028 print
'<table class="border centpercent"><tr>';
1029 print
'<td width="160">';
1030 print $langs->trans(
"LDAPUsers");
1033 print
'<input type="hidden" name="action" value="adduserldap">';
1034 if (is_array($liste) && count($liste)) {
1035 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1038 print
'</td><td class="center">';
1039 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1040 print
'</td></tr></table>';
1043 print
"\n<!-- Form liste LDAP fin -->\n\n";
1048 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1049 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1050 print
'<input type="hidden" name="action" value="add">';
1051 if (!empty($backtopage)) {
1052 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1054 if (!empty($backtopageforcancel)) {
1055 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1057 if (!empty($ldap_sid)) {
1058 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1060 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1066 print
'<table class="border centpercent">';
1069 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1070 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1075 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1077 if (!empty($ldap_lastname)) {
1078 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1079 print $ldap_lastname;
1081 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1086 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1088 if (!empty($ldap_firstname)) {
1089 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1090 print $ldap_firstname;
1092 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1097 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1099 if (!empty($ldap_login)) {
1100 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1102 } elseif (!empty($ldap_loginsmb)) {
1103 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1104 print $ldap_loginsmb;
1106 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1110 if (!empty(
$conf->use_javascript_ajax)) {
1114 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1115 if ($charforseparator ==
'none') {
1116 $charforseparator =
'';
1119 jQuery(document).ready(function() {
1120 $(".createloginauto").on("keyup", function() {
1121 console.log(".createloginauto change: We generate login when we have a lastname");
1123 lastname = $("#lastname").val().toLowerCase();
1126 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1128 print
' firstname = $("#firstname").val().toLowerCase();';
1134 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1138 $(
"#login").val(login);
1144 $generated_password = '';
1145 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1146 $generated_password = getRandomPassword(false);
1148 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1151 if (!empty($user->admin)) {
1152 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1154 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1156 if (isModEnabled('multicompany
') && !$user->entity) {
1157 if (!empty($conf->use_javascript_ajax)) {
1158 print '<script
type=
"text/javascript">
1160 $(
"select[name=admin]").change(
function() {
1161 if ( $(
this).val() == 0 ) {
1162 $(
"input[name=superadmin]")
1163 .prop(
"disabled",
true)
1164 .prop(
"checked",
false);
1165 $(
"select[name=entity]")
1166 .prop(
"disabled",
false);
1168 $(
"input[name=superadmin]")
1169 .prop(
"disabled",
false);
1172 $(
"input[name=superadmin]").change(
function() {
1173 if ( $(
this).is(
":checked") ) {
1174 $(
"select[name=entity]")
1175 .prop(
"disabled",
true);
1177 $(
"select[name=entity]")
1178 .prop(
"disabled",
false);
1184 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1185 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1186 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1188 print "</td></tr>\n";
1192 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1194 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1195 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1199 $defaultemployee = '1
';
1201 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1202 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1203 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1207 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1209 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
');
1213 // Expense report validator
1214 if (isModEnabled('expensereport
')) {
1215 print '<tr><td
class=
"titlefieldcreate">
';
1216 $text = $langs->trans("ForceUserExpenseValidator");
1217 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1220 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
');
1225 // Holiday request validator
1226 if (isModEnabled('holiday
')) {
1227 print '<tr><td
class=
"titlefieldcreate">
';
1228 $text = $langs->trans("ForceUserHolidayValidator");
1229 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1232 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
');
1238 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1240 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1244 print '</
table><hr><
table class=
"border centpercent">
';
1248 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1250 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1254 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1259 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1262 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1263 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1265 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1266 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1268 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1269 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1270 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1271 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1274 $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">';
1275 if (!empty(
$conf->use_javascript_ajax)) {
1276 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1282 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1283 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1285 $valuetoshow = $hookmanager->resPrint;
1287 $valuetoshow .= $hookmanager->resPrint;
1293 if (isModEnabled(
'api')) {
1296 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1298 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">';
1299 if (!empty(
$conf->use_javascript_ajax)) {
1300 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1306 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1310 print
'</table><hr><table class="border centpercent">';
1314 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1315 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1317 print
'</textarea></td></tr>';
1320 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1321 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1325 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1326 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1330 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1331 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1332 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1334 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1340 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1341 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1342 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1347 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1349 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1350 if (!empty($ldap_phone)) {
1351 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1354 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1359 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1361 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1362 if (!empty($ldap_mobile)) {
1363 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1366 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1371 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1373 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1374 if (!empty($ldap_fax)) {
1375 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1378 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1383 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1385 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1386 if (!empty($ldap_mail)) {
1387 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1390 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1395 if (isModEnabled(
'socialnetworks')) {
1396 foreach ($socialnetworks as $key => $value) {
1397 if ($value[
'active']) {
1398 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1400 if (!empty($value[
'icon'])) {
1401 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1403 if (!empty($ldap_social[$key])) {
1404 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1405 print $ldap_social[$key];
1407 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1412 if (!empty($ldap_social[$key])) {
1413 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1415 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1422 if (isModEnabled(
'accounting')) {
1423 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1425 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1430 if (isModEnabled(
'agenda')) {
1431 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1433 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1438 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1439 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1440 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
1446 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1447 print
'<td class="maxwidthonsmartphone">'.
"\n";
1448 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');
1454 if (isModEnabled(
'multicompany') && is_object($mc)) {
1456 if (!method_exists($mc,
'formObjectOptions')) {
1457 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1458 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1459 print
"<td>".$mc->select_entities(
$conf->entity);
1460 print
"</td></tr>\n";
1462 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1468 $parameters = array();
1469 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1472 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1473 print
'<td class="wordbreak">';
1474 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1476 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1477 print $doleditor->Create(1);
1481 print
'<tr><td class="tdtop">';
1482 print $langs->trans(
"NotePublic");
1484 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1485 $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%');
1486 $doleditor->Create();
1487 print
"</td></tr>\n";
1490 print
'<tr><td class="tdtop">';
1491 print $langs->trans(
"NotePrivate");
1493 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1494 $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%');
1495 $doleditor->Create();
1496 print
"</td></tr>\n";
1498 print
'</table><hr><table class="border centpercent">';
1505 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1506 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1511 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1513 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1516 if ($permissiontoseesalary) {
1517 $langs->load(
"salaries");
1521 $text = $langs->trans(
"THM");
1522 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1525 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1531 $text = $langs->trans(
"TJM");
1532 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1535 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1540 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1542 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1548 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1550 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1555 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1557 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1561 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1566 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1568 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1576 print $form->buttonsSaveCancel(
"CreateUser");
1582 $res =
$object->fetch($id,
'',
'', 1);
1587 $res =
$object->fetch_optionals();
1597 $passDoNotExpire = 0;
1599 $userChangePassNextLogon = 0;
1603 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1605 $result = $ldap->connectBind();
1607 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1608 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1614 if (count($ldap->uacf) > 0) {
1615 foreach ($ldap->uacf as $key => $statut) {
1616 if ($key == 65536) {
1617 $passDoNotExpire = 1;
1618 $statutUACF = $statut;
1623 $statutUACF =
"ACCOUNTDISABLE";
1626 if ($ldap->pwdlastset == 0) {
1627 $userChangePassNextLogon = 1;
1633 if ($mode ==
'employee') {
1634 $title = $langs->trans(
"Employee");
1635 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1637 $title = $langs->trans(
"User");
1640 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1641 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1648 if ($action ==
'password') {
1649 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1653 if ($action ==
'passwordsend') {
1654 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1658 if ($action ==
'disable') {
1659 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1663 if ($action ==
'enable') {
1664 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1668 if ($action ==
'delete') {
1669 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1673 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1674 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1676 $formquestionclone = array(
1677 'text' => $langs->trans(
"ConfirmClone"),
1678 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1679 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1680 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1683 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1684 array_splice($formquestionclone, 2, 0, array($newElement));
1686 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);
1691 if ($action !=
'edit') {
1692 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1694 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid valignmiddle" rel="noopener">';
1695 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1696 $morehtmlref .=
'</a>';
1698 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1699 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1701 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1703 print
'<div class="fichecenter">';
1704 print
'<div class="fichehalfleft">';
1706 print
'<div class="underbanner clearboth"></div>';
1707 print
'<table class="border tableforfield centpercent">';
1710 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1712 print
'<td class="error">';
1713 print $langs->trans(
"LoginAccountDisableInDolibarr");
1718 if (property_exists(
$object,
'admin')) {
1719 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1720 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft valignmiddle"');
1721 } elseif (!empty(
$object->admin)) {
1722 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft valignmiddle"');
1732 $text = $langs->trans(
"Type");
1733 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1735 $type = $langs->trans(
"Internal");
1737 $type = $langs->trans(
"External");
1739 print
'<span class="badgeneutral">';
1742 print
' ('.$langs->trans(
"DomainUser").
')';
1745 print
'</td></tr>'.
"\n";
1748 if (
$object->ldap_sid && is_object($ldap)) {
1749 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1750 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1751 print
'</td></tr>'.
"\n";
1755 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1757 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1761 print
'</td></tr>'.
"\n";
1764 if ($nbofusers > 1) {
1766 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1768 if (empty(
$object->fk_user)) {
1769 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1771 $huser =
new User($db);
1773 $huser->fetch(
$object->fk_user);
1774 print $huser->getNomUrl(-1);
1776 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1783 if (isModEnabled(
'expensereport')) {
1785 $text = $langs->trans(
"ForceUserExpenseValidator");
1786 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1789 if (!empty(
$object->fk_user_expense_validator)) {
1790 $evuser =
new User($db);
1791 $evuser->fetch(
$object->fk_user_expense_validator);
1792 print $evuser->getNomUrl(-1);
1799 if (isModEnabled(
'holiday')) {
1801 $text = $langs->trans(
"ForceUserHolidayValidator");
1802 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1805 if (!empty(
$object->fk_user_holiday_validator)) {
1806 $hvuser =
new User($db);
1807 $hvuser->fetch(
$object->fk_user_holiday_validator);
1808 print $hvuser->getNomUrl(-1);
1816 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1817 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1821 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1828 if ($permissiontoseesalary) {
1829 $langs->load(
"salaries");
1832 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1834 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1840 $text = $langs->trans(
"THM");
1841 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1850 $text = $langs->trans(
"TJM");
1851 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1860 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1862 if (
$object->dateemployment) {
1863 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1866 if (
$object->dateemploymentend) {
1867 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1874 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1882 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1883 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1884 if (
$object->fk_warehouse > 0) {
1885 $warehousestatic =
new Entrepot($db);
1886 $warehousestatic->fetch(
$object->fk_warehouse);
1887 print $warehousestatic->getNomUrl(1);
1895 print
'<div class="fichehalfright">';
1897 print
'<div class="underbanner clearboth"></div>';
1899 print
'<table class="border tableforfield centpercent">';
1902 if (isModEnabled(
'agenda')) {
1903 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1905 print $formother->showColor(
$object->color,
'');
1911 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1912 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1914 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1920 $langs->load(
"languages");
1921 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1923 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1927 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1933 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1934 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1935 print
'<td>'.$object->openid.
'</td>';
1940 if (isModEnabled(
'multicompany') && is_object($mc)) {
1942 if (!method_exists($mc,
'formObjectOptions')) {
1943 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1944 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1946 print $langs->trans(
"AllEntities");
1948 $mc->getInfo(
$object->entity);
1951 print
"</td></tr>\n";
1957 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1960 if (isModEnabled(
"societe")) {
1961 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1966 $societe->fetch(
$object->socid);
1967 if ($societe->id > 0) {
1968 $s .= $societe->getNomUrl(1,
'');
1971 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1973 if (!empty(
$object->contact_id)) {
1975 $contact->fetch(
$object->contact_id);
1976 if ($contact->id > 0) {
1977 if (
$object->socid > 0 && $s) {
1982 $s .= $contact->getNomUrl(1,
'');
1991 if (isModEnabled(
'member')) {
1992 $langs->load(
"members");
1993 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1997 $adh->fetch(
$object->fk_member);
1998 $adh->ref = $adh->getFullname($langs);
1999 print $adh->getNomUrl(-1);
2001 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2008 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2010 print
"</td></tr>\n";
2018 print
'<div class="div-table-responsive-no-min">';
2019 print
'<table class="noborder tableforfield centpercent">';
2021 print
'<tr class="liste_titre"><th class="liste_titre">';
2022 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
2024 print
'<th class="liste_titre"></th>';
2028 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2030 if (
$object->datestartvalidity) {
2031 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2034 if (
$object->dateendvalidity) {
2035 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2042 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
2043 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2052 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2053 if (!empty(
$object->ldap_sid)) {
2054 if ($passDoNotExpire) {
2055 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2056 } elseif ($userChangePassNextLogon) {
2057 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2058 } elseif ($userDisabled) {
2059 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2061 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2064 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2067 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2068 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2089 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2090 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2092 $valuetoshow = $hookmanager->resPrint;
2094 $valuetoshow .= $hookmanager->resPrint;
2098 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2099 print
'<td class="wordbreak">';
2106 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2107 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2109 if (!empty(
$object->api_key)) {
2110 print
'<span class="opacitymedium">';
2116 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">'.
getDolUserInt(
'API_COUNT_CALL').
'</span>';
2122 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2124 if (
$object->datepreviouslogin) {
2125 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2128 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2137 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2138 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters,
$object, $action);
2140 print $hookmanager->resPrint;
2146 print
'<div class="clearboth"></div>';
2155 print
'<div class="tabsAction">';
2157 $parameters = array();
2158 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2159 if (empty($reshook)) {
2163 'class' =>
'classfortooltip'
2167 if (empty($user->socid)) {
2168 $canSendMail =
false;
2170 $langs->load(
"mails");
2171 $canSendMail =
true;
2172 unset($params[
'attr'][
'title']);
2174 $langs->load(
"mails");
2175 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2177 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2180 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2182 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2183 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2185 unset($params[
'attr'][
'title']);
2188 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2190 unset($params[
'attr'][
'title']);
2191 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2198 'class' =>
'classfortooltip'
2203 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2204 $cloneButtonId =
'';
2207 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2209 $cloneButtonId =
'action-clone';
2211 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2215 if (
$object->status == $object::STATUS_DISABLED) {
2216 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2217 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2218 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2220 unset($params[
'attr'][
'title']);
2221 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2224 if (
$object->status == $object::STATUS_DISABLED) {
2225 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2226 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2227 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2230 unset($params[
'attr'][
'title']);
2231 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2233 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2234 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2239 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2241 unset($params[
'attr'][
'title']);
2242 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2245 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2247 unset($params[
'attr'][
'title']);
2248 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2250 if ($user->id == $id) {
2251 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2252 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2256 if ($user->id != $id && $permissiontodisable &&
2258 if ($user->admin || !
$object->admin) {
2259 unset($params[
'attr'][
'title']);
2260 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2262 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2263 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2273 if (
GETPOST(
'modelselected')) {
2274 $action =
'presend';
2278 $modelmail =
'user';
2279 $defaulttopic =
'Information';
2280 $diroutput =
$conf->user->dir_output;
2281 $trackid =
'use'.$object->id;
2283 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2285 if ($action !=
'presend' && $action !=
'send') {
2290 if ($permissiontoreadgroup) {
2291 print
'<!-- Group section -->'.
"\n";
2299 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2301 if (!empty($groupslist)) {
2302 foreach ($groupslist as $groupforuser) {
2303 $exclude[] = $groupforuser->id;
2308 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2309 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2310 print $hookmanager->resPrint;
2312 if (empty($reshook)) {
2313 if ($permissiontoeditgroup) {
2314 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2315 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2316 print
'<input type="hidden" name="action" value="addgroup" />';
2317 print
'<input type="hidden" name="page_y" value="" />';
2320 print
'<!-- List of groups of the user -->'.
"\n";
2321 print
'<table class="noborder centpercent">'.
"\n";
2322 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2323 print
'<th class="liste_titre right">';
2324 if ($permissiontoeditgroup) {
2325 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2327 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2328 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2330 print
'</th></tr>'.
"\n";
2333 if (!empty($groupslist)) {
2334 foreach ($groupslist as $group) {
2335 print
'<tr class="oddeven">';
2336 print
'<td class="tdoverflowmax200">';
2337 if ($permissiontoeditgroup) {
2338 print $group->getNomUrl(1);
2340 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2343 print
'<td class="right">';
2344 if ($permissiontoeditgroup) {
2345 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2346 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2351 print
"</td></tr>\n";
2354 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2359 if ($permissiontoeditgroup) {
2371 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2372 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2373 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2374 print
'<input type="hidden" name="action" value="update">';
2375 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2379 print
'<table class="border centpercent">';
2383 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2391 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2392 if ($permissiontoedit && !
$object->ldap_sid) {
2393 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2394 } elseif (
$object->civility_code) {
2395 print $langs->trans(
"Civility".
$object->civility_code);
2401 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2403 if ($permissiontoedit && !
$object->ldap_sid) {
2404 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2406 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2413 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2415 if ($permissiontoedit && !
$object->ldap_sid) {
2416 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2418 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2424 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2426 if ($user->admin && !
$object->ldap_sid) {
2427 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2429 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2436 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2438 $langs->load(
"admin");
2440 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2441 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2445 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2446 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2452 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2453 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2456 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2458 if (isModEnabled(
'multicompany') && !$user->entity) {
2459 if (
$conf->use_javascript_ajax) {
2460 print
'<script type="text/javascript">
2462 var admin = $("select[name=admin]").val();
2464 $("input[name=superadmin]")
2465 .prop("disabled", true)
2466 .prop("checked", false);
2468 if ($("input[name=superadmin]").is(":checked")) {
2469 $("select[name=entity]")
2470 .prop("disabled", true);
2472 $("select[name=admin]").change(function() {
2473 if ( $(this).val() == 0 ) {
2474 $("input[name=superadmin]")
2475 .prop("disabled", true)
2476 .prop("checked", false);
2477 $("select[name=entity]")
2478 .prop("disabled", false);
2480 $("input[name=superadmin]")
2481 .prop("disabled", false);
2484 $("input[name=superadmin]").change(function() {
2485 if ( $(this).is(":checked")) {
2486 $("select[name=entity]")
2487 .prop("disabled", true);
2489 $("select[name=entity]")
2490 .prop("disabled", false);
2497 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2498 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2502 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2503 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2504 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2505 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2514 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2516 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2517 if ($permissiontoedit) {
2518 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2520 print $arraygender[
$object->gender];
2526 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2527 if ($permissiontoedit) {
2528 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2531 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2540 if ($nbofusers > 1) {
2542 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2544 if ($permissiontoedit) {
2545 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');
2547 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2548 $huser =
new User($db);
2549 $huser->fetch(
$object->fk_user);
2550 print $huser->getNomUrl(-1);
2556 if (isModEnabled(
'expensereport')) {
2557 print
'<tr><td class="titlefieldcreate">';
2558 $text = $langs->trans(
"ForceUserExpenseValidator");
2559 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2562 if ($permissiontoedit) {
2563 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');
2565 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2566 $evuser =
new User($db);
2567 $evuser->fetch(
$object->fk_user_expense_validator);
2568 print $evuser->getNomUrl(-1);
2575 if (isModEnabled(
'holiday')) {
2576 print
'<tr><td class="titlefieldcreate">';
2577 $text = $langs->trans(
"ForceUserHolidayValidator");
2578 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2581 if ($permissiontoedit) {
2582 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');
2584 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2585 $hvuser =
new User($db);
2586 $hvuser->fetch(
$object->fk_user_holiday_validator);
2587 print $hvuser->getNomUrl(-1);
2595 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2597 if ($user->id ==
$object->id || !$user->admin) {
2599 $type = $langs->trans(
"Internal");
2601 $type = $langs->trans(
"External");
2604 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2606 print
' ('.$langs->trans(
"DomainUser").
')';
2615 $eventsCompanyContact = array();
2616 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2618 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2619 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2620 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2621 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2623 print
' ('.$langs->trans(
"DomainUser").
')';
2626 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2627 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2628 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2629 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2631 print
' ('.$langs->trans(
"DomainUser").
')';
2634 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2635 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2636 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2637 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2639 print
' ('.$langs->trans(
"DomainUser").
')';
2642 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2643 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2644 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2645 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2654 print
'<table class="border centpercent">';
2657 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2659 if ($permissiontoedit) {
2660 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2666 if ($permissiontoedit) {
2667 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2675 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2678 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2679 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2681 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2682 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2684 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2685 if ($permissiontoeditpasswordandsee) {
2686 $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">';
2687 if (!empty(
$conf->use_javascript_ajax)) {
2688 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->transnoentities(
'NoPasswordGenerationRuleConfigured') : $langs->transnoentities(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2691 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2695 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2696 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2698 $valuetoshow = $hookmanager->resPrint;
2700 $valuetoshow .= $hookmanager->resPrint;
2704 print
"</td></tr>\n";
2707 if (isModEnabled(
'api')) {
2708 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2710 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2711 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2712 if (!empty(
$conf->use_javascript_ajax)) {
2713 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2720 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2721 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2723 if ($permissiontoedit) {
2724 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2726 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2732 print
'</table><hr><table class="border centpercent">';
2736 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2738 if ($permissiontoedit) {
2739 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2742 if ($permissiontoedit) {
2743 print
'</textarea>';
2748 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2749 if ($permissiontoedit) {
2750 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2757 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2758 if ($permissiontoedit) {
2759 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2766 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2767 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2768 if ($permissiontoedit) {
2769 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2771 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2775 print $countrylabel;
2781 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2782 if ($permissiontoedit) {
2783 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2784 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2792 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2794 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2795 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2796 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2798 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2804 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2806 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2807 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2808 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'">';
2810 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2816 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2818 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2819 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2820 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2822 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2828 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2830 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2831 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2832 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2834 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2839 if (isModEnabled(
'socialnetworks')) {
2840 foreach ($socialnetworks as $key => $value) {
2841 if ($value[
'active']) {
2842 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2844 if (!empty($value[
'icon'])) {
2845 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2847 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2848 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2850 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2851 print
$object->socialnetworks[$key];
2856 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2861 print
'</table><hr><table class="border centpercent">';
2865 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2866 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2867 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>';
2872 if (isModEnabled(
'accounting')) {
2874 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2876 if ($permissiontoedit) {
2877 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2879 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2880 print
$object->accountancy_code;
2887 if (isModEnabled(
'agenda')) {
2888 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2890 if ($permissiontoedit) {
2891 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2893 print $formother->showColor(
$object->color,
'');
2900 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2902 print $form->showphoto(
'userphoto',
$object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2907 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2908 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2910 if ($permissiontoedit) {
2911 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
2913 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2920 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";
2921 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2927 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2929 print
$object->getLibStatut(4);
2956 if (isModEnabled(
'member')) {
2957 $langs->load(
"members");
2958 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2962 $adh->fetch(
$object->fk_member);
2963 $adh->ref = $adh->login;
2964 print $adh->getNomUrl(1);
2966 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2974 if (isModEnabled(
'multicompany') && is_object($mc)) {
2976 if (!method_exists($mc,
'formObjectOptions')) {
2977 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2978 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2979 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
2980 print
"</td></tr>\n";
2982 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2988 $parameters = array(
'colspan' =>
' colspan="2"');
2990 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2991 print $hookmanager->resPrint;
2992 if (empty($reshook)) {
2993 if ($permissiontoedit) {
2994 print
$object->showOptionals($extrafields,
'edit');
2996 print
$object->showOptionals($extrafields,
'view');
3001 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3003 if ($permissiontoedit) {
3004 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3006 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3007 print $doleditor->Create(1);
3019 print
'<table class="border centpercent">';
3025 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3027 if ($permissiontoedit) {
3028 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3030 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3036 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3038 if ($permissiontoedit) {
3039 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3047 if ($permissiontoseesalary) {
3048 $langs->load(
"salaries");
3051 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3053 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3059 $text = $langs->trans(
"THM");
3060 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3063 if ($permissiontoedit) {
3064 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3073 $text = $langs->trans(
"TJM");
3074 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3077 if ($permissiontoedit) {
3078 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3087 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3089 if ($permissiontoedit) {
3090 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3095 if ($dateemployment && $dateemploymentend) {
3099 if ($permissiontoedit) {
3100 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3108 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3110 if ($permissiontoedit) {
3111 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3122 print
'<div class="center">';
3123 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3124 print
' ';
3125 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3131 if ($action !=
'edit' && $action !=
'presend') {
3132 print
'<div class="fichecenter"><div class="fichehalfleft">';
3137 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3138 $genallowed = $user->hasRight(
"user",
"user",
"read");
3139 $delallowed = $user->hasRight(
"user",
"user",
"write");
3144 $societe->fetch(
$object->socid);
3149 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);
3150 $somethingshown = $formfile->numoffiles;
3153 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3154 $linktoelem = $tmparray[
'linktoelem'];
3155 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3156 print $htmltoenteralink;
3158 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3162 $morehtmlcenter =
'<div class="nowraponall">';
3163 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3164 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3165 $morehtmlcenter .=
'</div>';
3167 print
'</div><div class="fichehalfright">';
3170 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3172 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3174 print
'</div></div>';
3177 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3184include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3186if (isModEnabled(
'api')) {
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_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.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.