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';
68$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
71$action =
GETPOST(
'action',
'aZ09');
72$mode =
GETPOST(
'mode',
'alpha');
73$confirm =
GETPOST(
'confirm',
'alpha');
75$cancel =
GETPOST(
'cancel',
'alpha');
76$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
78if (empty($id) && $action !=
'add' && $action !=
'create') {
88$childids = $user->getAllChildIds(1);
94$extrafields->fetch_name_optionals_label(
$object->table_element);
99$hookmanager->initHooks(array(
'usercard',
'globalcard'));
106 $res =
$object->fetch($id,
'',
'', 1);
111if ($user->socid > 0) {
112 $socid = $user->socid;
118$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
119$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
120$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
121$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
122$permissiontoreadgroup = $permissiontoread;
123$permissiontoeditgroup = $permissiontoedit;
125 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
126 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
129if ($user->id != $id && !$permissiontoread) {
134$permissiontoeditpasswordandsee =
false;
135$permissiontoeditpasswordandsend =
false;
138 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
139 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin));
140 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
143$passwordismodified =
false;
151$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
152$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
157if (empty($reshook)) {
158 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
160 if (empty($backtopage) || ($cancel && empty($id))) {
161 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
162 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
163 $backtopage = $backurlforlist;
165 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
171 if (!empty($backtopageforcancel)) {
172 header(
"Location: ".$backtopageforcancel);
174 } elseif (!empty($backtopage)) {
175 header(
"Location: ".$backtopage);
181 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
182 if ($id != $user->id) {
184 if (
$object->admin && empty($user->admin)) {
187 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
190 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
196 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
199 if ($id != $user->id) {
202 if (!empty($conf->file->main_limit_users)) {
203 $nb =
$object->getNbOfUsers(
"active");
204 if ($nb >= $conf->file->main_limit_users) {
206 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
212 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
218 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
219 if ($id != $user->id) {
220 if (!GETPOSTISSET(
'token')) {
221 print
'Error, token required for this critical operation';
229 $result =
$object->delete($user);
231 $langs->load(
"errors");
235 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
242 if ($action ==
'add' && $permissiontoadd) {
256 if (!empty($conf->file->main_limit_users)) {
257 $nb =
$object->getNbOfUsers(
"active");
258 if ($nb >= $conf->file->main_limit_users) {
260 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
270 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
284 if (isModEnabled(
'socialnetworks')) {
285 $object->socialnetworks = array();
286 foreach ($socialnetworks as $key => $value) {
287 if (
GETPOST($key,
'alphanohtml')) {
293 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
296 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
311 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
312 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
316 $object->dateemployment = $dateemployment;
317 $object->dateemploymentend = $dateemploymentend;
318 $object->datestartvalidity = $datestartvalidity;
319 $object->dateendvalidity = $dateendvalidity;
327 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
334 if (isModEnabled(
'multicompany')) {
341 $object->entity = ($entity ==
'' ? 1 : $entity);
345 $object->entity = ($entity ==
'' ? 1 : $entity);
356 if (
GETPOST(
'password',
'password')) {
357 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
359 if (is_int($resPass) && $resPass < 0) {
360 $langs->load(
"errors");
365 if (isModEnabled(
"category")) {
367 $usercats =
GETPOST(
'usercats',
'array');
368 $object->setCategories($usercats);
372 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
376 $langs->load(
"errors");
385 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
388 $editgroup->fetch($group);
389 $editgroup->oldcopy = clone $editgroup;
393 if ($action ==
'addgroup') {
394 $result =
$object->SetInGroup($group, $editgroup->entity);
396 if ($action ==
'removegroup') {
397 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
408 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
409 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
411 if ($permissiontoedit) {
414 if (!
GETPOST(
"lastname",
'alpha')) {
419 if (!
GETPOST(
"login",
'alpha')) {
436 if (GETPOSTISSET(
"ref_employee")) {
440 if (GETPOSTISSET(
"national_registration_number")) {
441 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
444 if ($permissiontoeditpasswordandsee) {
447 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
450 if (!empty($user->admin) && $user->id !=
$id) {
455 if ($user->admin && !
$object->ldap_sid) {
467 if (isModEnabled(
'socialnetworks')) {
468 $object->socialnetworks = array();
469 foreach ($socialnetworks as $key => $value) {
470 if (
GETPOST($key,
'alphanohtml')) {
476 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
479 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
492 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
494 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
498 $object->dateemployment = $dateemployment;
499 $object->dateemploymentend = $dateemploymentend;
500 $object->datestartvalidity = $datestartvalidity;
501 $object->dateendvalidity = $dateendvalidity;
504 if (isModEnabled(
'stock')) {
511 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
525 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
533 if (!empty($_FILES[
'photo'][
'name'])) {
539 $langs->load(
"errors");
541 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
546 $passwordismodified = 0;
549 $passwordismodified = 1;
556 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
557 $langs->load(
"errors");
558 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
566 if (!$error && GETPOSTISSET(
'contactid')) {
570 if ($contactid > 0) {
572 $contact->fetch($contactid);
574 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
575 $sql .=
" SET fk_socpeople=".((int) $contactid);
576 if (!empty($contact->socid)) {
577 $sql .=
", fk_soc=".((int) $contact->socid);
578 } elseif ($socid > 0) {
579 $sql .=
", fk_soc = null";
580 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
582 $sql .=
" WHERE rowid = ".((int)
$object->id);
583 } elseif ($socid > 0) {
584 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
585 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
586 $sql .=
" WHERE rowid = ".((int)
$object->id);
588 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
589 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
590 $sql .=
" WHERE rowid = ".((int)
$object->id);
593 $resql = $db->query($sql);
600 if (!$error && !count(
$object->errors)) {
602 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/'.
$object->oldcopy->photo;
605 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/thumbs';
609 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
610 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1,
$object,
'user').
'/photos';
617 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
619 if (!($result > 0)) {
627 $langs->load(
"errors");
628 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
633 if (!$error && !count(
$object->errors)) {
635 $categories =
GETPOST(
'usercats',
'array');
636 $object->setCategories($categories);
639 if (!$error && !count(
$object->errors)) {
643 $login = $_SESSION[
"dol_login"];
646 $langs->load(
"errors");
647 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
649 if ($passwordismodified &&
$object->login == $user->login) {
651 $langs->load(
"errors");
652 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
653 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
661 if ($permissiontoeditpasswordandsee) {
662 dol_syslog(
"Not allowed to change fields, only password");
666 if (
GETPOST(
"password",
"password")) {
669 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
670 if (is_int($ret) && $ret < 0) {
679 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
680 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
684 $newpassword =
$object->setPassword($user,
'');
685 if (is_int($newpassword) && $newpassword < 0) {
687 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
690 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
691 if (
$object->send_password($user, $newpassword) > 0) {
697 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
703 if ($action ==
'adduserldap' && $permissiontoadd) {
704 $selecteduser =
GETPOST(
'users');
706 $required_fields = array(
722 if (isModEnabled(
'socialnetworks')) {
723 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
724 foreach ($arrayofsocialnetworks as $socialnetwork) {
730 $result = $ldap->connectBind();
733 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
738 if (is_array($ldapusers)) {
739 foreach ($ldapusers as $key => $attribute) {
751 $ldap_social = array();
753 if (isModEnabled(
'socialnetworks')) {
754 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
755 foreach ($arrayofsocialnetworks as $socialnetwork) {
756 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
767 $triggersendname =
'USER_SENTBYMAIL';
769 $mode =
'emailfromuser';
770 $trackid =
'use'.$id;
771 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
774 $upload_dir = $conf->user->dir_output;
775 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
783$form =
new Form($db);
788if (isModEnabled(
'stock')) {
794$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
795$resql = $db->query($sql);
797 $obj = $db->fetch_object($resql);
799 $nbofusers = $obj->nb;
807 $title = $person_name.
" - ".$langs->trans(
'Card');
810 $title = $langs->trans(
"NewEmployee");
812 $title = $langs->trans(
"NewUser");
818llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
820if ($action ==
'create' || $action ==
'adduserldap') {
823 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
827 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
832 $result = $ldap->connectBind();
834 $required_fields = array(
854 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
859 if (is_array($ldapusers)) {
860 foreach ($ldapusers as $key => $ldapuser) {
863 foreach ($required_fields as $value) {
865 $label .= $value.
"=******* ";
867 $label .= $value.
"=".$ldapuser[$value].
" ";
870 $liste[$key] = $label;
880 print
"\n\n<!-- Form liste LDAP debut -->\n";
882 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
883 print
'<input type="hidden" name="token" value="'.newToken().
'">';
884 print
'<table class="border centpercent"><tr>';
885 print
'<td width="160">';
886 print $langs->trans(
"LDAPUsers");
889 print
'<input type="hidden" name="action" value="adduserldap">';
890 if (is_array($liste) && count($liste)) {
891 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
894 print
'</td><td class="center">';
895 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
896 print
'</td></tr></table>';
899 print
"\n<!-- Form liste LDAP fin -->\n\n";
904 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
905 print
'<input type="hidden" name="token" value="'.newToken().
'">';
906 print
'<input type="hidden" name="action" value="add">';
907 if (!empty($ldap_sid)) {
908 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
910 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
916 print
'<table class="border centpercent">';
919 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
920 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
925 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
927 if (!empty($ldap_lastname)) {
928 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
929 print $ldap_lastname;
931 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
936 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
938 if (!empty($ldap_firstname)) {
939 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
940 print $ldap_firstname;
942 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
947 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
949 if (!empty($ldap_login)) {
950 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
952 } elseif (!empty($ldap_loginsmb)) {
953 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
954 print $ldap_loginsmb;
956 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
960 if (!empty($conf->use_javascript_ajax)) {
964 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
965 if ($charforseparator ==
'none') {
966 $charforseparator =
'';
969 jQuery(document).ready(function() {
970 $(".createloginauto").on("keyup", function() {
971 console.log(".createloginauto change: We generate login when we have a lastname");
973 lastname = $("#lastname").val().toLowerCase();
976 print
' firstname = $("#firstname").val().toLowerCase()[0];';
978 print
' firstname = $("#firstname").val().toLowerCase();';
984 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
988 $(
"#login").val(login);
994 $generated_password = '';
995 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
996 $generated_password = getRandomPassword(false);
998 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1001 if (!empty($user->admin)) {
1002 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1004 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1006 if (isModEnabled('multicompany
') && !$user->entity) {
1007 if (!empty($conf->use_javascript_ajax)) {
1008 print '<script
type=
"text/javascript">
1010 $(
"select[name=admin]").change(
function() {
1011 if ( $(
this).val() == 0 ) {
1012 $(
"input[name=superadmin]")
1013 .prop(
"disabled",
true)
1014 .prop(
"checked",
false);
1015 $(
"select[name=entity]")
1016 .prop(
"disabled",
false);
1018 $(
"input[name=superadmin]")
1019 .prop(
"disabled",
false);
1022 $(
"input[name=superadmin]").change(
function() {
1023 if ( $(
this).is(
":checked") ) {
1024 $(
"select[name=entity]")
1025 .prop(
"disabled",
true);
1027 $(
"select[name=entity]")
1028 .prop(
"disabled",
false);
1034 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1035 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1036 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1038 print "</td></tr>\n";
1042 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1044 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1045 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1049 $defaultemployee = '1
';
1051 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1052 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1053 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1057 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1059 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user, 'fk_user
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1063 // Expense report validator
1064 if (isModEnabled('expensereport
')) {
1065 print '<tr><td
class=
"titlefieldcreate">
';
1066 $text = $langs->trans("ForceUserExpenseValidator");
1067 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1070 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1075 // Holiday request validator
1076 if (isModEnabled('holiday
')) {
1077 print '<tr><td
class=
"titlefieldcreate">
';
1078 $text = $langs->trans("ForceUserHolidayValidator");
1079 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1082 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator
', 1, array($object->id), 0, '', 0, $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1088 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1090 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1094 print '</
table><hr><
table class=
"border centpercent">
';
1098 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1100 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1104 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1109 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1112 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1113 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1115 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1116 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1118 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1119 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1120 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1121 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1124 $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">';
1125 if (!empty($conf->use_javascript_ajax)) {
1126 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1132 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
1133 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1135 $valuetoshow = $hookmanager->resPrint;
1137 $valuetoshow .= $hookmanager->resPrint;
1143 if (isModEnabled(
'api')) {
1146 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1148 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">';
1149 if (!empty($conf->use_javascript_ajax)) {
1150 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1156 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1160 print
'</table><hr><table class="border centpercent">';
1164 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1165 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1167 print
'</textarea></td></tr>';
1170 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1171 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1175 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1176 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1180 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1181 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1182 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1184 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1190 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1191 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1192 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1197 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1199 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1200 if (!empty($ldap_phone)) {
1201 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1204 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1209 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1211 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1212 if (!empty($ldap_mobile)) {
1213 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1216 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1221 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1223 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1224 if (!empty($ldap_fax)) {
1225 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1228 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1233 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1235 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1236 if (!empty($ldap_mail)) {
1237 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1240 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1245 if (isModEnabled(
'socialnetworks')) {
1246 foreach ($socialnetworks as $key => $value) {
1247 if ($value[
'active']) {
1248 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1250 if (!empty($value[
'icon'])) {
1251 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1253 if (!empty($ldap_social[$key])) {
1254 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1255 print $ldap_social[$key];
1257 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1262 if (!empty($ldap_social[$key])) {
1263 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1265 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1272 if (isModEnabled(
'accounting')) {
1273 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1275 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1280 if (isModEnabled(
'agenda')) {
1281 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1283 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1288 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1289 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1290 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1291 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1297 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1298 print
'<td class="maxwidthonsmartphone">'.
"\n";
1299 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');
1305 if (isModEnabled(
'multicompany') && is_object($mc)) {
1307 if (!method_exists($mc,
'formObjectOptions')) {
1308 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1309 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1310 print
"<td>".$mc->select_entities($conf->entity);
1311 print
"</td></tr>\n";
1313 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1319 $parameters = array();
1320 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1323 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1324 print
'<td class="wordbreak">';
1325 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1327 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1328 print $doleditor->Create(1);
1332 print
'<tr><td class="tdtop">';
1333 print $langs->trans(
"NotePublic");
1335 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1336 $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%');
1337 $doleditor->Create();
1338 print
"</td></tr>\n";
1341 print
'<tr><td class="tdtop">';
1342 print $langs->trans(
"NotePrivate");
1344 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1345 $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%');
1346 $doleditor->Create();
1347 print
"</td></tr>\n";
1349 print
'</table><hr><table class="border centpercent">';
1356 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1357 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1362 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1364 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1367 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1368 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1369 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1370 $langs->load(
"salaries");
1374 $text = $langs->trans(
"THM");
1375 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1378 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1384 $text = $langs->trans(
"TJM");
1385 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1388 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1393 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1395 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1401 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1403 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1408 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1410 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1414 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1419 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1421 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1429 print $form->buttonsSaveCancel(
"CreateUser");
1435 $res =
$object->fetch($id,
'',
'', 1);
1440 $res =
$object->fetch_optionals();
1450 $passDoNotExpire = 0;
1452 $userChangePassNextLogon = 0;
1456 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1458 $result = $ldap->connectBind();
1460 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1461 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1467 if (count($ldap->uacf) > 0) {
1468 foreach ($ldap->uacf as $key => $statut) {
1469 if ($key == 65536) {
1470 $passDoNotExpire = 1;
1471 $statutUACF = $statut;
1476 $statutUACF =
"ACCOUNTDISABLE";
1479 if ($ldap->pwdlastset == 0) {
1480 $userChangePassNextLogon = 1;
1486 if ($mode ==
'employee') {
1487 $title = $langs->trans(
"Employee");
1488 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1490 $title = $langs->trans(
"User");
1493 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1494 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1503 if ($action ==
'password') {
1504 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1510 if ($action ==
'passwordsend') {
1511 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1517 if ($action ==
'disable') {
1518 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1524 if ($action ==
'enable') {
1525 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1529 if ($action ==
'delete') {
1530 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1534 if ($action !=
'edit') {
1537 $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">';
1538 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1539 $morehtmlref .=
'</a>';
1541 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1542 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1544 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1546 print
'<div class="fichecenter">';
1547 print
'<div class="fichehalfleft">';
1549 print
'<div class="underbanner clearboth"></div>';
1550 print
'<table class="border tableforfield centpercent">';
1553 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1555 print
'<td class="error">';
1556 print $langs->trans(
"LoginAccountDisableInDolibarr");
1561 if (property_exists(
$object,
'admin')) {
1562 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1563 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1564 } elseif (!empty(
$object->admin)) {
1565 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1575 $text = $langs->trans(
"Type");
1576 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1578 $type = $langs->trans(
"Internal");
1580 $type = $langs->trans(
"External");
1582 print
'<span class="badgeneutral">';
1585 print
' ('.$langs->trans(
"DomainUser").
')';
1588 print
'</td></tr>'.
"\n";
1591 if (
$object->ldap_sid && is_object($ldap)) {
1592 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1593 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1594 print
'</td></tr>'.
"\n";
1598 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1600 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1604 print
'</td></tr>'.
"\n";
1607 if ($nbofusers > 1) {
1609 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1611 if (empty(
$object->fk_user)) {
1612 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1614 $huser =
new User($db);
1616 $huser->fetch(
$object->fk_user);
1617 print $huser->getNomUrl(-1);
1619 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1626 if (isModEnabled(
'expensereport')) {
1628 $text = $langs->trans(
"ForceUserExpenseValidator");
1629 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1632 if (!empty(
$object->fk_user_expense_validator)) {
1633 $evuser =
new User($db);
1634 $evuser->fetch(
$object->fk_user_expense_validator);
1635 print $evuser->getNomUrl(-1);
1642 if (isModEnabled(
'holiday')) {
1644 $text = $langs->trans(
"ForceUserHolidayValidator");
1645 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1648 if (!empty(
$object->fk_user_holiday_validator)) {
1649 $hvuser =
new User($db);
1650 $hvuser->fetch(
$object->fk_user_holiday_validator);
1651 print $hvuser->getNomUrl(-1);
1659 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1660 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1664 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1671 if ((empty($user->socid) && in_array($id, $childids))
1672 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1673 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1674 $langs->load(
"salaries");
1677 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1679 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1685 $text = $langs->trans(
"THM");
1686 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1689 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1695 $text = $langs->trans(
"TJM");
1696 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1699 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1705 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1707 if (
$object->dateemployment) {
1708 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1711 if (
$object->dateemploymentend) {
1712 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1719 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1727 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1728 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1729 if (
$object->fk_warehouse > 0) {
1730 $warehousestatic =
new Entrepot($db);
1731 $warehousestatic->fetch(
$object->fk_warehouse);
1732 print $warehousestatic->getNomUrl(1);
1740 print
'<div class="fichehalfright">';
1742 print
'<div class="underbanner clearboth"></div>';
1744 print
'<table class="border tableforfield centpercent">';
1747 if (isModEnabled(
'agenda')) {
1748 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1750 print $formother->showColor(
$object->color,
'');
1756 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1757 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1759 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1765 $langs->load(
"languages");
1766 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1768 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1772 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1778 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1779 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1780 print
'<td>'.$object->openid.
'</td>';
1785 if (isModEnabled(
'multicompany') && is_object($mc)) {
1787 if (!method_exists($mc,
'formObjectOptions')) {
1788 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1789 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1791 print $langs->trans(
"AllEntities");
1793 $mc->getInfo(
$object->entity);
1796 print
"</td></tr>\n";
1802 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1805 if (isModEnabled(
"societe")) {
1806 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1811 $societe->fetch(
$object->socid);
1812 if ($societe->id > 0) {
1813 $s .= $societe->getNomUrl(1,
'');
1816 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1818 if (!empty(
$object->contact_id)) {
1820 $contact->fetch(
$object->contact_id);
1821 if ($contact->id > 0) {
1822 if (
$object->socid > 0 && $s) {
1827 $s .= $contact->getNomUrl(1,
'');
1836 if (isModEnabled(
'member')) {
1837 $langs->load(
"members");
1838 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1842 $adh->fetch(
$object->fk_member);
1843 $adh->ref = $adh->getFullname($langs);
1844 print $adh->getNomUrl(-1);
1846 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1853 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1855 print
"</td></tr>\n";
1863 print
'<div class="div-table-responsive-no-min">';
1864 print
'<table class="noborder tableforfield centpercent">';
1866 print
'<tr class="liste_titre"><th class="liste_titre">';
1867 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1869 print
'<th class="liste_titre"></th>';
1873 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1875 if (
$object->datestartvalidity) {
1876 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1879 if (
$object->dateendvalidity) {
1880 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1887 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1888 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
1897 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1898 if (!empty(
$object->ldap_sid)) {
1899 if ($passDoNotExpire) {
1900 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1901 } elseif ($userChangePassNextLogon) {
1902 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1903 } elseif ($userDisabled) {
1904 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1906 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1909 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1912 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1913 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1934 $parameters = array(
'valuetoshow' => $valuetoshow);
1935 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1937 $valuetoshow = $hookmanager->resPrint;
1939 $valuetoshow .= $hookmanager->resPrint;
1943 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
1944 print
'<td class="wordbreak">';
1951 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1952 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1954 if (!empty(
$object->api_key)) {
1955 print
'<span class="opacitymedium">';
1962 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1964 if (
$object->datepreviouslogin) {
1965 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1968 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1979 print
'<div class="clearboth"></div>';
1988 print
'<div class="tabsAction">';
1990 $parameters = array();
1991 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1992 if (empty($reshook)) {
1996 'class' =>
'classfortooltip'
2000 if (empty($user->socid)) {
2001 $canSendMail =
false;
2003 $langs->load(
"mails");
2004 $canSendMail =
true;
2005 unset($params[
'attr'][
'title']);
2007 $langs->load(
"mails");
2008 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2010 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2013 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2015 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2016 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2018 unset($params[
'attr'][
'title']);
2019 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
2021 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2022 (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2023 unset($params[
'attr'][
'title']);
2024 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2031 'class' =>
'classfortooltip'
2035 if (
$object->status == $object::STATUS_DISABLED) {
2036 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2037 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2038 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2039 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2040 unset($params[
'attr'][
'title']);
2041 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2044 if (
$object->status == $object::STATUS_DISABLED) {
2045 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2046 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2047 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2048 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2050 unset($params[
'attr'][
'title']);
2051 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2053 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2054 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2059 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2060 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2061 unset($params[
'attr'][
'title']);
2062 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2065 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2066 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2067 unset($params[
'attr'][
'title']);
2068 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2070 if ($user->id == $id) {
2071 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2072 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2076 if ($user->id != $id && $permissiontodisable &&
2077 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2078 if ($user->admin || !
$object->admin) {
2079 unset($params[
'attr'][
'title']);
2080 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2082 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2083 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2093 if (
GETPOST(
'modelselected')) {
2094 $action =
'presend';
2098 $modelmail =
'user';
2099 $defaulttopic =
'Information';
2100 $diroutput = $conf->user->dir_output;
2101 $trackid =
'use'.$object->id;
2103 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2105 if ($action !=
'presend' && $action !=
'send') {
2110 if ($permissiontoreadgroup) {
2111 print
'<!-- Group section -->'.
"\n";
2119 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2121 if (!empty($groupslist)) {
2122 foreach ($groupslist as $groupforuser) {
2123 $exclude[] = $groupforuser->id;
2128 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2129 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2130 print $hookmanager->resPrint;
2132 if (empty($reshook)) {
2133 if ($permissiontoeditgroup) {
2134 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2135 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2136 print
'<input type="hidden" name="action" value="addgroup" />';
2137 print
'<input type="hidden" name="page_y" value="" />';
2140 print
'<!-- List of groups of the user -->'.
"\n";
2141 print
'<table class="noborder centpercent">'.
"\n";
2142 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2143 print
'<th class="liste_titre right">';
2144 if ($permissiontoeditgroup) {
2145 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(),
$object->entity,
false,
'maxwidth150');
2147 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2148 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2150 print
'</th></tr>'.
"\n";
2153 if (!empty($groupslist)) {
2154 foreach ($groupslist as $group) {
2155 print
'<tr class="oddeven">';
2156 print
'<td class="tdoverflowmax150">';
2157 if ($permissiontoeditgroup) {
2158 print $group->getNomUrl(1);
2160 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2163 print
'<td class="right">';
2164 if ($permissiontoeditgroup) {
2165 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2166 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2171 print
"</td></tr>\n";
2174 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2179 if ($permissiontoeditgroup) {
2191 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2192 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2193 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2194 print
'<input type="hidden" name="action" value="update">';
2195 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2199 print
'<table class="border centpercent">';
2203 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2211 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2212 if ($permissiontoedit && !
$object->ldap_sid) {
2213 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2214 } elseif (
$object->civility_code) {
2215 print $langs->trans(
"Civility".
$object->civility_code);
2221 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2223 if ($permissiontoedit && !
$object->ldap_sid) {
2224 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2226 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2233 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2235 if ($permissiontoedit && !
$object->ldap_sid) {
2236 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2238 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2244 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2246 if ($user->admin && !
$object->ldap_sid) {
2247 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2249 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2256 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2258 $langs->load(
"admin");
2260 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2261 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2265 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2266 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2272 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2273 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2276 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2278 if (isModEnabled(
'multicompany') && !$user->entity) {
2279 if ($conf->use_javascript_ajax) {
2280 print
'<script type="text/javascript">
2282 var admin = $("select[name=admin]").val();
2284 $("input[name=superadmin]")
2285 .prop("disabled", true)
2286 .prop("checked", false);
2288 if ($("input[name=superadmin]").is(":checked")) {
2289 $("select[name=entity]")
2290 .prop("disabled", true);
2292 $("select[name=admin]").change(function() {
2293 if ( $(this).val() == 0 ) {
2294 $("input[name=superadmin]")
2295 .prop("disabled", true)
2296 .prop("checked", false);
2297 $("select[name=entity]")
2298 .prop("disabled", false);
2300 $("input[name=superadmin]")
2301 .prop("disabled", false);
2304 $("input[name=superadmin]").change(function() {
2305 if ( $(this).is(":checked")) {
2306 $("select[name=entity]")
2307 .prop("disabled", true);
2309 $("select[name=entity]")
2310 .prop("disabled", false);
2317 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2318 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2322 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2323 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2324 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2325 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2334 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2336 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2337 if ($permissiontoedit) {
2338 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2340 print $arraygender[
$object->gender];
2346 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2347 if ($permissiontoedit) {
2348 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2351 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2360 if ($nbofusers > 1) {
2362 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2364 if ($permissiontoedit) {
2365 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user,
'fk_user', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2367 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2368 $huser =
new User($db);
2369 $huser->fetch(
$object->fk_user);
2370 print $huser->getNomUrl(-1);
2376 if (isModEnabled(
'expensereport')) {
2377 print
'<tr><td class="titlefieldcreate">';
2378 $text = $langs->trans(
"ForceUserExpenseValidator");
2379 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2382 if ($permissiontoedit) {
2383 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2385 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2386 $evuser =
new User($db);
2387 $evuser->fetch(
$object->fk_user_expense_validator);
2388 print $evuser->getNomUrl(-1);
2395 if (isModEnabled(
'holiday')) {
2396 print
'<tr><td class="titlefieldcreate">';
2397 $text = $langs->trans(
"ForceUserHolidayValidator");
2398 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2401 if ($permissiontoedit) {
2402 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array(
$object->id), 0,
'', 0,
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2404 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2405 $hvuser =
new User($db);
2406 $hvuser->fetch(
$object->fk_user_holiday_validator);
2407 print $hvuser->getNomUrl(-1);
2415 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2417 if ($user->id ==
$object->id || !$user->admin) {
2419 $type = $langs->trans(
"Internal");
2421 $type = $langs->trans(
"External");
2424 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2426 print
' ('.$langs->trans(
"DomainUser").
')';
2436 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2439 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2441 print
' ('.$langs->trans(
"DomainUser").
')';
2444 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2447 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2449 print
' ('.$langs->trans(
"DomainUser").
')';
2452 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2455 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2457 print
' ('.$langs->trans(
"DomainUser").
')';
2460 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0, array(), 0,
'maxwidth300');
2463 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2472 print
'<table class="border centpercent">';
2475 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2477 if ($permissiontoedit) {
2478 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2484 if ($permissiontoedit) {
2485 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2493 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2496 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2497 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2499 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2500 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2502 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2503 if ($permissiontoeditpasswordandsee) {
2504 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="flat" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password">';
2505 if (!empty($conf->use_javascript_ajax)) {
2506 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->trans(
'NoPasswordGenerationRuleConfigured') : $langs->trans(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2509 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2513 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2514 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2516 $valuetoshow = $hookmanager->resPrint;
2518 $valuetoshow .= $hookmanager->resPrint;
2522 print
"</td></tr>\n";
2525 if (isModEnabled(
'api')) {
2526 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2528 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2529 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2530 if (!empty($conf->use_javascript_ajax)) {
2531 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2538 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2539 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2541 if ($permissiontoedit) {
2542 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2544 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2550 print
'</table><hr><table class="border centpercent">';
2554 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2556 if ($permissiontoedit) {
2557 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2560 if ($permissiontoedit) {
2561 print
'</textarea>';
2566 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2567 if ($permissiontoedit) {
2568 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2575 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2576 if ($permissiontoedit) {
2577 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2584 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td>';
2585 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2586 if ($permissiontoedit) {
2587 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2589 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2593 print $countrylabel;
2599 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2600 if ($permissiontoedit) {
2601 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2602 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2610 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2612 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2613 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2614 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2616 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2622 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2624 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2625 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2626 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2628 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2634 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2636 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2637 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2638 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2640 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2646 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2648 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2649 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2650 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2652 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2657 if (isModEnabled(
'socialnetworks')) {
2658 foreach ($socialnetworks as $key => $value) {
2659 if ($value[
'active']) {
2660 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2662 if (!empty($value[
'icon'])) {
2663 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2665 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2666 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2668 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2669 print
$object->socialnetworks[$key];
2674 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2679 print
'</table><hr><table class="border centpercent">';
2683 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2684 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2685 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>';
2690 if (isModEnabled(
'accounting')) {
2692 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2694 if ($permissiontoedit) {
2695 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2697 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2698 print
$object->accountancy_code;
2705 if (isModEnabled(
'agenda')) {
2706 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2708 if ($permissiontoedit) {
2709 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2711 print $formother->showColor(
$object->color,
'');
2718 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2720 print $form->showphoto(
'userphoto',
$object, 60, 0, $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2725 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2726 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2728 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2729 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
'',
'', 0, 0, 1);
2731 $cats = $c->containing(
$object->id, Categorie::TYPE_USER);
2732 $arrayselected = array();
2733 foreach ($cats as $cat) {
2734 $arrayselected[] = $cat->id;
2736 if ($permissiontoedit) {
2737 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected, 0, 0,
'', 0,
'90%');
2739 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2746 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";
2747 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2753 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2755 print
$object->getLibStatut(4);
2782 if (isModEnabled(
'member')) {
2783 $langs->load(
"members");
2784 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2788 $adh->fetch(
$object->fk_member);
2789 $adh->ref = $adh->login;
2790 print $adh->getNomUrl(1);
2792 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2800 if (isModEnabled(
'multicompany') && is_object($mc)) {
2802 if (!method_exists($mc,
'formObjectOptions')) {
2803 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2804 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2805 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2806 print
"</td></tr>\n";
2808 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2814 $parameters = array(
'colspan' =>
' colspan="2"');
2816 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2817 print $hookmanager->resPrint;
2818 if (empty($reshook)) {
2819 if ($permissiontoedit) {
2820 print
$object->showOptionals($extrafields,
'edit');
2822 print
$object->showOptionals($extrafields,
'view');
2827 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2829 if ($permissiontoedit) {
2830 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2832 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2833 print $doleditor->Create(1);
2845 print
'<table class="border centpercent">';
2851 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2853 if ($permissiontoedit) {
2854 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2856 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2862 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2864 if ($permissiontoedit) {
2865 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2873 if ((empty($user->socid) && in_array($id, $childids))
2874 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
2875 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2876 $langs->load(
"salaries");
2879 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2881 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
2887 $text = $langs->trans(
"THM");
2888 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2891 if ($permissiontoedit) {
2892 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
2894 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2901 $text = $langs->trans(
"TJM");
2902 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2905 if ($permissiontoedit) {
2906 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
2908 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2915 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2917 if ($permissiontoedit) {
2918 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2923 if ($dateemployment && $dateemploymentend) {
2927 if ($permissiontoedit) {
2928 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2936 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2938 if ($permissiontoedit) {
2939 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2950 print
'<div class="center">';
2951 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2952 print
' ';
2953 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2959 if ($action !=
'edit' && $action !=
'presend') {
2960 print
'<div class="fichecenter"><div class="fichehalfleft">';
2965 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2966 $genallowed = $user->hasRight(
"user",
"user",
"read");
2967 $delallowed = $user->hasRight(
"user",
"user",
"write");
2972 $societe->fetch(
$object->socid);
2977 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', !is_object($societe) || empty($societe->default_lang) ?
'' : $societe->default_lang);
2978 $somethingshown = $formfile->numoffiles;
2981 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
2982 $linktoelem = $tmparray[
'linktoelem'];
2983 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
2984 print $htmltoenteralink;
2986 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2990 $morehtmlcenter =
'<div class="nowraponall">';
2991 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
2992 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
2993 $morehtmlcenter .=
'</div>';
2995 print
'</div><div class="fichehalfright">';
2998 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3000 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3002 print
'</div></div>';
3005 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3012include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3014if (isModEnabled(
'api')) {
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
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.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
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)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $backtopagejsfields='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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...
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.
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.