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) {
136 $canedituser = (($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"));
137 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
138 $caneditpasswordandsee = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin));
139 $caneditpasswordandsend = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
147$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $caneditgroup);
148$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
153if (empty($reshook)) {
154 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
156 if (empty($backtopage) || ($cancel && empty($id))) {
157 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
158 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
159 $backtopage = $backurlforlist;
161 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
167 if (!empty($backtopageforcancel)) {
168 header(
"Location: ".$backtopageforcancel);
170 } elseif (!empty($backtopage)) {
171 header(
"Location: ".$backtopage);
177 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $candisableuser) {
178 if ($id != $user->id) {
180 if (
$object->admin && empty($user->admin)) {
183 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
186 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
192 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $candisableuser) {
195 if ($id != $user->id) {
198 if (!empty($conf->file->main_limit_users)) {
199 $nb =
$object->getNbOfUsers(
"active");
200 if ($nb >= $conf->file->main_limit_users) {
202 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
208 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
214 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $candisableuser) {
215 if ($id != $user->id) {
216 if (!GETPOSTISSET(
'token')) {
217 print
'Error, token required for this critical operation';
225 $result =
$object->delete($user);
227 $langs->load(
"errors");
231 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
238 if ($action ==
'add' && $canadduser) {
252 if (!empty($conf->file->main_limit_users)) {
253 $nb =
$object->getNbOfUsers(
"active");
254 if ($nb >= $conf->file->main_limit_users) {
256 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
266 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
280 if (isModEnabled(
'socialnetworks')) {
281 $object->socialnetworks = array();
282 foreach ($socialnetworks as $key => $value) {
283 if (
GETPOST($key,
'alphanohtml')) {
289 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
292 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
307 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
308 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
312 $object->dateemployment = $dateemployment;
313 $object->dateemploymentend = $dateemploymentend;
314 $object->datestartvalidity = $datestartvalidity;
315 $object->dateendvalidity = $dateendvalidity;
323 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
330 if (isModEnabled(
'multicompany')) {
337 $object->entity = ($entity ==
'' ? 1 : $entity);
341 $object->entity = ($entity ==
'' ? 1 : $entity);
352 if (
GETPOST(
'password',
'none')) {
353 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'none'));
355 if (is_int($resPass) && $resPass < 0) {
356 $langs->load(
"errors");
361 if (isModEnabled(
"category")) {
363 $usercats =
GETPOST(
'usercats',
'array');
364 $object->setCategories($usercats);
368 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
372 $langs->load(
"errors");
381 if (($action ==
'addgroup' || $action ==
'removegroup') && $caneditgroup) {
384 $editgroup->fetch($group);
385 $editgroup->oldcopy = clone $editgroup;
389 if ($action ==
'addgroup') {
390 $result =
$object->SetInGroup($group, $editgroup->entity);
392 if ($action ==
'removegroup') {
393 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
404 if ($action ==
'update' && ($canedituser || $caneditpasswordandsee)) {
405 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
410 if (!
GETPOST(
"lastname",
'alpha')) {
415 if (!
GETPOST(
"login",
'alpha')) {
432 if (GETPOSTISSET(
"ref_employee")) {
436 if (GETPOSTISSET(
"national_registration_number")) {
437 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
440 if ($caneditpasswordandsee) {
443 if ($caneditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
446 if (!empty($user->admin) && $user->id != $id) {
451 if ($user->admin && !
$object->ldap_sid) {
463 if (isModEnabled(
'socialnetworks')) {
464 $object->socialnetworks = array();
465 foreach ($socialnetworks as $key => $value) {
466 if (
GETPOST($key,
'alphanohtml')) {
472 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
475 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
488 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
490 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
494 $object->dateemployment = $dateemployment;
495 $object->dateemploymentend = $dateemploymentend;
496 $object->datestartvalidity = $datestartvalidity;
497 $object->dateendvalidity = $dateendvalidity;
500 if (isModEnabled(
'stock')) {
507 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
521 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
529 if (!empty($_FILES[
'photo'][
'name'])) {
535 $langs->load(
"errors");
537 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
542 $passwordismodified = 0;
545 $passwordismodified = 1;
552 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
553 $langs->load(
"errors");
554 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
562 if (!$error && GETPOSTISSET(
'contactid')) {
566 if ($contactid > 0) {
568 $contact->fetch($contactid);
570 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
571 $sql .=
" SET fk_socpeople=".((int) $contactid);
572 if (!empty($contact->socid)) {
573 $sql .=
", fk_soc=".((int) $contact->socid);
574 } elseif ($socid > 0) {
575 $sql .=
", fk_soc = null";
576 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
578 $sql .=
" WHERE rowid = ".((int)
$object->id);
579 } elseif ($socid > 0) {
580 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
581 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
582 $sql .=
" WHERE rowid = ".((int)
$object->id);
584 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
585 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
586 $sql .=
" WHERE rowid = ".((int)
$object->id);
589 $resql = $db->query($sql);
596 if (!$error && !count(
$object->errors)) {
598 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/'.
$object->oldcopy->photo;
601 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0,
$object,
'user').
'photos/thumbs';
605 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
606 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1,
$object,
'user').
'/photos';
612 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
614 if (!($result > 0)) {
622 $langs->load(
"errors");
623 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
628 if (!$error && !count(
$object->errors)) {
630 $categories =
GETPOST(
'usercats',
'array');
631 $object->setCategories($categories);
634 if (!$error && !count(
$object->errors)) {
638 $login = $_SESSION[
"dol_login"];
641 $langs->load(
"errors");
642 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
644 if ($passwordismodified &&
$object->login == $user->login) {
646 $langs->load(
"errors");
647 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
648 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
656 if ($caneditpasswordandsee) {
657 dol_syslog(
"Not allowed to change fields, only password");
661 if (
GETPOST(
"password",
"none")) {
665 if (is_int($ret) && $ret < 0) {
674 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $caneditpasswordandsee)
675 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $caneditpasswordandsend))
679 $newpassword =
$object->setPassword($user,
'');
680 if (is_int($newpassword) && $newpassword < 0) {
682 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
685 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
686 if (
$object->send_password($user, $newpassword) > 0) {
692 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
698 if ($action ==
'adduserldap' && $canadduser) {
699 $selecteduser =
GETPOST(
'users');
701 $required_fields = array(
717 if (isModEnabled(
'socialnetworks')) {
718 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
719 foreach ($arrayofsocialnetworks as $socialnetwork) {
725 $result = $ldap->connectBind();
728 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
733 if (is_array($ldapusers)) {
734 foreach ($ldapusers as $key => $attribute) {
746 $ldap_social = array();
748 if (isModEnabled(
'socialnetworks')) {
749 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
750 foreach ($arrayofsocialnetworks as $socialnetwork) {
751 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
762 $triggersendname =
'USER_SENTBYMAIL';
764 $mode =
'emailfromuser';
765 $trackid =
'use'.$id;
766 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
769 $upload_dir = $conf->user->dir_output;
770 $permissiontoadd = $user->hasRight(
"user",
"user",
"write");
771 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
779$form =
new Form($db);
784if (isModEnabled(
'stock')) {
790$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
791$resql = $db->query($sql);
793 $obj = $db->fetch_object($resql);
795 $nbofusers = $obj->nb;
803 $title = $person_name.
" - ".$langs->trans(
'Card');
805 if (
GETPOST(
'employee',
'alphanohtml')) {
806 $title = $langs->trans(
"NewEmployee");
808 $title = $langs->trans(
"NewUser");
813llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
816if ($action ==
'create' || $action ==
'adduserldap') {
819 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
823 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
828 $result = $ldap->connectBind();
830 $required_fields = array(
850 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
855 if (is_array($ldapusers)) {
856 foreach ($ldapusers as $key => $ldapuser) {
859 foreach ($required_fields as $value) {
861 $label .= $value.
"=******* ";
863 $label .= $value.
"=".$ldapuser[$value].
" ";
866 $liste[$key] = $label;
876 print
"\n\n<!-- Form liste LDAP debut -->\n";
878 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
879 print
'<input type="hidden" name="token" value="'.newToken().
'">';
880 print
'<table class="border centpercent"><tr>';
881 print
'<td width="160">';
882 print $langs->trans(
"LDAPUsers");
885 print
'<input type="hidden" name="action" value="adduserldap">';
886 if (is_array($liste) && count($liste)) {
887 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
890 print
'</td><td class="center">';
891 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
892 print
'</td></tr></table>';
895 print
"\n<!-- Form liste LDAP fin -->\n\n";
900 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
901 print
'<input type="hidden" name="token" value="'.newToken().
'">';
902 print
'<input type="hidden" name="action" value="add">';
903 if (!empty($ldap_sid)) {
904 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
906 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
912 print
'<table class="border centpercent">';
915 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
916 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
921 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
923 if (!empty($ldap_lastname)) {
924 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
925 print $ldap_lastname;
927 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
932 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
934 if (!empty($ldap_firstname)) {
935 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
936 print $ldap_firstname;
938 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
943 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
945 if (!empty($ldap_login)) {
946 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
948 } elseif (!empty($ldap_loginsmb)) {
949 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
950 print $ldap_loginsmb;
952 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
956 if (!empty($conf->use_javascript_ajax)) {
960 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
961 if ($charforseparator ==
'none') {
962 $charforseparator =
'';
965 jQuery(document).ready(function() {
966 $(".createloginauto").on("keyup", function() {
967 console.log(".createloginauto change: We generate login when we have a lastname");
969 lastname = $("#lastname").val().toLowerCase();
972 print
' firstname = $("#firstname").val().toLowerCase()[0];';
974 print
' firstname = $("#firstname").val().toLowerCase();';
980 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
984 $(
"#login").val(login);
990 $generated_password = '';
991 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
992 $generated_password = getRandomPassword(false);
994 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
997 if (!empty($user->admin)) {
998 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1000 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1002 if (isModEnabled('multicompany
') && !$user->entity) {
1003 if (!empty($conf->use_javascript_ajax)) {
1004 print '<script
type=
"text/javascript">
1006 $(
"select[name=admin]").change(
function() {
1007 if ( $(
this).val() == 0 ) {
1008 $(
"input[name=superadmin]")
1009 .prop(
"disabled",
true)
1010 .prop(
"checked",
false);
1011 $(
"select[name=entity]")
1012 .prop(
"disabled",
false);
1014 $(
"input[name=superadmin]")
1015 .prop(
"disabled",
false);
1018 $(
"input[name=superadmin]").change(
function() {
1019 if ( $(
this).is(
":checked") ) {
1020 $(
"select[name=entity]")
1021 .prop(
"disabled",
true);
1023 $(
"select[name=entity]")
1024 .prop(
"disabled",
false);
1030 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1031 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1032 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1034 print "</td></tr>\n";
1038 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1040 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1041 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1045 $defaultemployee = '1
';
1047 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1048 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1049 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1053 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1055 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
');
1059 // Expense report validator
1060 if (isModEnabled('expensereport
')) {
1061 print '<tr><td
class=
"titlefieldcreate">
';
1062 $text = $langs->trans("ForceUserExpenseValidator");
1063 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1066 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
');
1071 // Holiday request validator
1072 if (isModEnabled('holiday
')) {
1073 print '<tr><td
class=
"titlefieldcreate">
';
1074 $text = $langs->trans("ForceUserHolidayValidator");
1075 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1078 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
');
1084 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1086 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1090 print '</
table><hr><
table class=
"border centpercent">
';
1094 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1096 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1100 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1105 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1108 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1109 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1111 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1112 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1114 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1115 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1116 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1117 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1120 $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">';
1121 if (!empty($conf->use_javascript_ajax)) {
1122 $valuetoshow .=
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1128 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
1129 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1131 $valuetoshow = $hookmanager->resPrint;
1133 $valuetoshow .= $hookmanager->resPrint;
1139 if (isModEnabled(
'api')) {
1142 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1144 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">';
1145 if (!empty($conf->use_javascript_ajax)) {
1146 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1152 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1156 print
'</table><hr><table class="border centpercent">';
1160 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1161 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1163 print
'</textarea></td></tr>';
1166 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1167 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1171 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1172 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1176 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1177 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1178 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1180 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1186 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1187 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1188 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1193 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1195 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1196 if (!empty($ldap_phone)) {
1197 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1200 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1205 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1207 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1208 if (!empty($ldap_mobile)) {
1209 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1212 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1217 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1219 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1220 if (!empty($ldap_fax)) {
1221 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1224 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1229 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1231 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1232 if (!empty($ldap_mail)) {
1233 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1236 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1241 if (isModEnabled(
'socialnetworks')) {
1242 foreach ($socialnetworks as $key => $value) {
1243 if ($value[
'active']) {
1244 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1246 if (!empty($value[
'icon'])) {
1247 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1249 if (!empty($ldap_social[$key])) {
1250 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1251 print $ldap_social[$key];
1253 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1258 if (!empty($ldap_social[$key])) {
1259 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1261 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1268 if (isModEnabled(
'accounting')) {
1269 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1271 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1276 if (isModEnabled(
'agenda')) {
1277 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1279 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1,
'',
'hideifnotset');
1284 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1285 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1286 $cate_arbo = $form->select_all_categories(
'user',
'',
'parent', 0, 0, 3);
1287 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1293 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1294 print
'<td class="maxwidthonsmartphone">'.
"\n";
1295 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');
1301 if (isModEnabled(
'multicompany') && is_object($mc)) {
1303 if (!method_exists($mc,
'formObjectOptions')) {
1304 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1305 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1306 print
"<td>".$mc->select_entities($conf->entity);
1307 print
"</td></tr>\n";
1309 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1315 $parameters = array();
1316 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1319 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1320 print
'<td class="wordbreak">';
1321 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1323 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1324 print $doleditor->Create(1);
1328 print
'<tr><td class="tdtop">';
1329 print $langs->trans(
"NotePublic");
1331 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1332 $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%');
1333 $doleditor->Create();
1334 print
"</td></tr>\n";
1337 print
'<tr><td class="tdtop">';
1338 print $langs->trans(
"NotePrivate");
1340 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1341 $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%');
1342 $doleditor->Create();
1343 print
"</td></tr>\n";
1345 print
'</table><hr><table class="border centpercent">';
1352 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1353 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1358 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1360 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1363 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1364 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1365 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1366 $langs->load(
"salaries");
1370 $text = $langs->trans(
"THM");
1371 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1374 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1380 $text = $langs->trans(
"TJM");
1381 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1384 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1389 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1391 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1397 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1399 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1404 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1406 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1410 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1415 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1417 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1425 print $form->buttonsSaveCancel(
"CreateUser");
1431 $res =
$object->fetch($id,
'',
'', 1);
1436 $res =
$object->fetch_optionals();
1448 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1450 $result = $ldap->connectBind();
1452 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1453 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1458 $passDoNotExpire = 0;
1459 $userChangePassNextLogon = 0;
1464 if (count($ldap->uacf) > 0) {
1465 foreach ($ldap->uacf as $key => $statut) {
1466 if ($key == 65536) {
1467 $passDoNotExpire = 1;
1468 $statutUACF = $statut;
1473 $statutUACF =
"ACCOUNTDISABLE";
1476 if ($ldap->pwdlastset == 0) {
1477 $userChangePassNextLogon = 1;
1483 if ($mode ==
'employee') {
1484 $title = $langs->trans(
"Employee");
1485 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1487 $title = $langs->trans(
"User");
1490 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1491 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1500 if ($action ==
'password') {
1501 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1507 if ($action ==
'passwordsend') {
1508 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1514 if ($action ==
'disable') {
1515 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1521 if ($action ==
'enable') {
1522 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1528 if ($action ==
'delete') {
1529 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1535 if ($action !=
'edit') {
1538 $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">';
1539 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1540 $morehtmlref .=
'</a>';
1542 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1543 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'nohover');
1545 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1547 print
'<div class="fichecenter">';
1548 print
'<div class="fichehalfleft">';
1550 print
'<div class="underbanner clearboth"></div>';
1551 print
'<table class="border tableforfield centpercent">';
1554 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1556 print
'<td class="error">';
1557 print $langs->trans(
"LoginAccountDisableInDolibarr");
1562 if (property_exists(
$object,
'admin')) {
1563 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1564 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1565 } elseif (!empty(
$object->admin)) {
1566 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1576 $text = $langs->trans(
"Type");
1577 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1579 $type = $langs->trans(
"Internal");
1581 $type = $langs->trans(
"External");
1583 print
'<span class="badgeneutral">';
1586 print
' ('.$langs->trans(
"DomainUser").
')';
1589 print
'</td></tr>'.
"\n";
1593 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1594 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1595 print
'</td></tr>'.
"\n";
1599 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1601 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1605 print
'</td></tr>'.
"\n";
1608 if ($nbofusers > 1) {
1610 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1612 if (empty(
$object->fk_user)) {
1613 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1615 $huser =
new User($db);
1617 $huser->fetch(
$object->fk_user);
1618 print $huser->getNomUrl(-1);
1620 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1627 if (isModEnabled(
'expensereport')) {
1629 $text = $langs->trans(
"ForceUserExpenseValidator");
1630 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1633 if (!empty(
$object->fk_user_expense_validator)) {
1634 $evuser =
new User($db);
1635 $evuser->fetch(
$object->fk_user_expense_validator);
1636 print $evuser->getNomUrl(-1);
1643 if (isModEnabled(
'holiday')) {
1645 $text = $langs->trans(
"ForceUserHolidayValidator");
1646 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1649 if (!empty(
$object->fk_user_holiday_validator)) {
1650 $hvuser =
new User($db);
1651 $hvuser->fetch(
$object->fk_user_holiday_validator);
1652 print $hvuser->getNomUrl(-1);
1660 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1661 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1665 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1672 if ((empty($user->socid) && in_array($id, $childids))
1673 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1674 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1675 $langs->load(
"salaries");
1678 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1680 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1686 $text = $langs->trans(
"THM");
1687 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1690 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1696 $text = $langs->trans(
"TJM");
1697 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1700 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
1706 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1708 if (
$object->dateemployment) {
1709 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1712 if (
$object->dateemploymentend) {
1713 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1720 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1728 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1729 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1730 if (
$object->fk_warehouse > 0) {
1731 $warehousestatic =
new Entrepot($db);
1732 $warehousestatic->fetch(
$object->fk_warehouse);
1733 print $warehousestatic->getNomUrl(1);
1741 print
'<div class="fichehalfright">';
1743 print
'<div class="underbanner clearboth"></div>';
1745 print
'<table class="border tableforfield centpercent">';
1748 if (isModEnabled(
'agenda')) {
1749 print
'<tr><td class="titlefield">'.$langs->trans(
"ColorUser").
'</td>';
1751 print $formother->showColor(
$object->color,
'');
1757 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1758 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td>';
1759 print
'<td colspan="3">';
1760 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1766 $langs->load(
"languages");
1767 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1768 print
'<tr><td class="titlefield">';
1769 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1773 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1779 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1780 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1781 print
'<td>'.$object->openid.
'</td>';
1786 if (isModEnabled(
'multicompany') && is_object($mc)) {
1788 if (!method_exists($mc,
'formObjectOptions')) {
1789 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1790 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1792 print $langs->trans(
"AllEntities");
1794 $mc->getInfo(
$object->entity);
1797 print
"</td></tr>\n";
1803 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1806 if (isModEnabled(
"societe")) {
1807 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1812 $societe->fetch(
$object->socid);
1813 if ($societe->id > 0) {
1814 $s .= $societe->getNomUrl(1,
'');
1817 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1819 if (!empty(
$object->contact_id)) {
1821 $contact->fetch(
$object->contact_id);
1822 if ($contact->id > 0) {
1823 if (
$object->socid > 0 && $s) {
1828 $s .= $contact->getNomUrl(1,
'');
1837 if (isModEnabled(
'member')) {
1838 $langs->load(
"members");
1839 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1843 $adh->fetch(
$object->fk_member);
1844 $adh->ref = $adh->getFullname($langs);
1845 print $adh->getNomUrl(-1);
1847 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1854 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1856 print
"</td></tr>\n";
1864 print
'<div class="div-table-responsive-no-min">';
1865 print
'<table class="border tableforfield centpercent">';
1867 print
'<tr class="liste_titre"><td class="liste_titre">';
1868 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Credentials");
1870 print
'<td class="liste_titre"></td>';
1874 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1876 if (
$object->datestartvalidity) {
1877 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1880 if (
$object->dateendvalidity) {
1881 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1888 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1889 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
1898 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1899 if (!empty(
$object->ldap_sid)) {
1900 if ($passDoNotExpire) {
1901 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1902 } elseif ($userChangePassNextLogon) {
1903 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1904 } elseif ($userDisabled) {
1905 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1907 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1910 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1913 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1914 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1935 $parameters = array(
'valuetoshow' => $valuetoshow);
1936 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1938 $valuetoshow = $hookmanager->resPrint;
1940 $valuetoshow .= $hookmanager->resPrint;
1944 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"Password").
'</td>';
1945 print
'<td class="wordbreak">';
1952 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1953 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1955 if (!empty(
$object->api_key)) {
1956 print
'<span class="opacitymedium">';
1963 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1965 if (
$object->datepreviouslogin) {
1966 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1969 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1980 print
'<div class="clearboth"></div>';
1989 print
'<div class="tabsAction">';
1991 $parameters = array();
1992 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
1993 if (empty($reshook)) {
1997 'class' =>
'classfortooltip'
2001 if (empty($user->socid)) {
2002 $canSendMail =
false;
2004 $langs->load(
"mails");
2005 $canSendMail =
true;
2006 unset($params[
'attr'][
'title']);
2008 $langs->load(
"mails");
2009 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2011 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2014 if ($caneditfield && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2016 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2017 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2019 unset($params[
'attr'][
'title']);
2020 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
2022 } elseif ($caneditpasswordandsee && !
$object->ldap_sid &&
2023 (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2024 unset($params[
'attr'][
'title']);
2025 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2032 'class' =>
'classfortooltip'
2036 if (
$object->status == $object::STATUS_DISABLED) {
2037 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2038 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2039 } elseif (($user->id != $id && $caneditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2040 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2041 unset($params[
'attr'][
'title']);
2042 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2045 if (
$object->status == $object::STATUS_DISABLED) {
2046 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2047 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2048 } elseif (($user->id != $id && $caneditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2049 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2051 unset($params[
'attr'][
'title']);
2052 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2054 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2055 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2060 if ($user->id != $id && $candisableuser &&
$object->statut == 0 &&
2061 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2062 unset($params[
'attr'][
'title']);
2063 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2066 if ($user->id != $id && $candisableuser &&
$object->statut == 1 &&
2067 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2068 unset($params[
'attr'][
'title']);
2069 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2071 if ($user->id == $id) {
2072 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2073 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2077 if ($user->id != $id && $candisableuser &&
2078 ((!isModEnabled(
'multicompany') &&
$object->entity == $user->entity) || !$user->entity || (
$object->entity == $conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2079 if ($user->admin || !
$object->admin) {
2080 unset($params[
'attr'][
'title']);
2081 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2083 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2084 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2094 if (
GETPOST(
'modelselected')) {
2095 $action =
'presend';
2099 $modelmail =
'user';
2100 $defaulttopic =
'Information';
2101 $diroutput = $conf->user->dir_output;
2102 $trackid =
'use'.$object->id;
2104 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2106 if ($action !=
'presend' && $action !=
'send') {
2111 if ($canreadgroup) {
2112 print
'<!-- Group section -->'.
"\n";
2120 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2122 if (!empty($groupslist)) {
2123 foreach ($groupslist as $groupforuser) {
2124 $exclude[] = $groupforuser->id;
2129 $parameters = array(
'caneditgroup' => $caneditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2130 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2131 print $hookmanager->resPrint;
2133 if (empty($reshook)) {
2134 if ($caneditgroup) {
2135 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">'.
"\n";
2136 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2137 print
'<input type="hidden" name="action" value="addgroup" />';
2138 print
'<input type="hidden" name="page_y" value="" />';
2141 print
'<!-- List of groups of the user -->'.
"\n";
2142 print
'<table class="noborder centpercent">'.
"\n";
2143 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2144 print
'<th class="liste_titre right">';
2145 if ($caneditgroup) {
2146 print $form->select_dolgroups(
'',
'group', 1, $exclude, 0,
'',
'',
$object->entity,
false,
'maxwidth150');
2148 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2149 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2151 print
'</th></tr>'.
"\n";
2154 if (!empty($groupslist)) {
2155 foreach ($groupslist as $group) {
2156 print
'<tr class="oddeven">';
2157 print
'<td class="tdoverflowmax150">';
2158 if ($caneditgroup) {
2159 print $group->getNomUrl(1);
2161 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2164 print
'<td class="right">';
2165 if ($caneditgroup) {
2166 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2167 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2172 print
"</td></tr>\n";
2175 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2180 if ($caneditgroup) {
2192 if ($action ==
'edit' && ($canedituser || $caneditpasswordandsee)) {
2193 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2194 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2195 print
'<input type="hidden" name="action" value="update">';
2196 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2200 print
'<table class="border centpercent">';
2204 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2212 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2213 if ($caneditfield && !
$object->ldap_sid) {
2214 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2215 } elseif (
$object->civility_code) {
2216 print $langs->trans(
"Civility".
$object->civility_code);
2222 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2224 if ($caneditfield && !
$object->ldap_sid) {
2225 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2227 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2234 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2236 if ($caneditfield && !
$object->ldap_sid) {
2237 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2239 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2245 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2247 if ($user->admin && !
$object->ldap_sid) {
2248 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2250 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2257 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2259 $langs->load(
"admin");
2261 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2262 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2266 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2267 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2273 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2274 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2277 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2279 if (isModEnabled(
'multicompany') && !$user->entity) {
2280 if ($conf->use_javascript_ajax) {
2281 print
'<script type="text/javascript">
2283 var admin = $("select[name=admin]").val();
2285 $("input[name=superadmin]")
2286 .prop("disabled", true)
2287 .prop("checked", false);
2289 if ($("input[name=superadmin]").is(":checked")) {
2290 $("select[name=entity]")
2291 .prop("disabled", true);
2293 $("select[name=admin]").change(function() {
2294 if ( $(this).val() == 0 ) {
2295 $("input[name=superadmin]")
2296 .prop("disabled", true)
2297 .prop("checked", false);
2298 $("select[name=entity]")
2299 .prop("disabled", false);
2301 $("input[name=superadmin]")
2302 .prop("disabled", false);
2305 $("input[name=superadmin]").change(function() {
2306 if ( $(this).is(":checked")) {
2307 $("select[name=entity]")
2308 .prop("disabled", true);
2310 $("select[name=entity]")
2311 .prop("disabled", false);
2318 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2319 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2323 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2324 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2325 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2326 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2335 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2337 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2338 if ($caneditfield) {
2339 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2341 print $arraygender[
$object->gender];
2347 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2348 if ($caneditfield) {
2349 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2352 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2361 if ($nbofusers > 1) {
2363 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2365 if ($caneditfield) {
2366 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');
2368 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2369 $huser =
new User($db);
2370 $huser->fetch(
$object->fk_user);
2371 print $huser->getNomUrl(-1);
2377 if (isModEnabled(
'expensereport')) {
2378 print
'<tr><td class="titlefieldcreate">';
2379 $text = $langs->trans(
"ForceUserExpenseValidator");
2380 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2383 if ($caneditfield) {
2384 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');
2386 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2387 $evuser =
new User($db);
2388 $evuser->fetch(
$object->fk_user_expense_validator);
2389 print $evuser->getNomUrl(-1);
2396 if (isModEnabled(
'holiday')) {
2397 print
'<tr><td class="titlefieldcreate">';
2398 $text = $langs->trans(
"ForceUserHolidayValidator");
2399 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2402 if ($caneditfield) {
2403 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');
2405 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2406 $hvuser =
new User($db);
2407 $hvuser->fetch(
$object->fk_user_holiday_validator);
2408 print $hvuser->getNomUrl(-1);
2416 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2418 if ($user->id ==
$object->id || !$user->admin) {
2420 $type = $langs->trans(
"Internal");
2422 $type = $langs->trans(
"External");
2425 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2427 print
' ('.$langs->trans(
"DomainUser").
')';
2437 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2440 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2442 print
' ('.$langs->trans(
"DomainUser").
')';
2445 print
img_picto(
'',
'company').$form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2448 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2450 print
' ('.$langs->trans(
"DomainUser").
')';
2453 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2456 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2458 print
' ('.$langs->trans(
"DomainUser").
')';
2461 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2464 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2473 print
'<table class="border centpercent">';
2476 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2478 if ($caneditfield) {
2479 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2485 if ($caneditfield) {
2486 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2494 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2497 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2498 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2500 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2501 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2503 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2504 if ($caneditpasswordandsee) {
2505 $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">';
2506 if (!empty($conf->use_javascript_ajax)) {
2507 $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').
'"');
2510 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2514 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $caneditpasswordandsee,
'caneditpasswordandsend' => $caneditpasswordandsend);
2515 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2517 $valuetoshow = $hookmanager->resPrint;
2519 $valuetoshow .= $hookmanager->resPrint;
2523 print
"</td></tr>\n";
2526 if (isModEnabled(
'api')) {
2527 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2529 if ($caneditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2530 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2531 if (!empty($conf->use_javascript_ajax)) {
2532 print
img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2539 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2540 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2542 if ($caneditfield) {
2543 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2545 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2551 print
'</table><hr><table class="border centpercent">';
2555 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2557 if ($caneditfield) {
2558 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2561 if ($caneditfield) {
2562 print
'</textarea>';
2567 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2568 if ($caneditfield) {
2569 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2576 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2577 if ($caneditfield) {
2578 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2585 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'',
$object, 0).
'</td><td>';
2586 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2587 if ($caneditfield) {
2588 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2590 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2594 print $countrylabel;
2600 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2601 if ($caneditfield) {
2602 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2603 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2611 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2613 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2614 if ($caneditfield && empty(
$object->ldap_sid)) {
2615 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2617 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2623 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2625 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2626 if ($caneditfield && empty(
$object->ldap_sid)) {
2627 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2629 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2635 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2637 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2638 if ($caneditfield && empty(
$object->ldap_sid)) {
2639 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2641 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2647 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2649 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2650 if ($caneditfield && empty(
$object->ldap_sid)) {
2651 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2653 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2658 if (isModEnabled(
'socialnetworks')) {
2659 foreach ($socialnetworks as $key => $value) {
2660 if ($value[
'active']) {
2661 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2663 if (!empty($value[
'icon'])) {
2664 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2666 if ($caneditfield && empty(
$object->ldap_sid)) {
2667 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2669 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2670 print
$object->socialnetworks[$key];
2675 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2680 print
'</table><hr><table class="border centpercent">';
2684 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2685 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2686 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>';
2691 if (isModEnabled(
'accounting')) {
2693 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2695 if ($caneditfield) {
2696 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2698 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2699 print
$object->accountancy_code;
2706 if (isModEnabled(
'agenda')) {
2707 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2709 if ($caneditfield) {
2710 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1,
'',
'hideifnotset');
2712 print $formother->showColor(
$object->color,
'');
2719 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2721 print $form->showphoto(
'userphoto',
$object, 60, 0, $caneditfield,
'photowithmargin',
'small', 1, 0,
'user', 1);
2726 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2727 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2729 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2730 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER,
null,
null,
null,
null, 1);
2732 $cats = $c->containing(
$object->id, Categorie::TYPE_USER);
2733 $arrayselected = array();
2734 foreach ($cats as $cat) {
2735 $arrayselected[] = $cat->id;
2737 if ($caneditfield) {
2738 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
2740 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2747 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";
2748 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0,
null,
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2754 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2756 print
$object->getLibStatut(4);
2783 if (isModEnabled(
'member')) {
2784 $langs->load(
"members");
2785 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2789 $adh->fetch(
$object->fk_member);
2790 $adh->ref = $adh->login;
2791 print $adh->getNomUrl(1);
2793 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2801 if (isModEnabled(
'multicompany') && is_object($mc)) {
2803 if (!method_exists($mc,
'formObjectOptions')) {
2804 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2805 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2806 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2807 print
"</td></tr>\n";
2809 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2815 $parameters = array(
'colspan' =>
' colspan="2"');
2817 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2818 print $hookmanager->resPrint;
2819 if (empty($reshook)) {
2820 if ($caneditfield) {
2821 print
$object->showOptionals($extrafields,
'edit');
2823 print
$object->showOptionals($extrafields,
'view');
2828 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2830 if ($caneditfield) {
2831 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2833 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2834 print $doleditor->Create(1);
2846 print
'<table class="border centpercent">';
2852 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2854 if ($caneditfield) {
2855 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2857 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2863 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2865 if ($caneditfield) {
2866 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2874 if ((empty($user->socid) && in_array($id, $childids))
2875 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
2876 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2877 $langs->load(
"salaries");
2880 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2882 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
2888 $text = $langs->trans(
"THM");
2889 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2892 if ($caneditfield) {
2893 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
2895 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2902 $text = $langs->trans(
"TJM");
2903 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2906 if ($caneditfield) {
2907 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
2909 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
2916 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2918 if ($caneditfield) {
2919 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2924 if ($dateemployment && $dateemploymentend) {
2928 if ($caneditfield) {
2929 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2937 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2939 if ($caneditfield) {
2940 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2951 print
'<div class="center">';
2952 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2953 print
' ';
2954 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2960 if ($action !=
'edit' && $action !=
'presend') {
2961 print
'<div class="fichecenter"><div class="fichehalfleft">';
2966 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
2967 $genallowed = $user->hasRight(
"user",
"user",
"read");
2968 $delallowed = $user->hasRight(
"user",
"user",
"write");
2970 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);
2971 $somethingshown = $formfile->numoffiles;
2974 $linktoelem = $form->showLinkToObjectBlock(
$object,
null,
null);
2975 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
2979 $morehtmlcenter =
'<div class="nowraponall">';
2980 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
2981 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
2982 $morehtmlcenter .=
'</div>';
2984 print
'</div><div class="fichehalfright">';
2987 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2989 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
2991 print
'</div></div>';
2994 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3001include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3003if (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.