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);
388 $cansetentity = (!empty($user->admin) && empty($user->entity));
389 $entity = $cansetentity ?
GETPOSTINT(
'entity') : $user->entity;
390 if (isModEnabled(
'multicompany')) {
391 if ($cansetentity &&
GETPOSTINT(
'superadmin')) {
397 $object->entity = ($entity ==
'' ? 1 : $entity);
401 $object->entity = ($entity ==
'' ? 1 : $entity);
412 if (
GETPOST(
'password',
'password')) {
413 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
415 if (is_int($resPass) && $resPass < 0) {
416 $langs->load(
"errors");
421 if (isModEnabled(
"category")) {
423 $usercats =
GETPOST(
'usercats',
'array');
424 $object->setCategories($usercats);
428 if (!empty($backtopage)) {
429 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
431 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
433 header(
"Location: ".$url);
437 $langs->load(
"errors");
446 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
449 $editgroup->fetch($group);
450 $editgroup->oldcopy = clone $editgroup;
454 if ($action ==
'addgroup') {
455 $result =
$object->SetInGroup($group, $editgroup->entity);
457 if ($action ==
'removegroup') {
458 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
469 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
470 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
472 if ($permissiontoedit) {
475 if (!
GETPOST(
"lastname",
'alpha')) {
480 if (!
GETPOST(
"login",
'alpha')) {
497 if (GETPOSTISSET(
"ref_employee")) {
501 if (GETPOSTISSET(
"national_registration_number")) {
502 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
505 if ($permissiontoeditpasswordandsee) {
508 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
511 if (!empty($user->admin) && $user->id != $id) {
516 if ($user->admin && !
$object->ldap_sid) {
528 if (isModEnabled(
'socialnetworks')) {
529 $object->socialnetworks = array();
530 foreach ($socialnetworks as $key => $value) {
531 if (
GETPOST($key,
'alphanohtml')) {
537 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
544 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
546 $langs->load(
"errors");
547 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
550 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
558 if ($permissiontoseesalary) {
565 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
567 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
572 $object->dateemployment = $dateemployment;
573 $object->dateemploymentend = $dateemploymentend;
574 $object->datestartvalidity = $datestartvalidity;
575 $object->dateendvalidity = $dateendvalidity;
578 if (isModEnabled(
'stock')) {
585 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
599 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
607 if (!empty($_FILES[
'photo'][
'name'])) {
611 if (
$object->id == $user->id) {
616 $langs->load(
"errors");
618 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
623 $passwordismodified = 0;
626 $passwordismodified = 1;
633 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
634 $langs->load(
"errors");
635 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
643 if (!$error && GETPOSTISSET(
'contactid')) {
647 if ($contactid > 0) {
649 $contact->fetch($contactid);
651 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
652 $sql .=
" SET fk_socpeople=".((int) $contactid);
653 if (!empty($contact->socid)) {
654 $sql .=
", fk_soc=".((int) $contact->socid);
655 } elseif ($socid > 0) {
656 $sql .=
", fk_soc = null";
657 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
659 $sql .=
" WHERE rowid = ".((int)
$object->id);
660 } elseif ($socid > 0) {
661 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
662 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
663 $sql .=
" WHERE rowid = ".((int)
$object->id);
665 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
666 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
667 $sql .=
" WHERE rowid = ".((int)
$object->id);
670 $resql = $db->query($sql);
677 if (!$error && !count(
$object->errors)) {
686 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
694 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
697 if (!is_numeric($result) || $result <= 0) {
705 $langs->load(
"errors");
706 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
711 if (!$error && !count(
$object->errors)) {
713 $categories =
GETPOST(
'usercats',
'array');
714 $object->setCategories($categories);
717 if (!$error && !count(
$object->errors)) {
721 $login = $_SESSION[
"dol_login"];
724 $langs->load(
"errors");
725 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
727 if ($passwordismodified &&
$object->login == $user->login) {
729 $langs->load(
"errors");
730 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
731 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
739 if ($permissiontoeditpasswordandsee) {
740 dol_syslog(
"Not allowed to change fields, only password");
744 if (
GETPOST(
"password",
"password")) {
747 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
748 if (is_int($ret) && $ret < 0) {
757 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
758 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
762 $newpassword =
$object->setPassword($user,
'');
763 if (is_int($newpassword) && $newpassword < 0) {
765 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
768 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
769 if (
$object->send_password($user, $newpassword) > 0) {
775 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
781 if ($action ==
'adduserldap' && $permissiontoadd) {
782 $selecteduser =
GETPOST(
'users');
784 $required_fields = array(
800 if (isModEnabled(
'socialnetworks')) {
801 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
802 foreach ($arrayofsocialnetworks as $socialnetwork) {
808 $result = $ldap->connectBind();
811 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
816 if (is_array($ldapusers)) {
817 foreach ($ldapusers as $key => $attribute) {
829 $ldap_social = array();
831 if (isModEnabled(
'socialnetworks')) {
832 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
833 foreach ($arrayofsocialnetworks as $socialnetwork) {
834 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
844 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
847 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
851 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
859 $clone->api_key =
'';
861 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
862 $clone->firstname = $parts[0];
863 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
865 $clone->login = substr($parts[0], 0, 1).$parts[1];
868 $clone->context[
'createfromclone'] =
'createfromclone';
869 $id = $clone->create($user);
870 $refalreadyexists = 0;
873 $result = $clone->cloneRights(
$object->id, $id);
876 if (
GETPOST(
'clone_categories')) {
877 $result = $clone->cloneCategories(
$object->id, $id);
885 if ($clone->error ==
'ErrorProductAlreadyExists') {
889 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
890 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
893 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
897 unset($clone->context[
'createfromclone']);
904 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
915 $triggersendname =
'USER_SENTBYMAIL';
917 $mode =
'emailfromuser';
918 $trackid =
'use'.$id;
919 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
922 $upload_dir =
$conf->user->dir_output;
923 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
931$form =
new Form($db);
937if (isModEnabled(
'stock')) {
943$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
944$resql = $db->query($sql);
946 $obj = $db->fetch_object($resql);
948 $nbofusers = $obj->nb;
956 $title = $person_name.
" - ".$langs->trans(
'Card');
959 $title = $langs->trans(
"NewEmployee");
961 $title = $langs->trans(
"NewUser");
967llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
969if ($action ==
'create' || $action ==
'adduserldap') {
972 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
976 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
981 $result = $ldap->connectBind();
983 $required_fields = array(
1003 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1008 if (is_array($ldapusers)) {
1009 foreach ($ldapusers as $key => $ldapuser) {
1012 foreach ($required_fields as $value) {
1014 $label .= $value.
"=******* ";
1016 $label .= $value.
"=".$ldapuser[$value].
" ";
1019 $liste[$key] = $label;
1029 print
"\n\n<!-- Form liste LDAP debut -->\n";
1031 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1032 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1033 print
'<table class="border centpercent"><tr>';
1034 print
'<td width="160">';
1035 print $langs->trans(
"LDAPUsers");
1038 print
'<input type="hidden" name="action" value="adduserldap">';
1039 if (is_array($liste) && count($liste)) {
1040 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1043 print
'</td><td class="center">';
1044 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1045 print
'</td></tr></table>';
1048 print
"\n<!-- Form liste LDAP fin -->\n\n";
1053 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1054 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1055 print
'<input type="hidden" name="action" value="add">';
1056 if (!empty($backtopage)) {
1057 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1059 if (!empty($backtopageforcancel)) {
1060 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1062 if (!empty($ldap_sid)) {
1063 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1065 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1071 print
'<table class="border centpercent">';
1074 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1075 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1080 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1082 if (!empty($ldap_lastname)) {
1083 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1084 print $ldap_lastname;
1086 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1091 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1093 if (!empty($ldap_firstname)) {
1094 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1095 print $ldap_firstname;
1097 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1102 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1104 if (!empty($ldap_login)) {
1105 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1107 } elseif (!empty($ldap_loginsmb)) {
1108 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1109 print $ldap_loginsmb;
1111 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1115 if (!empty(
$conf->use_javascript_ajax)) {
1119 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1120 if ($charforseparator ==
'none') {
1121 $charforseparator =
'';
1124 jQuery(document).ready(function() {
1125 $(".createloginauto").on("keyup", function() {
1126 console.log(".createloginauto change: We generate login when we have a lastname");
1128 lastname = $("#lastname").val().toLowerCase();
1131 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1133 print
' firstname = $("#firstname").val().toLowerCase();';
1139 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1143 $(
"#login").val(login);
1149 $generated_password = '';
1150 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1151 $generated_password = getRandomPassword(false);
1153 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1156 if (!empty($user->admin)) {
1157 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1159 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1161 if (isModEnabled('multicompany
') && !$user->entity) {
1162 if (!empty($conf->use_javascript_ajax)) {
1163 print '<script
type=
"text/javascript">
1165 $(
"select[name=admin]").change(
function() {
1166 if ( $(
this).val() == 0 ) {
1167 $(
"input[name=superadmin]")
1168 .prop(
"disabled",
true)
1169 .prop(
"checked",
false);
1170 $(
"select[name=entity]")
1171 .prop(
"disabled",
false);
1173 $(
"input[name=superadmin]")
1174 .prop(
"disabled",
false);
1177 $(
"input[name=superadmin]").change(
function() {
1178 if ( $(
this).is(
":checked") ) {
1179 $(
"select[name=entity]")
1180 .prop(
"disabled",
true);
1182 $(
"select[name=entity]")
1183 .prop(
"disabled",
false);
1189 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1190 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1191 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1193 print "</td></tr>\n";
1197 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1199 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1200 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1204 $defaultemployee = '1
';
1206 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1207 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1208 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1212 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1214 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
');
1218 // Expense report validator
1219 if (isModEnabled('expensereport
')) {
1220 print '<tr><td
class=
"titlefieldcreate">
';
1221 $text = $langs->trans("ForceUserExpenseValidator");
1222 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1225 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
');
1230 // Holiday request validator
1231 if (isModEnabled('holiday
')) {
1232 print '<tr><td
class=
"titlefieldcreate">
';
1233 $text = $langs->trans("ForceUserHolidayValidator");
1234 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1237 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
');
1243 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1245 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1249 print '</
table><hr><
table class=
"border centpercent">
';
1253 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1255 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1259 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1264 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1267 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1268 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1270 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1271 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1273 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1274 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1275 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1276 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1279 $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">';
1280 if (!empty(
$conf->use_javascript_ajax)) {
1281 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1287 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1288 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1290 $valuetoshow = $hookmanager->resPrint;
1292 $valuetoshow .= $hookmanager->resPrint;
1298 if (isModEnabled(
'api')) {
1301 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1303 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">';
1304 if (!empty(
$conf->use_javascript_ajax)) {
1305 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1311 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1315 print
'</table><hr><table class="border centpercent">';
1319 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1320 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1322 print
'</textarea></td></tr>';
1325 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1326 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1330 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1331 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1335 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1336 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1337 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1339 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1345 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1346 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1347 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1352 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1354 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1355 if (!empty($ldap_phone)) {
1356 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1359 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1364 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1366 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1367 if (!empty($ldap_mobile)) {
1368 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1371 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1376 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1378 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1379 if (!empty($ldap_fax)) {
1380 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1383 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1388 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1390 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1391 if (!empty($ldap_mail)) {
1392 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1395 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1400 if (isModEnabled(
'socialnetworks')) {
1401 foreach ($socialnetworks as $key => $value) {
1402 if ($value[
'active']) {
1403 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1405 if (!empty($value[
'icon'])) {
1406 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1408 if (!empty($ldap_social[$key])) {
1409 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1410 print $ldap_social[$key];
1412 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1417 if (!empty($ldap_social[$key])) {
1418 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1420 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1427 if (isModEnabled(
'accounting')) {
1428 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1430 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1435 if (isModEnabled(
'agenda')) {
1436 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1438 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1443 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1444 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1445 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
1451 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1452 print
'<td class="maxwidthonsmartphone">'.
"\n";
1453 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');
1459 if (isModEnabled(
'multicompany') && is_object($mc)) {
1461 if (!method_exists($mc,
'formObjectOptions')) {
1462 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1463 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1464 print
"<td>".$mc->select_entities(
$conf->entity);
1465 print
"</td></tr>\n";
1467 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1473 $parameters = array();
1474 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1477 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1478 print
'<td class="wordbreak">';
1479 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1481 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1482 print $doleditor->Create(1);
1486 print
'<tr><td class="tdtop">';
1487 print $langs->trans(
"NotePublic");
1489 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1490 $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%');
1491 $doleditor->Create();
1492 print
"</td></tr>\n";
1495 print
'<tr><td class="tdtop">';
1496 print $langs->trans(
"NotePrivate");
1498 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1499 $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%');
1500 $doleditor->Create();
1501 print
"</td></tr>\n";
1503 print
'</table><hr><table class="border centpercent">';
1510 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1511 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1516 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1518 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1521 if ($permissiontoseesalary) {
1522 $langs->load(
"salaries");
1526 $text = $langs->trans(
"THM");
1527 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1530 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1536 $text = $langs->trans(
"TJM");
1537 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1540 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1545 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1547 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1553 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1555 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1560 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1562 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1566 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1571 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1573 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1581 print $form->buttonsSaveCancel(
"CreateUser");
1587 $res =
$object->fetch($id,
'',
'', 1);
1592 $res =
$object->fetch_optionals();
1602 $passDoNotExpire = 0;
1604 $userChangePassNextLogon = 0;
1608 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1610 $result = $ldap->connectBind();
1612 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1613 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1619 if (count($ldap->uacf) > 0) {
1620 foreach ($ldap->uacf as $key => $statut) {
1621 if ($key == 65536) {
1622 $passDoNotExpire = 1;
1623 $statutUACF = $statut;
1628 $statutUACF =
"ACCOUNTDISABLE";
1631 if ($ldap->pwdlastset == 0) {
1632 $userChangePassNextLogon = 1;
1638 if ($mode ==
'employee') {
1639 $title = $langs->trans(
"Employee");
1640 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1642 $title = $langs->trans(
"User");
1645 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1646 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1653 if ($action ==
'password') {
1654 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1658 if ($action ==
'passwordsend') {
1659 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1663 if ($action ==
'disable') {
1664 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1668 if ($action ==
'enable') {
1669 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1673 if ($action ==
'delete') {
1674 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1678 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1679 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1681 $formquestionclone = array(
1682 'text' => $langs->trans(
"ConfirmClone"),
1683 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1684 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1685 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1688 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1689 array_splice($formquestionclone, 2, 0, array($newElement));
1691 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);
1696 if ($action !=
'edit') {
1697 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1699 $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">';
1700 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1701 $morehtmlref .=
'</a>';
1703 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1704 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1706 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1708 print
'<div class="fichecenter">';
1709 print
'<div class="fichehalfleft">';
1711 print
'<div class="underbanner clearboth"></div>';
1712 print
'<table class="border tableforfield centpercent">';
1715 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1717 print
'<td class="error">';
1718 print $langs->trans(
"LoginAccountDisableInDolibarr");
1723 if (property_exists(
$object,
'admin')) {
1724 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1725 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft valignmiddle"');
1726 } elseif (!empty(
$object->admin)) {
1727 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft valignmiddle"');
1737 $text = $langs->trans(
"Type");
1738 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1740 $type = $langs->trans(
"Internal");
1742 $type = $langs->trans(
"External");
1744 print
'<span class="badgeneutral">';
1747 print
' ('.$langs->trans(
"DomainUser").
')';
1750 print
'</td></tr>'.
"\n";
1753 if (
$object->ldap_sid && is_object($ldap)) {
1754 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1755 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1756 print
'</td></tr>'.
"\n";
1760 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1762 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1766 print
'</td></tr>'.
"\n";
1769 if ($nbofusers > 1) {
1771 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1773 if (empty(
$object->fk_user)) {
1774 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1776 $huser =
new User($db);
1778 $huser->fetch(
$object->fk_user);
1779 print $huser->getNomUrl(-1);
1781 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1788 if (isModEnabled(
'expensereport')) {
1790 $text = $langs->trans(
"ForceUserExpenseValidator");
1791 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1794 if (!empty(
$object->fk_user_expense_validator)) {
1795 $evuser =
new User($db);
1796 $evuser->fetch(
$object->fk_user_expense_validator);
1797 print $evuser->getNomUrl(-1);
1804 if (isModEnabled(
'holiday')) {
1806 $text = $langs->trans(
"ForceUserHolidayValidator");
1807 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1810 if (!empty(
$object->fk_user_holiday_validator)) {
1811 $hvuser =
new User($db);
1812 $hvuser->fetch(
$object->fk_user_holiday_validator);
1813 print $hvuser->getNomUrl(-1);
1821 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1822 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1826 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1833 if ($permissiontoseesalary) {
1834 $langs->load(
"salaries");
1837 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1839 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1845 $text = $langs->trans(
"THM");
1846 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1855 $text = $langs->trans(
"TJM");
1856 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1865 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1867 if (
$object->dateemployment) {
1868 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1871 if (
$object->dateemploymentend) {
1872 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1879 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1887 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1888 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1889 if (
$object->fk_warehouse > 0) {
1890 $warehousestatic =
new Entrepot($db);
1891 $warehousestatic->fetch(
$object->fk_warehouse);
1892 print $warehousestatic->getNomUrl(1);
1900 print
'<div class="fichehalfright">';
1902 print
'<div class="underbanner clearboth"></div>';
1904 print
'<table class="border tableforfield centpercent">';
1907 if (isModEnabled(
'agenda')) {
1908 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1910 print $formother->showColor(
$object->color,
'');
1916 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1917 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1919 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1925 $langs->load(
"languages");
1926 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1928 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1932 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1938 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1939 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1940 print
'<td>'.$object->openid.
'</td>';
1945 if (isModEnabled(
'multicompany') && is_object($mc)) {
1947 if (!method_exists($mc,
'formObjectOptions')) {
1948 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1949 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1951 print $langs->trans(
"AllEntities");
1953 $mc->getInfo(
$object->entity);
1956 print
"</td></tr>\n";
1962 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1965 if (isModEnabled(
"societe")) {
1966 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1971 $societe->fetch(
$object->socid);
1972 if ($societe->id > 0) {
1973 $s .= $societe->getNomUrl(1,
'');
1976 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1978 if (!empty(
$object->contact_id)) {
1980 $contact->fetch(
$object->contact_id);
1981 if ($contact->id > 0) {
1982 if (
$object->socid > 0 && $s) {
1987 $s .= $contact->getNomUrl(1,
'');
1996 if (isModEnabled(
'member')) {
1997 $langs->load(
"members");
1998 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2002 $adh->fetch(
$object->fk_member);
2003 $adh->ref = $adh->getFullname($langs);
2004 print $adh->getNomUrl(-1);
2006 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2013 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2015 print
"</td></tr>\n";
2023 print
'<div class="div-table-responsive-no-min">';
2024 print
'<table class="noborder tableforfield centpercent">';
2026 print
'<tr class="liste_titre"><th class="liste_titre">';
2027 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
2029 print
'<th class="liste_titre"></th>';
2033 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2035 if (
$object->datestartvalidity) {
2036 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2039 if (
$object->dateendvalidity) {
2040 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2047 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
2048 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2057 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2058 if (!empty(
$object->ldap_sid)) {
2059 if ($passDoNotExpire) {
2060 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2061 } elseif ($userChangePassNextLogon) {
2062 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2063 } elseif ($userDisabled) {
2064 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2066 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2069 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2072 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2073 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2094 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2095 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2097 $valuetoshow = $hookmanager->resPrint;
2099 $valuetoshow .= $hookmanager->resPrint;
2103 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2104 print
'<td class="wordbreak">';
2111 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2112 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2114 if (!empty(
$object->api_key)) {
2115 print
'<span class="opacitymedium">';
2121 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">'.
getDolUserInt(
'API_COUNT_CALL').
'</span>';
2127 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2129 if (
$object->datepreviouslogin) {
2130 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2133 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2142 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2143 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters,
$object, $action);
2145 print $hookmanager->resPrint;
2151 print
'<div class="clearboth"></div>';
2160 print
'<div class="tabsAction">';
2162 $parameters = array();
2163 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2164 if (empty($reshook)) {
2168 'class' =>
'classfortooltip'
2172 if (empty($user->socid)) {
2173 $canSendMail =
false;
2175 $langs->load(
"mails");
2176 $canSendMail =
true;
2177 unset($params[
'attr'][
'title']);
2179 $langs->load(
"mails");
2180 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2182 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2185 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2187 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2188 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2190 unset($params[
'attr'][
'title']);
2193 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2195 unset($params[
'attr'][
'title']);
2196 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2203 'class' =>
'classfortooltip'
2208 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2209 $cloneButtonId =
'';
2212 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2214 $cloneButtonId =
'action-clone';
2216 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2220 if (
$object->status == $object::STATUS_DISABLED) {
2221 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2222 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2223 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2225 unset($params[
'attr'][
'title']);
2226 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2229 if (
$object->status == $object::STATUS_DISABLED) {
2230 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2231 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2232 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2235 unset($params[
'attr'][
'title']);
2236 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2238 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2239 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2244 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2246 unset($params[
'attr'][
'title']);
2247 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2250 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2252 unset($params[
'attr'][
'title']);
2253 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2255 if ($user->id == $id) {
2256 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2257 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2261 if ($user->id != $id && $permissiontodisable &&
2263 if ($user->admin || !
$object->admin) {
2264 unset($params[
'attr'][
'title']);
2265 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2267 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2268 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2278 if (
GETPOST(
'modelselected')) {
2279 $action =
'presend';
2283 $modelmail =
'user';
2284 $defaulttopic =
'Information';
2285 $diroutput =
$conf->user->dir_output;
2286 $trackid =
'use'.$object->id;
2288 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2290 if ($action !=
'presend' && $action !=
'send') {
2295 if ($permissiontoreadgroup) {
2296 print
'<!-- Group section -->'.
"\n";
2304 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2306 if (!empty($groupslist)) {
2307 foreach ($groupslist as $groupforuser) {
2308 $exclude[] = $groupforuser->id;
2313 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2314 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2315 print $hookmanager->resPrint;
2317 if (empty($reshook)) {
2318 if ($permissiontoeditgroup) {
2319 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2320 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2321 print
'<input type="hidden" name="action" value="addgroup" />';
2322 print
'<input type="hidden" name="page_y" value="" />';
2325 print
'<!-- List of groups of the user -->'.
"\n";
2326 print
'<table class="noborder centpercent">'.
"\n";
2327 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2328 print
'<th class="liste_titre right">';
2329 if ($permissiontoeditgroup) {
2330 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2332 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2333 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2335 print
'</th></tr>'.
"\n";
2338 if (!empty($groupslist)) {
2339 foreach ($groupslist as $group) {
2340 print
'<tr class="oddeven">';
2341 print
'<td class="tdoverflowmax200">';
2342 if ($permissiontoeditgroup) {
2343 print $group->getNomUrl(1);
2345 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2348 print
'<td class="right">';
2349 if ($permissiontoeditgroup) {
2350 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2351 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2356 print
"</td></tr>\n";
2359 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2364 if ($permissiontoeditgroup) {
2376 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2377 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2378 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2379 print
'<input type="hidden" name="action" value="update">';
2380 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2384 print
'<table class="border centpercent">';
2388 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2396 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2397 if ($permissiontoedit && !
$object->ldap_sid) {
2398 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2399 } elseif (
$object->civility_code) {
2400 print $langs->trans(
"Civility".
$object->civility_code);
2406 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2408 if ($permissiontoedit && !
$object->ldap_sid) {
2409 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2411 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2418 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2420 if ($permissiontoedit && !
$object->ldap_sid) {
2421 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2423 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2429 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2431 if ($user->admin && !
$object->ldap_sid) {
2432 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2434 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2441 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2443 $langs->load(
"admin");
2445 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2446 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2450 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2451 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2457 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2458 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2461 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2463 if (isModEnabled(
'multicompany') && !$user->entity) {
2464 if (
$conf->use_javascript_ajax) {
2465 print
'<script type="text/javascript">
2467 var admin = $("select[name=admin]").val();
2469 $("input[name=superadmin]")
2470 .prop("disabled", true)
2471 .prop("checked", false);
2473 if ($("input[name=superadmin]").is(":checked")) {
2474 $("select[name=entity]")
2475 .prop("disabled", true);
2477 $("select[name=admin]").change(function() {
2478 if ( $(this).val() == 0 ) {
2479 $("input[name=superadmin]")
2480 .prop("disabled", true)
2481 .prop("checked", false);
2482 $("select[name=entity]")
2483 .prop("disabled", false);
2485 $("input[name=superadmin]")
2486 .prop("disabled", false);
2489 $("input[name=superadmin]").change(function() {
2490 if ( $(this).is(":checked")) {
2491 $("select[name=entity]")
2492 .prop("disabled", true);
2494 $("select[name=entity]")
2495 .prop("disabled", false);
2502 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2503 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2507 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2508 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2509 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2510 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2519 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2521 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2522 if ($permissiontoedit) {
2523 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2525 print $arraygender[
$object->gender];
2531 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2532 if ($permissiontoedit) {
2533 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2536 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2545 if ($nbofusers > 1) {
2547 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2549 if ($permissiontoedit) {
2550 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');
2552 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2553 $huser =
new User($db);
2554 $huser->fetch(
$object->fk_user);
2555 print $huser->getNomUrl(-1);
2561 if (isModEnabled(
'expensereport')) {
2562 print
'<tr><td class="titlefieldcreate">';
2563 $text = $langs->trans(
"ForceUserExpenseValidator");
2564 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2567 if ($permissiontoedit) {
2568 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');
2570 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2571 $evuser =
new User($db);
2572 $evuser->fetch(
$object->fk_user_expense_validator);
2573 print $evuser->getNomUrl(-1);
2580 if (isModEnabled(
'holiday')) {
2581 print
'<tr><td class="titlefieldcreate">';
2582 $text = $langs->trans(
"ForceUserHolidayValidator");
2583 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2586 if ($permissiontoedit) {
2587 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');
2589 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2590 $hvuser =
new User($db);
2591 $hvuser->fetch(
$object->fk_user_holiday_validator);
2592 print $hvuser->getNomUrl(-1);
2600 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2602 if ($user->id ==
$object->id || !$user->admin) {
2604 $type = $langs->trans(
"Internal");
2606 $type = $langs->trans(
"External");
2609 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2611 print
' ('.$langs->trans(
"DomainUser").
')';
2620 $eventsCompanyContact = array();
2621 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2623 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2624 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2625 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2626 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2628 print
' ('.$langs->trans(
"DomainUser").
')';
2631 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2632 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2633 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2634 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2636 print
' ('.$langs->trans(
"DomainUser").
')';
2639 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2640 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2641 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2642 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2644 print
' ('.$langs->trans(
"DomainUser").
')';
2647 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2648 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2649 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2650 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2659 print
'<table class="border centpercent">';
2662 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2664 if ($permissiontoedit) {
2665 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2671 if ($permissiontoedit) {
2672 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2680 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2683 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2684 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2686 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2687 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2689 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2690 if ($permissiontoeditpasswordandsee) {
2691 $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">';
2692 if (!empty(
$conf->use_javascript_ajax)) {
2693 $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').
'"');
2696 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2700 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2701 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2703 $valuetoshow = $hookmanager->resPrint;
2705 $valuetoshow .= $hookmanager->resPrint;
2709 print
"</td></tr>\n";
2712 if (isModEnabled(
'api')) {
2713 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2715 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2716 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2717 if (!empty(
$conf->use_javascript_ajax)) {
2718 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2725 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2726 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2728 if ($permissiontoedit) {
2729 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2731 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2737 print
'</table><hr><table class="border centpercent">';
2741 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2743 if ($permissiontoedit) {
2744 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2747 if ($permissiontoedit) {
2748 print
'</textarea>';
2753 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2754 if ($permissiontoedit) {
2755 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2762 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2763 if ($permissiontoedit) {
2764 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2771 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2772 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2773 if ($permissiontoedit) {
2774 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2776 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2780 print $countrylabel;
2786 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2787 if ($permissiontoedit) {
2788 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2789 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2797 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2799 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2800 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2801 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2803 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2809 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2811 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2812 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2813 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'">';
2815 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2821 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2823 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2824 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2825 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2827 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2833 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2835 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2836 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2837 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2839 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2844 if (isModEnabled(
'socialnetworks')) {
2845 foreach ($socialnetworks as $key => $value) {
2846 if ($value[
'active']) {
2847 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2849 if (!empty($value[
'icon'])) {
2850 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2852 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2853 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2855 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2856 print
$object->socialnetworks[$key];
2861 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2866 print
'</table><hr><table class="border centpercent">';
2870 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2871 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2872 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>';
2877 if (isModEnabled(
'accounting')) {
2879 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2881 if ($permissiontoedit) {
2882 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2884 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2885 print
$object->accountancy_code;
2892 if (isModEnabled(
'agenda')) {
2893 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2895 if ($permissiontoedit) {
2896 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2898 print $formother->showColor(
$object->color,
'');
2905 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2907 print $form->showphoto(
'userphoto',
$object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2912 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2913 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2915 if ($permissiontoedit) {
2916 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
2918 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2925 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";
2926 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2932 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2934 print
$object->getLibStatut(4);
2961 if (isModEnabled(
'member')) {
2962 $langs->load(
"members");
2963 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2967 $adh->fetch(
$object->fk_member);
2968 $adh->ref = $adh->login;
2969 print $adh->getNomUrl(1);
2971 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2979 if (isModEnabled(
'multicompany') && is_object($mc)) {
2981 if (!method_exists($mc,
'formObjectOptions')) {
2982 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2983 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2984 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
2985 print
"</td></tr>\n";
2987 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2993 $parameters = array(
'colspan' =>
' colspan="2"');
2995 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2996 print $hookmanager->resPrint;
2997 if (empty($reshook)) {
2998 if ($permissiontoedit) {
2999 print
$object->showOptionals($extrafields,
'edit');
3001 print
$object->showOptionals($extrafields,
'view');
3006 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3008 if ($permissiontoedit) {
3009 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3011 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3012 print $doleditor->Create(1);
3024 print
'<table class="border centpercent">';
3030 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3032 if ($permissiontoedit) {
3033 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3035 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3041 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3043 if ($permissiontoedit) {
3044 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3052 if ($permissiontoseesalary) {
3053 $langs->load(
"salaries");
3056 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3058 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3064 $text = $langs->trans(
"THM");
3065 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3068 if ($permissiontoedit) {
3069 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3078 $text = $langs->trans(
"TJM");
3079 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3082 if ($permissiontoedit) {
3083 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3092 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3094 if ($permissiontoedit) {
3095 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3100 if ($dateemployment && $dateemploymentend) {
3104 if ($permissiontoedit) {
3105 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3113 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3115 if ($permissiontoedit) {
3116 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3127 print
'<div class="center">';
3128 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3129 print
' ';
3130 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3136 if ($action !=
'edit' && $action !=
'presend') {
3137 print
'<div class="fichecenter"><div class="fichehalfleft">';
3142 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3143 $genallowed = $user->hasRight(
"user",
"user",
"read");
3144 $delallowed = $user->hasRight(
"user",
"user",
"write");
3149 $societe->fetch(
$object->socid);
3154 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);
3155 $somethingshown = $formfile->numoffiles;
3158 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3159 $linktoelem = $tmparray[
'linktoelem'];
3160 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3161 print $htmltoenteralink;
3163 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3167 $morehtmlcenter =
'<div class="nowraponall">';
3168 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3169 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3170 $morehtmlcenter .=
'</div>';
3172 print
'</div><div class="fichehalfright">';
3175 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3177 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3179 print
'</div></div>';
3182 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3189include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3191if (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.