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 !=
'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$canadduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
119$canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
120$canedituser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
121$candisableuser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
122$canreadgroup = $canreaduser;
123$caneditgroup = $canedituser;
125 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
126 $caneditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
129if ($user->id != $id && !$canreaduser) {
133$caneditpasswordandsee =
false;
134$caneditpasswordandsend =
false;
139 $canedituser = (($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"));
140 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
141 $caneditpasswordandsee = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin));
142 $caneditpasswordandsend = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
150$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $caneditgroup);
151$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
156if (empty($reshook)) {
157 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
159 if (empty($backtopage) || ($cancel && empty($id))) {
160 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
161 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
162 $backtopage = $backurlforlist;
164 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
170 if (!empty($backtopageforcancel)) {
171 header(
"Location: ".$backtopageforcancel);
173 } elseif (!empty($backtopage)) {
174 header(
"Location: ".$backtopage);
180 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $candisableuser) {
181 if ($id != $user->id) {
183 if (
$object->admin && empty($user->admin)) {
186 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
189 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
195 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $candisableuser) {
198 if ($id != $user->id) {
201 if (!empty($conf->file->main_limit_users)) {
202 $nb =
$object->getNbOfUsers(
"active");
203 if ($nb >= $conf->file->main_limit_users) {
205 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
211 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
217 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $candisableuser) {
218 if ($id != $user->id) {
219 if (!GETPOSTISSET(
'token')) {
220 print
'Error, token required for this critical operation';
228 $result =
$object->delete($user);
230 $langs->load(
"errors");
234 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
241 if ($action ==
'add' && $canadduser) {
255 if (!empty($conf->file->main_limit_users)) {
256 $nb =
$object->getNbOfUsers(
"active");
257 if ($nb >= $conf->file->main_limit_users) {
259 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
269 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
283 if (isModEnabled(
'socialnetworks')) {
284 $object->socialnetworks = array();
285 foreach ($socialnetworks as $key => $value) {
286 if (
GETPOST($key,
'alphanohtml')) {
292 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
295 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
310 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
311 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
315 $object->dateemployment = $dateemployment;
316 $object->dateemploymentend = $dateemploymentend;
317 $object->datestartvalidity = $datestartvalidity;
318 $object->dateendvalidity = $dateendvalidity;
326 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
333 if (isModEnabled(
'multicompany')) {
340 $object->entity = ($entity ==
'' ? 1 : $entity);
344 $object->entity = ($entity ==
'' ? 1 : $entity);
355 if (
GETPOST(
'password',
'none')) {
356 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'none'));
358 if (is_int($resPass) && $resPass < 0) {
359 $langs->load(
"errors");
364 if (isModEnabled(
"category")) {
366 $usercats =
GETPOST(
'usercats',
'array');
367 $object->setCategories($usercats);
371 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
375 $langs->load(
"errors");
384 if (($action ==
'addgroup' || $action ==
'removegroup') && $caneditgroup) {
387 $editgroup->fetch($group);
388 $editgroup->oldcopy = clone $editgroup;
392 if ($action ==
'addgroup') {
393 $result =
$object->SetInGroup($group, $editgroup->entity);
395 if ($action ==
'removegroup') {
396 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
407 if ($action ==
'update' && ($canedituser || $caneditpasswordandsee)) {
408 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
413 if (!
GETPOST(
"lastname",
'alpha')) {
418 if (!
GETPOST(
"login",
'alpha')) {
435 if (GETPOSTISSET(
"ref_employee")) {
439 if (GETPOSTISSET(
"national_registration_number")) {
440 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
443 if ($caneditpasswordandsee) {
446 if ($caneditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
449 if (!empty($user->admin) && $user->id != $id) {
454 if ($user->admin && !
$object->ldap_sid) {
466 if (isModEnabled(
'socialnetworks')) {
467 $object->socialnetworks = array();
468 foreach ($socialnetworks as $key => $value) {
469 if (
GETPOST($key,
'alphanohtml')) {
475 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
478 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
491 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
493 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
497 $object->dateemployment = $dateemployment;
498 $object->dateemploymentend = $dateemploymentend;
499 $object->datestartvalidity = $datestartvalidity;
500 $object->dateendvalidity = $dateendvalidity;
503 if (isModEnabled(
'stock')) {
510 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
524 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
532 if (!empty($_FILES[
'photo'][
'name'])) {
538 $langs->load(
"errors");
540 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
545 $passwordismodified = 0;
548 $passwordismodified = 1;
555 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
556 $langs->load(
"errors");
557 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
565 if (!$error && GETPOSTISSET(
'contactid')) {
569 if ($contactid > 0) {
571 $contact->fetch($contactid);
573 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
574 $sql .=
" SET fk_socpeople=".((int) $contactid);
575 if (!empty($contact->socid)) {
576 $sql .=
", fk_soc=".((int) $contact->socid);
577 } elseif ($socid > 0) {
578 $sql .=
", fk_soc = null";
579 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
581 $sql .=
" WHERE rowid = ".((int)
$object->id);
582 } elseif ($socid > 0) {
583 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
584 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
585 $sql .=
" WHERE rowid = ".((int)
$object->id);
587 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
588 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
589 $sql .=
" WHERE rowid = ".((int)
$object->id);
592 $resql = $db->query($sql);
599 if (!$error && !count(
$object->errors)) {
601 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/'.
$object->oldcopy->photo;
604 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/thumbs';
608 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
609 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1,
$object,
'user').
'/photos';
615 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
617 if (!($result > 0)) {
625 $langs->load(
"errors");
626 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
631 if (!$error && !count(
$object->errors)) {
633 $categories =
GETPOST(
'usercats',
'array');
634 $object->setCategories($categories);
637 if (!$error && !count(
$object->errors)) {
641 $login = $_SESSION[
"dol_login"];
644 $langs->load(
"errors");
645 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
647 if ($passwordismodified &&
$object->login == $user->login) {
649 $langs->load(
"errors");
650 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
651 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
659 if ($caneditpasswordandsee) {
660 dol_syslog(
"Not allowed to change fields, only password");
664 if (
GETPOST(
"password",
"none")) {
668 if (is_int($ret) && $ret < 0) {
677 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $caneditpasswordandsee)
678 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $caneditpasswordandsend))
682 $newpassword =
$object->setPassword($user,
'');
683 if (is_int($newpassword) && $newpassword < 0) {
685 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
688 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
689 if (
$object->send_password($user, $newpassword) > 0) {
695 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
701 if ($action ==
'adduserldap' && $canadduser) {
702 $selecteduser =
GETPOST(
'users');
704 $required_fields = array(
720 if (isModEnabled(
'socialnetworks')) {
721 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
722 foreach ($arrayofsocialnetworks as $socialnetwork) {
728 $result = $ldap->connectBind();
731 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
736 if (is_array($ldapusers)) {
737 foreach ($ldapusers as $key => $attribute) {
749 $ldap_social = array();
751 if (isModEnabled(
'socialnetworks')) {
752 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
753 foreach ($arrayofsocialnetworks as $socialnetwork) {
754 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
765 $triggersendname =
'USER_SENTBYMAIL';
767 $mode =
'emailfromuser';
768 $trackid =
'use'.$id;
769 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
772 $upload_dir = $conf->user->dir_output;
773 $permissiontoadd = $user->hasRight(
"user",
"user",
"write");
774 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
782$form =
new Form($db);
787if (isModEnabled(
'stock')) {
793$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
794$resql = $db->query($sql);
796 $obj = $db->fetch_object($resql);
798 $nbofusers = $obj->nb;
806 $title = $person_name.
" - ".$langs->trans(
'Card');
808 if (
GETPOST(
'employee',
'alphanohtml')) {
809 $title = $langs->trans(
"NewEmployee");
811 $title = $langs->trans(
"NewUser");
816llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
819if ($action ==
'create' || $action ==
'adduserldap') {
822 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
826 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
831 $result = $ldap->connectBind();
833 $required_fields = array(
853 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
858 if (is_array($ldapusers)) {
859 foreach ($ldapusers as $key => $ldapuser) {
862 foreach ($required_fields as $value) {
864 $label .= $value.
"=******* ";
866 $label .= $value.
"=".$ldapuser[$value].
" ";
869 $liste[$key] = $label;
879 print
"\n\n<!-- Form liste LDAP debut -->\n";
881 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
882 print
'<input type="hidden" name="token" value="'.newToken().
'">';
883 print
'<table class="border centpercent"><tr>';
884 print
'<td width="160">';
885 print $langs->trans(
"LDAPUsers");
888 print
'<input type="hidden" name="action" value="adduserldap">';
889 if (is_array($liste) && count($liste)) {
890 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
893 print
'</td><td class="center">';
894 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
895 print
'</td></tr></table>';
898 print
"\n<!-- Form liste LDAP fin -->\n\n";
903 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
904 print
'<input type="hidden" name="token" value="'.newToken().
'">';
905 print
'<input type="hidden" name="action" value="add">';
906 if (!empty($ldap_sid)) {
907 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
909 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
915 print
'<table class="border centpercent">';
918 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
919 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
924 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
926 if (!empty($ldap_lastname)) {
927 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
928 print $ldap_lastname;
930 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
935 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
937 if (!empty($ldap_firstname)) {
938 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
939 print $ldap_firstname;
941 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
946 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
948 if (!empty($ldap_login)) {
949 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
951 } elseif (!empty($ldap_loginsmb)) {
952 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
953 print $ldap_loginsmb;
955 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
959 if (!empty($conf->use_javascript_ajax)) {
963 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
964 if ($charforseparator ==
'none') {
965 $charforseparator =
'';
968 jQuery(document).ready(function() {
969 $(".createloginauto").on("keyup", function() {
970 console.log(".createloginauto change: We generate login when we have a lastname");
972 lastname = $("#lastname").val().toLowerCase();
975 print
' firstname = $("#firstname").val().toLowerCase()[0];';
977 print
' firstname = $("#firstname").val().toLowerCase();';
983 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
987 $(
"#login").val(login);
993 $generated_password = '';
994 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
995 $generated_password = getRandomPassword(false);
997 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1000 if (!empty($user->admin)) {
1001 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1003 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1005 if (isModEnabled('multicompany
') && !$user->entity) {
1006 if (!empty($conf->use_javascript_ajax)) {
1007 print '<script
type=
"text/javascript">
1009 $(
"select[name=admin]").change(
function() {
1010 if ( $(
this).val() == 0 ) {
1011 $(
"input[name=superadmin]")
1012 .prop(
"disabled",
true)
1013 .prop(
"checked",
false);
1014 $(
"select[name=entity]")
1015 .prop(
"disabled",
false);
1017 $(
"input[name=superadmin]")
1018 .prop(
"disabled",
false);
1021 $(
"input[name=superadmin]").change(
function() {
1022 if ( $(
this).is(
":checked") ) {
1023 $(
"select[name=entity]")
1024 .prop(
"disabled",
true);
1026 $(
"select[name=entity]")
1027 .prop(
"disabled",
false);
1033 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1034 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1035 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1037 print "</td></tr>\n";
1041 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1043 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1044 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1048 $defaultemployee = '1
';
1050 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1051 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1052 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1056 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1058 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
');
1062 // Expense report validator
1063 if (isModEnabled('expensereport
')) {
1064 print '<tr><td
class=
"titlefieldcreate">
';
1065 $text = $langs->trans("ForceUserExpenseValidator");
1066 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1069 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
');
1074 // Holiday request validator
1075 if (isModEnabled('holiday
')) {
1076 print '<tr><td
class=
"titlefieldcreate">
';
1077 $text = $langs->trans("ForceUserHolidayValidator");
1078 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1081 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
');
1087 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1089 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1093 print '</
table><hr><
table class=
"border centpercent">
';
1097 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1099 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1103 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1108 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1111 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1112 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1114 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1115 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1117 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1118 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1119 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1120 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1123 $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">';
1124 if (!empty($conf->use_javascript_ajax)) {
1125 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1131 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
1132 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1134 $valuetoshow = $hookmanager->resPrint;
1136 $valuetoshow .= $hookmanager->resPrint;
1142 if (isModEnabled(
'api')) {
1145 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1147 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">';
1148 if (!empty($conf->use_javascript_ajax)) {
1149 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1155 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1159 print
'</table><hr><table class="border centpercent">';
1163 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1164 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1166 print
'</textarea></td></tr>';
1169 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1170 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1174 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1175 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1179 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1180 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1181 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1183 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1189 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1190 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1191 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1196 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1198 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1199 if (!empty($ldap_phone)) {
1200 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1203 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1208 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1210 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1211 if (!empty($ldap_mobile)) {
1212 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1215 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1220 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1222 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1223 if (!empty($ldap_fax)) {
1224 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1227 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1232 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1234 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1235 if (!empty($ldap_mail)) {
1236 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1239 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1244 if (isModEnabled(
'socialnetworks')) {
1245 foreach ($socialnetworks as $key => $value) {
1246 if ($value[
'active']) {
1247 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1249 if (!empty($value[
'icon'])) {
1250 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1252 if (!empty($ldap_social[$key])) {
1253 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1254 print $ldap_social[$key];
1256 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1261 if (!empty($ldap_social[$key])) {
1262 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1264 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1271 if (isModEnabled(
'accounting')) {
1272 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1274 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1279 if (isModEnabled(
'agenda')) {
1280 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1282 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1,
'',
'hideifnotset');
1287 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1288 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1289 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1290 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1296 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1297 print
'<td class="maxwidthonsmartphone">'.
"\n";
1298 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
GETPOST(
'default_lang',
'alpha') ?
GETPOST(
'default_lang',
'alpha') : (
$object->lang ?
$object->lang :
''),
'default_lang', 0, 0, 1, 0, 0,
'maxwidth300 widthcentpercentminusx');
1304 if (isModEnabled(
'multicompany') && is_object($mc)) {
1306 if (!method_exists($mc,
'formObjectOptions')) {
1307 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1308 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1309 print
"<td>".$mc->select_entities($conf->entity);
1310 print
"</td></tr>\n";
1312 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1318 $parameters = array();
1319 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1322 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1323 print
'<td class="wordbreak">';
1324 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1326 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1327 print $doleditor->Create(1);
1331 print
'<tr><td class="tdtop">';
1332 print $langs->trans(
"NotePublic");
1334 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1335 $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%');
1336 $doleditor->Create();
1337 print
"</td></tr>\n";
1340 print
'<tr><td class="tdtop">';
1341 print $langs->trans(
"NotePrivate");
1343 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1344 $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%');
1345 $doleditor->Create();
1346 print
"</td></tr>\n";
1348 print
'</table><hr><table class="border centpercent">';
1355 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1356 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1361 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1363 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1366 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1367 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1368 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1369 $langs->load(
"salaries");
1373 $text = $langs->trans(
"THM");
1374 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1377 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1383 $text = $langs->trans(
"TJM");
1384 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1387 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1392 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1394 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1400 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1402 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1407 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1409 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1413 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1418 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1420 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1428 print $form->buttonsSaveCancel(
"CreateUser");
1434 $res =
$object->fetch($id,
'',
'', 1);
1439 $res =
$object->fetch_optionals();
1451 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1453 $result = $ldap->connectBind();
1455 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1456 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1461 $passDoNotExpire = 0;
1462 $userChangePassNextLogon = 0;
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);
1531 if ($action ==
'delete') {
1532 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1538 if ($action !=
'edit') {
1541 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid" rel="noopener" rel="noopener">';
1542 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1543 $morehtmlref .=
'</a>';
1545 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1546 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
1548 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1550 print
'<div class="fichecenter">';
1551 print
'<div class="fichehalfleft">';
1553 print
'<div class="underbanner clearboth"></div>';
1554 print
'<table class="border tableforfield centpercent">';
1557 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1559 print
'<td class="error">';
1560 print $langs->trans(
"LoginAccountDisableInDolibarr");
1565 if (property_exists(
$object,
'admin')) {
1566 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1567 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1568 } elseif (!empty(
$object->admin)) {
1569 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1579 $text = $langs->trans(
"Type");
1580 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1582 $type = $langs->trans(
"Internal");
1584 $type = $langs->trans(
"External");
1586 print
'<span class="badgeneutral">';
1589 print
' ('.$langs->trans(
"DomainUser").
')';
1592 print
'</td></tr>'.
"\n";
1596 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1597 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1598 print
'</td></tr>'.
"\n";
1602 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1604 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1608 print
'</td></tr>'.
"\n";
1611 if ($nbofusers > 1) {
1613 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1615 if (empty(
$object->fk_user)) {
1616 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1618 $huser =
new User($db);
1620 $huser->fetch(
$object->fk_user);
1621 print $huser->getNomUrl(-1);
1623 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1630 if (isModEnabled(
'expensereport')) {
1632 $text = $langs->trans(
"ForceUserExpenseValidator");
1633 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1636 if (!empty(
$object->fk_user_expense_validator)) {
1637 $evuser =
new User($db);
1638 $evuser->fetch(
$object->fk_user_expense_validator);
1639 print $evuser->getNomUrl(-1);
1646 if (isModEnabled(
'holiday')) {
1648 $text = $langs->trans(
"ForceUserHolidayValidator");
1649 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1652 if (!empty(
$object->fk_user_holiday_validator)) {
1653 $hvuser =
new User($db);
1654 $hvuser->fetch(
$object->fk_user_holiday_validator);
1655 print $hvuser->getNomUrl(-1);
1663 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1664 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1668 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1675 if ((empty($user->socid) && in_array($id, $childids))
1676 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1677 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1678 $langs->load(
"salaries");
1681 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1683 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1689 $text = $langs->trans(
"THM");
1690 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1693 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1699 $text = $langs->trans(
"TJM");
1700 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1703 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1709 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1711 if (
$object->dateemployment) {
1712 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1715 if (
$object->dateemploymentend) {
1716 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1723 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1731 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1732 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1733 if (
$object->fk_warehouse > 0) {
1734 $warehousestatic =
new Entrepot($db);
1735 $warehousestatic->fetch(
$object->fk_warehouse);
1736 print $warehousestatic->getNomUrl(1);
1744 print
'<div class="fichehalfright">';
1746 print
'<div class="underbanner clearboth"></div>';
1748 print
'<table class="border tableforfield centpercent">';
1751 if (isModEnabled(
'agenda')) {
1752 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1754 print $formother->showColor(
$object->color,
'');
1760 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1761 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1763 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1769 $langs->load(
"languages");
1770 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1772 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1776 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1782 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1783 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1784 print
'<td>'.$object->openid.
'</td>';
1789 if (isModEnabled(
'multicompany') && is_object($mc)) {
1791 if (!method_exists($mc,
'formObjectOptions')) {
1792 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1793 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1795 print $langs->trans(
"AllEntities");
1797 $mc->getInfo(
$object->entity);
1800 print
"</td></tr>\n";
1806 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1809 if (isModEnabled(
"societe")) {
1810 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1815 $societe->fetch(
$object->socid);
1816 if ($societe->id > 0) {
1817 $s .= $societe->getNomUrl(1,
'');
1820 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1822 if (!empty(
$object->contact_id)) {
1824 $contact->fetch(
$object->contact_id);
1825 if ($contact->id > 0) {
1826 if (
$object->socid > 0 && $s) {
1831 $s .= $contact->getNomUrl(1,
'');
1840 if (isModEnabled(
'member')) {
1841 $langs->load(
"members");
1842 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1846 $adh->fetch(
$object->fk_member);
1847 $adh->ref = $adh->getFullname($langs);
1848 print $adh->getNomUrl(-1);
1850 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1857 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1859 print
"</td></tr>\n";
1867 print
'<div class="div-table-responsive-no-min">';
1868 print
'<table class="noborder tableforfield centpercent">';
1870 print
'<tr class="liste_titre"><th class="liste_titre">';
1871 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1873 print
'<th class="liste_titre"></th>';
1877 print
'<tr class="nooddeven"><td class="titlefieldmax45">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1879 if (
$object->datestartvalidity) {
1880 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1883 if (
$object->dateendvalidity) {
1884 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1891 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1892 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
1901 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1902 if (!empty(
$object->ldap_sid)) {
1903 if ($passDoNotExpire) {
1904 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1905 } elseif ($userChangePassNextLogon) {
1906 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1907 } elseif ($userDisabled) {
1908 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1910 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1913 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1916 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1917 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1938 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
1939 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1941 $valuetoshow = $hookmanager->resPrint;
1943 $valuetoshow .= $hookmanager->resPrint;
1947 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
1948 print
'<td class="wordbreak">';
1955 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1956 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1958 if (!empty(
$object->api_key)) {
1959 print
'<span class="opacitymedium">';
1966 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1968 if (
$object->datepreviouslogin) {
1969 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1972 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1983 print
'<div class="clearboth"></div>';
1992 print
'<div class="tabsAction">';
1994 $parameters = array();
1995 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1996 if (empty($reshook)) {
2000 'class' =>
'classfortooltip'
2004 if (empty($user->socid)) {
2005 $canSendMail =
false;
2007 $langs->load(
"mails");
2008 $canSendMail =
true;
2009 unset($params[
'attr'][
'title']);
2011 $langs->load(
"mails");
2012 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2014 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2017 if ($caneditfield && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2019 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2020 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2022 unset($params[
'attr'][
'title']);
2023 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
2025 } elseif ($caneditpasswordandsee && !
$object->ldap_sid &&
2026 (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2027 unset($params[
'attr'][
'title']);
2028 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2035 'class' =>
'classfortooltip'
2039 if (
$object->status == $object::STATUS_DISABLED) {
2040 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2041 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2042 } elseif (($user->id != $id && $caneditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2043 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2044 unset($params[
'attr'][
'title']);
2045 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2048 if (
$object->status == $object::STATUS_DISABLED) {
2049 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2050 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2051 } elseif (($user->id != $id && $caneditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2052 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2054 unset($params[
'attr'][
'title']);
2055 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2057 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2058 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2063 if ($user->id != $id && $candisableuser &&
$object->statut == 0 &&
2064 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2065 unset($params[
'attr'][
'title']);
2066 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2069 if ($user->id != $id && $candisableuser &&
$object->statut == 1 &&
2070 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2071 unset($params[
'attr'][
'title']);
2072 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2074 if ($user->id == $id) {
2075 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2076 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2080 if ($user->id != $id && $candisableuser &&
2081 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2082 if ($user->admin || !
$object->admin) {
2083 unset($params[
'attr'][
'title']);
2084 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2086 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2087 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2097 if (
GETPOST(
'modelselected')) {
2098 $action =
'presend';
2102 $modelmail =
'user';
2103 $defaulttopic =
'Information';
2104 $diroutput = $conf->user->dir_output;
2105 $trackid =
'use'.$object->id;
2107 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2109 if ($action !=
'presend' && $action !=
'send') {
2114 if ($canreadgroup) {
2115 print
'<!-- Group section -->'.
"\n";
2123 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2125 if (!empty($groupslist)) {
2126 foreach ($groupslist as $groupforuser) {
2127 $exclude[] = $groupforuser->id;
2132 $parameters = array(
'caneditgroup' => $caneditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2133 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2134 print $hookmanager->resPrint;
2136 if (empty($reshook)) {
2137 if ($caneditgroup) {
2138 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">'.
"\n";
2139 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2140 print
'<input type="hidden" name="action" value="addgroup" />';
2141 print
'<input type="hidden" name="page_y" value="" />';
2144 print
'<!-- List of groups of the user -->'.
"\n";
2145 print
'<table class="noborder centpercent">'.
"\n";
2146 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2147 print
'<th class="liste_titre right">';
2148 if ($caneditgroup) {
2149 print $form->select_dolgroups(
'',
'group', 1, $exclude, 0,
'',
'',
$object->entity,
false,
'maxwidth150');
2151 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2152 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2154 print
'</th></tr>'.
"\n";
2157 if (!empty($groupslist)) {
2158 foreach ($groupslist as $group) {
2159 print
'<tr class="oddeven">';
2160 print
'<td class="tdoverflowmax150">';
2161 if ($caneditgroup) {
2162 print $group->getNomUrl(1);
2164 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2167 print
'<td class="right">';
2168 if ($caneditgroup) {
2169 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2170 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2175 print
"</td></tr>\n";
2178 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2183 if ($caneditgroup) {
2195 if ($action ==
'edit' && ($canedituser || $caneditpasswordandsee)) {
2196 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2197 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2198 print
'<input type="hidden" name="action" value="update">';
2199 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2203 print
'<table class="border centpercent">';
2207 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2215 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2216 if ($caneditfield && !
$object->ldap_sid) {
2217 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2218 } elseif (
$object->civility_code) {
2219 print $langs->trans(
"Civility".
$object->civility_code);
2225 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2227 if ($caneditfield && !
$object->ldap_sid) {
2228 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2230 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2237 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2239 if ($caneditfield && !
$object->ldap_sid) {
2240 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2242 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2248 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2250 if ($user->admin && !
$object->ldap_sid) {
2251 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2253 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2260 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2262 $langs->load(
"admin");
2264 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2265 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2269 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2270 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2276 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2277 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2280 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2282 if (isModEnabled(
'multicompany') && !$user->entity) {
2283 if ($conf->use_javascript_ajax) {
2284 print
'<script type="text/javascript">
2286 var admin = $("select[name=admin]").val();
2288 $("input[name=superadmin]")
2289 .prop("disabled", true)
2290 .prop("checked", false);
2292 if ($("input[name=superadmin]").is(":checked")) {
2293 $("select[name=entity]")
2294 .prop("disabled", true);
2296 $("select[name=admin]").change(function() {
2297 if ( $(this).val() == 0 ) {
2298 $("input[name=superadmin]")
2299 .prop("disabled", true)
2300 .prop("checked", false);
2301 $("select[name=entity]")
2302 .prop("disabled", false);
2304 $("input[name=superadmin]")
2305 .prop("disabled", false);
2308 $("input[name=superadmin]").change(function() {
2309 if ( $(this).is(":checked")) {
2310 $("select[name=entity]")
2311 .prop("disabled", true);
2313 $("select[name=entity]")
2314 .prop("disabled", false);
2321 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2322 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2326 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2327 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2328 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2329 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2338 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2340 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2341 if ($caneditfield) {
2342 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2344 print $arraygender[
$object->gender];
2350 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2351 if ($caneditfield) {
2352 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2355 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2364 if ($nbofusers > 1) {
2366 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2368 if ($caneditfield) {
2369 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');
2371 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2372 $huser =
new User($db);
2373 $huser->fetch(
$object->fk_user);
2374 print $huser->getNomUrl(-1);
2380 if (isModEnabled(
'expensereport')) {
2381 print
'<tr><td class="titlefieldcreate">';
2382 $text = $langs->trans(
"ForceUserExpenseValidator");
2383 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2386 if ($caneditfield) {
2387 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');
2389 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2390 $evuser =
new User($db);
2391 $evuser->fetch(
$object->fk_user_expense_validator);
2392 print $evuser->getNomUrl(-1);
2399 if (isModEnabled(
'holiday')) {
2400 print
'<tr><td class="titlefieldcreate">';
2401 $text = $langs->trans(
"ForceUserHolidayValidator");
2402 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2405 if ($caneditfield) {
2406 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');
2408 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2409 $hvuser =
new User($db);
2410 $hvuser->fetch(
$object->fk_user_holiday_validator);
2411 print $hvuser->getNomUrl(-1);
2419 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2421 if ($user->id ==
$object->id || !$user->admin) {
2423 $type = $langs->trans(
"Internal");
2425 $type = $langs->trans(
"External");
2428 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2430 print
' ('.$langs->trans(
"DomainUser").
')';
2440 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2443 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2445 print
' ('.$langs->trans(
"DomainUser").
')';
2448 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2451 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2453 print
' ('.$langs->trans(
"DomainUser").
')';
2456 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2459 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2461 print
' ('.$langs->trans(
"DomainUser").
')';
2464 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2467 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2476 print
'<table class="border centpercent">';
2479 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2481 if ($caneditfield) {
2482 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2488 if ($caneditfield) {
2489 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2497 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2500 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2501 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2503 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2504 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2506 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2507 if ($caneditpasswordandsee) {
2508 $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">';
2509 if (!empty($conf->use_javascript_ajax)) {
2510 $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').
'"');
2513 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2517 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
2518 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2520 $valuetoshow = $hookmanager->resPrint;
2522 $valuetoshow .= $hookmanager->resPrint;
2526 print
"</td></tr>\n";
2529 if (isModEnabled(
'api')) {
2530 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2532 if ($caneditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2533 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2534 if (!empty($conf->use_javascript_ajax)) {
2535 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2542 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2543 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2545 if ($caneditfield) {
2546 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2548 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2554 print
'</table><hr><table class="border centpercent">';
2558 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2560 if ($caneditfield) {
2561 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2564 if ($caneditfield) {
2565 print
'</textarea>';
2570 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2571 if ($caneditfield) {
2572 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2579 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2580 if ($caneditfield) {
2581 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2588 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td>';
2589 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2590 if ($caneditfield) {
2591 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2593 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2597 print $countrylabel;
2603 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2604 if ($caneditfield) {
2605 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2606 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2614 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2616 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2617 if ($caneditfield && empty(
$object->ldap_sid)) {
2618 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2620 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2626 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2628 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2629 if ($caneditfield && empty(
$object->ldap_sid)) {
2630 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2632 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2638 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2640 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2641 if ($caneditfield && empty(
$object->ldap_sid)) {
2642 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2644 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2650 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2652 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2653 if ($caneditfield && empty(
$object->ldap_sid)) {
2654 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2656 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2661 if (isModEnabled(
'socialnetworks')) {
2662 foreach ($socialnetworks as $key => $value) {
2663 if ($value[
'active']) {
2664 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2666 if (!empty($value[
'icon'])) {
2667 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2669 if ($caneditfield && empty(
$object->ldap_sid)) {
2670 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2672 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2673 print
$object->socialnetworks[$key];
2678 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2683 print
'</table><hr><table class="border centpercent">';
2687 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2688 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2689 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>';
2694 if (isModEnabled(
'accounting')) {
2696 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2698 if ($caneditfield) {
2699 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2701 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2702 print
$object->accountancy_code;
2709 if (isModEnabled(
'agenda')) {
2710 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2712 if ($caneditfield) {
2713 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1,
'',
'hideifnotset');
2715 print $formother->showColor(
$object->color,
'');
2722 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2724 print $form->showphoto(
'userphoto',
$object, 60, 0, $caneditfield,
'photowithmargin',
'small', 1, 0,
'user', 1);
2729 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2730 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2732 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2733 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
null,
null,
null,
null, 1);
2735 $cats = $c->containing(
$object->id, Categorie::TYPE_USER);
2736 $arrayselected = array();
2737 foreach ($cats as $cat) {
2738 $arrayselected[] = $cat->id;
2740 if ($caneditfield) {
2741 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
2743 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2750 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";
2751 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0,
null,
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2757 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2759 print
$object->getLibStatut(4);
2786 if (isModEnabled(
'member')) {
2787 $langs->load(
"members");
2788 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2792 $adh->fetch(
$object->fk_member);
2793 $adh->ref = $adh->login;
2794 print $adh->getNomUrl(1);
2796 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2804 if (isModEnabled(
'multicompany') && is_object($mc)) {
2806 if (!method_exists($mc,
'formObjectOptions')) {
2807 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2808 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2809 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2810 print
"</td></tr>\n";
2812 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2818 $parameters = array(
'colspan' =>
' colspan="2"');
2820 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2821 print $hookmanager->resPrint;
2822 if (empty($reshook)) {
2823 if ($caneditfield) {
2824 print
$object->showOptionals($extrafields,
'edit');
2826 print
$object->showOptionals($extrafields,
'view');
2831 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2833 if ($caneditfield) {
2834 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2836 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2837 print $doleditor->Create(1);
2849 print
'<table class="border centpercent">';
2855 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2857 if ($caneditfield) {
2858 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2860 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2866 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2868 if ($caneditfield) {
2869 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2877 if ((empty($user->socid) && in_array($id, $childids))
2878 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
2879 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2880 $langs->load(
"salaries");
2883 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2885 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
2891 $text = $langs->trans(
"THM");
2892 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2895 if ($caneditfield) {
2896 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
2898 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2905 $text = $langs->trans(
"TJM");
2906 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2909 if ($caneditfield) {
2910 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
2912 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2919 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2921 if ($caneditfield) {
2922 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2927 if ($dateemployment && $dateemploymentend) {
2931 if ($caneditfield) {
2932 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2940 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2942 if ($caneditfield) {
2943 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2954 print
'<div class="center">';
2955 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2956 print
' ';
2957 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2963 if ($action !=
'edit' && $action !=
'presend') {
2964 print
'<div class="fichecenter"><div class="fichehalfleft">';
2969 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2970 $genallowed = $user->hasRight(
"user",
"user",
"read");
2971 $delallowed = $user->hasRight(
"user",
"user",
"write");
2973 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', empty($soc->default_lang) ?
'' : $soc->default_lang);
2974 $somethingshown = $formfile->numoffiles;
2977 $linktoelem = $form->showLinkToObjectBlock(
$object,
null,
null);
2978 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2982 $morehtmlcenter =
'<div class="nowraponall">';
2983 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
2984 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
2985 $morehtmlcenter .=
'</div>';
2987 print
'</div><div class="fichehalfright">';
2990 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2992 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
2994 print
'</div></div>';
2997 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3004include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3006if (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()
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)
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0)
Show EMail link formatted for HTML output.
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.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 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.
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.