40require
'../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
65 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
68 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
78$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
81$action =
GETPOST(
'action',
'aZ09');
82$mode =
GETPOST(
'mode',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
85$cancel =
GETPOST(
'cancel',
'alpha');
86$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'usercard';
87$backtopage =
GETPOST(
'backtopage');
88$backtopageforcancel =
GETPOST(
'backtopageforcancel');
90if (empty($id) && $action !=
'add' && $action !=
'create') {
100$childids = $user->getAllChildIds(1);
106$extrafields->fetch_name_optionals_label(
$object->table_element);
111$hookmanager->initHooks(array(
'usercard',
'globalcard'));
118 $res =
$object->fetch($id,
'',
'', 1);
123if ($user->socid > 0) {
124 $socid = $user->socid;
130$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
134$permissiontoreadgroup = $permissiontoread;
135$permissiontoeditgroup = $permissiontoedit;
137 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
138 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
141$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
142$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
143$permissiontocloneuser = $permissiontoadd;
146 $permissiontoclonesuperadmin =
false;
147 $permissiontocloneadmin =
false;
148 $permissiontocloneuser =
false;
151if ($user->id != $id && !$permissiontoread) {
155$caneditpasswordandsee =
false;
156$caneditpasswordandsend =
false;
159$permissiontoeditpasswordandsee =
false;
160$permissiontoeditpasswordandsend =
false;
163 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
164 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
165 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
168$passwordismodified =
false;
176$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
177$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
182if (empty($reshook)) {
183 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
185 if (empty($backtopage) || ($cancel && empty($id))) {
186 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
187 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
188 $backtopage = $backurlforlist;
190 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
196 if (!empty($backtopageforcancel)) {
197 header(
"Location: ".$backtopageforcancel);
199 } elseif (!empty($backtopage)) {
200 header(
"Location: ".$backtopage);
206 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
207 if ($id != $user->id) {
209 if (
$object->admin && empty($user->admin)) {
212 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
215 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
221 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
224 if ($id != $user->id) {
227 if (!empty($conf->file->main_limit_users)) {
228 $nb =
$object->getNbOfUsers(
"active");
229 if ($nb >= $conf->file->main_limit_users) {
231 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
237 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
243 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
244 if ($id != $user->id) {
245 if (!GETPOSTISSET(
'token')) {
246 print
'Error, token required for this critical operation';
254 $result =
$object->delete($user);
256 $langs->load(
"errors");
260 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
267 if ($action ==
'add' && $permissiontoadd) {
281 if (!empty($conf->file->main_limit_users)) {
282 $nb =
$object->getNbOfUsers(
"active");
283 if ($nb >= $conf->file->main_limit_users) {
285 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
295 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
310 $object->socialnetworks = array();
311 foreach ($socialnetworks as $key => $value) {
312 if (
GETPOST($key,
'alphanohtml')) {
318 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
325 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
327 $langs->load(
"errors");
328 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
331 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
351 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
353 $object->dateemployment = $dateemployment;
354 $object->dateemploymentend = $dateemploymentend;
355 $object->datestartvalidity = $datestartvalidity;
356 $object->dateendvalidity = $dateendvalidity;
364 $ret = $extrafields->setOptionalsFromPost(
null, $object);
378 $object->entity = ($entity ==
'' ? 1 : $entity);
382 $object->entity = ($entity ==
'' ? 1 : $entity);
393 if (
GETPOST(
'password',
'password')) {
394 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
396 if (is_int($resPass) && $resPass < 0) {
397 $langs->load(
"errors");
404 $usercats =
GETPOST(
'usercats',
'array:int');
405 $object->setCategories($usercats);
409 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
413 $langs->load(
"errors");
422 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
425 $editgroup->fetch($group);
426 $editgroup->oldcopy = clone $editgroup;
430 if ($action ==
'addgroup') {
431 $result =
$object->SetInGroup($group, $editgroup->entity);
433 if ($action ==
'removegroup') {
434 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
445 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
446 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
448 if ($permissiontoedit) {
451 if (!
GETPOST(
"lastname",
'alpha')) {
456 if (!
GETPOST(
"login",
'alpha')) {
473 if (GETPOSTISSET(
"ref_employee")) {
477 if (GETPOSTISSET(
"national_registration_number")) {
478 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
481 if ($permissiontoeditpasswordandsee) {
484 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
487 if (!empty($user->admin) && $user->id != $id) {
492 if ($user->admin && !
$object->ldap_sid) {
505 $object->socialnetworks = array();
506 foreach ($socialnetworks as $key => $value) {
507 if (
GETPOST($key,
'alphanohtml')) {
513 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
520 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
522 $langs->load(
"errors");
523 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
526 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
544 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
545 $object->dateemployment = $dateemployment;
546 $object->dateemploymentend = $dateemploymentend;
547 $object->datestartvalidity = $datestartvalidity;
548 $object->dateendvalidity = $dateendvalidity;
558 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
572 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
580 if (!empty($_FILES[
'photo'][
'name'])) {
584 if (
$object->id == $user->id) {
589 $langs->load(
"errors");
591 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
596 $passwordismodified = 0;
599 $passwordismodified = 1;
606 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
607 $langs->load(
"errors");
608 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
616 if (!$error && GETPOSTISSET(
'contactid')) {
620 if ($contactid > 0) {
622 $contact->fetch($contactid);
624 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
625 $sql .=
" SET fk_socpeople=".((int) $contactid);
626 if (!empty($contact->socid)) {
627 $sql .=
", fk_soc=".((int) $contact->socid);
628 } elseif ($socid > 0) {
629 $sql .=
", fk_soc = null";
630 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
632 $sql .=
" WHERE rowid = ".((int)
$object->id);
633 } elseif ($socid > 0) {
634 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
635 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
636 $sql .=
" WHERE rowid = ".((int)
$object->id);
638 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
639 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
640 $sql .=
" WHERE rowid = ".((int)
$object->id);
643 $resql = $db->query($sql);
650 if (!$error && !count(
$object->errors)) {
652 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
655 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
659 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
660 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
667 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
669 if (!($result > 0)) {
677 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
686 $langs->load(
"errors");
687 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
692 if (!$error && !count(
$object->errors)) {
694 $categories =
GETPOST(
'usercats',
'array:int');
695 $object->setCategories($categories);
698 if (!$error && !count(
$object->errors)) {
702 $login = $_SESSION[
"dol_login"];
705 $langs->load(
"errors");
706 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
708 if ($passwordismodified &&
$object->login == $user->login) {
710 $langs->load(
"errors");
711 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
712 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
720 if ($permissiontoeditpasswordandsee) {
721 dol_syslog(
"Not allowed to change fields, only password");
725 if (
GETPOST(
"password",
"password")) {
728 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
729 if (is_int($ret) && $ret < 0) {
738 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
739 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
743 $newpassword =
$object->setPassword($user,
'');
744 if (is_int($newpassword) && $newpassword < 0) {
746 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
749 if ($action ==
'confirm_passwordsend') {
750 if (
$object->send_password($user, $newpassword) > 0) {
756 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
762 if ($action ==
'adduserldap' && $permissiontoadd) {
763 $selecteduser =
GETPOST(
'users');
765 $required_fields = array(
782 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
783 foreach ($arrayofsocialnetworks as $socialnetwork) {
789 $result = $ldap->connectBind();
792 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
797 if (is_array($ldapusers)) {
798 foreach ($ldapusers as $key => $attribute) {
810 $ldap_social = array();
813 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
814 foreach ($arrayofsocialnetworks as $socialnetwork) {
815 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
825 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
828 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
832 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
840 $clone->api_key =
'';
842 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
843 $clone->firstname = $parts[0];
844 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
846 $clone->login = substr($parts[0], 0, 1).$parts[1];
849 $clone->context[
'createfromclone'] =
'createfromclone';
850 $id = $clone->create($user);
851 $refalreadyexists = 0;
854 $result = $clone->cloneRights(
$object->id, $id);
857 if (
GETPOST(
'clone_categories')) {
858 $result = $clone->cloneCategories(
$object->id, $id);
866 if ($clone->error ==
'ErrorProductAlreadyExists') {
870 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
871 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
874 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
878 unset($clone->context[
'createfromclone']);
885 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
896 $triggersendname =
'USER_SENTBYMAIL';
898 $mode =
'emailfromuser';
899 $trackid =
'use'.$id;
900 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
903 $upload_dir = $conf->user->dir_output;
904 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
907 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
915$form =
new Form($db);
927$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
928$resql = $db->query($sql);
930 $obj = $db->fetch_object($resql);
932 $nbofusers = $obj->nb;
940 $title = $person_name.
" - ".$langs->trans(
'Card');
943 $title = $langs->trans(
"NewEmployee");
945 $title = $langs->trans(
"NewUser");
951llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
953if ($action ==
'create' || $action ==
'adduserldap') {
956 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
965 $result = $ldap->connectBind();
967 $required_fields = array(
987 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
992 if (is_array($ldapusers)) {
993 foreach ($ldapusers as $key => $ldapuser) {
996 foreach ($required_fields as $value) {
998 $label .= $value.
"=******* ";
1000 $label .= $value.
"=".$ldapuser[$value].
" ";
1003 $liste[$key] = $label;
1013 print
"\n\n<!-- Form liste LDAP debut -->\n";
1015 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1016 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1017 print
'<table class="border centpercent"><tr>';
1018 print
'<td width="160">';
1019 print $langs->trans(
"LDAPUsers");
1022 print
'<input type="hidden" name="action" value="adduserldap">';
1023 if (is_array($liste) && count($liste)) {
1024 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1027 print
'</td><td class="center">';
1028 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1029 print
'</td></tr></table>';
1032 print
"\n<!-- Form liste LDAP fin -->\n\n";
1037 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1038 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1039 print
'<input type="hidden" name="action" value="add">';
1040 if (!empty($ldap_sid)) {
1041 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1043 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1049 print
'<table class="border centpercent">';
1053 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1054 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1060 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1062 if (!empty($ldap_lastname)) {
1063 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1064 print $ldap_lastname;
1066 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1071 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1073 if (!empty($ldap_firstname)) {
1074 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1075 print $ldap_firstname;
1077 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1082 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1084 if (!empty($ldap_login)) {
1085 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1087 } elseif (!empty($ldap_loginsmb)) {
1088 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1089 print $ldap_loginsmb;
1091 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1095 if (!empty($conf->use_javascript_ajax)) {
1099 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1100 if ($charforseparator ==
'none') {
1101 $charforseparator =
'';
1104 jQuery(document).ready(function() {
1105 $(".createloginauto").on("keyup", function() {
1106 console.log(".createloginauto change: We generate login when we have a lastname");
1108 lastname = $("#lastname").val().toLowerCase();
1111 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1113 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1119 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1121 login += lastname.replace(/\s+/g, \
'\').trim();
1123 $(
"#login").val(login);
1129 $generated_password = '';
1130 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1131 $generated_password = getRandomPassword(false);
1133 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1136 if (!empty($user->admin)) {
1137 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1139 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1141 if (isModEnabled('multicompany
') && !$user->entity) {
1142 if (!empty($conf->use_javascript_ajax)) {
1143 print '<script
type=
"text/javascript">
1145 $(
"select[name=admin]").change(
function() {
1146 if ( $(
this).val() == 0 ) {
1147 $(
"input[name=superadmin]")
1148 .prop(
"disabled",
true)
1149 .prop(
"checked",
false);
1150 $(
"select[name=entity]")
1151 .prop(
"disabled",
false);
1153 $(
"input[name=superadmin]")
1154 .prop(
"disabled",
false);
1157 $(
"input[name=superadmin]").change(
function() {
1158 if ( $(
this).is(
":checked") ) {
1159 $(
"select[name=entity]")
1160 .prop(
"disabled",
true);
1162 $(
"select[name=entity]")
1163 .prop(
"disabled",
false);
1169 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1170 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1171 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1173 print "</td></tr>\n";
1177 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1179 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1180 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1184 $defaultemployee = '1
';
1186 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1187 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1188 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1192 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1194 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user, 'fk_user
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1198 // Expense report validator
1199 if (isModEnabled('expensereport
')) {
1200 print '<tr><td
class=
"titlefieldcreate">
';
1201 $text = $langs->trans("ForceUserExpenseValidator");
1202 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1205 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1210 // Holiday request validator
1211 if (isModEnabled('holiday
')) {
1212 print '<tr><td
class=
"titlefieldcreate">
';
1213 $text = $langs->trans("ForceUserHolidayValidator");
1214 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1217 print img_picto('', 'user', 'class=
"pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator
', 1, array($object->id), 0, '', '', (string) $conf->entity, 0, 0, '', 0, '', 'maxwidth300 widthcentpercentminusx
');
1223 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1225 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1229 print '</
table><hr><
table class=
"border centpercent">
';
1233 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1235 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1239 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1244 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1247 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1248 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1250 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1251 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1253 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1254 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1255 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1256 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1259 $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" spellcheck="false">';
1260 if (!empty($conf->use_javascript_ajax)) {
1261 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1267 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1268 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1270 $valuetoshow = $hookmanager->resPrint;
1272 $valuetoshow .= $hookmanager->resPrint;
1282 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1284 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" spellcheck="false">';
1285 if (!empty($conf->use_javascript_ajax)) {
1286 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1292 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1296 print
'</table><hr><table class="border centpercent">';
1300 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1301 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1303 print
'</textarea></td></tr>';
1306 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1307 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1311 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1312 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1316 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1317 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1318 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1320 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1326 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1327 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1328 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1333 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1335 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1336 if (!empty($ldap_phone)) {
1337 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1340 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1345 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1347 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1348 if (!empty($ldap_mobile)) {
1349 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1352 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'" spellcheck="false">';
1357 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1359 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1360 if (!empty($ldap_fax)) {
1361 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1364 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1369 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1371 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1372 if (!empty($ldap_mail)) {
1373 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1376 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1382 foreach ($socialnetworks as $key => $value) {
1383 if ($value[
'active']) {
1384 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1386 if (!empty($value[
'icon'])) {
1387 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1389 if (!empty($ldap_social[$key])) {
1390 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1391 print $ldap_social[$key];
1393 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1398 if (!empty($ldap_social[$key])) {
1399 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1401 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1409 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1411 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1417 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1419 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1424 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1425 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1426 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1432 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1433 print
'<td class="maxwidthonsmartphone">'.
"\n";
1434 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
GETPOST(
'default_lang',
'alpha') ?
GETPOST(
'default_lang',
'alpha') : (
$object->lang ?
$object->lang :
''),
'default_lang', 0, array(), 1, 0, 0,
'maxwidth300 widthcentpercentminusx');
1442 if (!method_exists($mc,
'formObjectOptions')) {
1443 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1444 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1445 print
"<td>".$mc->select_entities($conf->entity);
1446 print
"</td></tr>\n";
1448 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1454 $parameters = array();
1455 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1458 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1459 print
'<td class="wordbreak">';
1460 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1462 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1463 print $doleditor->Create(1);
1467 print
'<tr><td class="tdtop">';
1468 print $langs->trans(
"NotePublic");
1470 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1471 $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%');
1472 $doleditor->Create();
1473 print
"</td></tr>\n";
1476 print
'<tr><td class="tdtop">';
1477 print $langs->trans(
"NotePrivate");
1479 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1480 $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%');
1481 $doleditor->Create();
1482 print
"</td></tr>\n";
1484 print
'</table><hr><table class="border centpercent">';
1491 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1492 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1497 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1499 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1502 if ((
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1503 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1504 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1505 $langs->load(
"salaries");
1509 $text = $langs->trans(
"THM");
1510 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1513 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1519 $text = $langs->trans(
"TJM");
1520 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1523 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1528 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1530 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1536 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1538 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1543 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1545 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1549 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1554 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1556 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1564 print $form->buttonsSaveCancel(
"CreateUser");
1570 $res =
$object->fetch($id,
'',
'', 1);
1575 $res =
$object->fetch_optionals();
1585 $passDoNotExpire = 0;
1587 $userChangePassNextLogon = 0;
1593 $result = $ldap->connectBind();
1595 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1596 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1602 if (count($ldap->uacf) > 0) {
1603 foreach ($ldap->uacf as $key => $statut) {
1604 if ($key == 65536) {
1605 $passDoNotExpire = 1;
1606 $statutUACF = $statut;
1611 $statutUACF =
"ACCOUNTDISABLE";
1614 if ($ldap->pwdlastset == 0) {
1615 $userChangePassNextLogon = 1;
1621 if ($mode ==
'employee') {
1622 $title = $langs->trans(
"Employee");
1623 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1625 $title = $langs->trans(
"User");
1628 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1629 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1636 if ($action ==
'password') {
1637 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1641 if ($action ==
'passwordsend') {
1642 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1646 if ($action ==
'disable') {
1647 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1651 if ($action ==
'enable') {
1652 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1656 if ($action ==
'delete') {
1657 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1661 if (($action ==
'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile)))
1662 || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
1664 $formquestionclone = array(
1665 'text' => $langs->trans(
"ConfirmClone"),
1666 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1667 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1668 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1671 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1672 array_splice($formquestionclone, 2, 0, array($newElement));
1674 print $form->formconfirm($_SERVER[
"PHP_SELF"].
'?id='.
$object->id, $langs->trans(
'ToClone'), $langs->trans(
'ConfirmUserClone',
$object->firstname.
' '.
$object->lastname),
'confirm_clone', $formquestionclone,
'yes',
'action-clone', 350, 600);
1679 if ($action !=
'edit') {
1680 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1682 $morehtmlref =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/vcard.php', [
'id' =>
$object->id,
'output' =>
'file',
'file' =>
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')]).
'" class="refid valignmiddle" rel="noopener">';
1683 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1684 $morehtmlref .=
'</a>';
1686 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1687 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1689 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1691 print
'<div class="fichecenter">';
1692 print
'<div class="fichehalfleft">';
1694 print
'<div class="underbanner clearboth"></div>';
1695 print
'<table class="border tableforfield centpercent">';
1698 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1699 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1700 print
'<td class="error">';
1701 print $langs->trans(
"LoginAccountDisableInDolibarr");
1707 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1708 } elseif (!empty(
$object->admin)) {
1709 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1718 $text = $langs->trans(
"Type");
1719 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1721 $type = $langs->trans(
"Internal");
1723 $type = $langs->trans(
"External");
1725 print
'<span class="badgeneutral">';
1728 print
' ('.$langs->trans(
"DomainUser").
')';
1731 print
'</td></tr>'.
"\n";
1734 if (
$object->ldap_sid && is_object($ldap)) {
1735 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1736 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1737 print
'</td></tr>'.
"\n";
1741 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1743 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1747 print
'</td></tr>'.
"\n";
1750 if ($nbofusers > 1) {
1752 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1754 if (empty(
$object->fk_user)) {
1755 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1757 $huser =
new User($db);
1759 $huser->fetch(
$object->fk_user);
1760 print $huser->getNomUrl(-1);
1762 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1771 $text = $langs->trans(
"ForceUserExpenseValidator");
1772 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1775 if (!empty(
$object->fk_user_expense_validator)) {
1776 $evuser =
new User($db);
1777 $evuser->fetch(
$object->fk_user_expense_validator);
1778 print $evuser->getNomUrl(-1);
1787 $text = $langs->trans(
"ForceUserHolidayValidator");
1788 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1791 if (!empty(
$object->fk_user_holiday_validator)) {
1792 $hvuser =
new User($db);
1793 $hvuser->fetch(
$object->fk_user_holiday_validator);
1794 print $hvuser->getNomUrl(-1);
1802 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1803 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1807 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1814 if ((empty($user->socid) && in_array($id, $childids))
1815 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1816 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1817 $langs->load(
"salaries");
1820 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1822 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1828 $text = $langs->trans(
"THM");
1829 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1832 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency).
'</span>' :
'');
1838 $text = $langs->trans(
"TJM");
1839 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1842 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency).
'</span>' :
'');
1848 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1850 if (
$object->dateemployment) {
1851 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1854 if (
$object->dateemploymentend) {
1855 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1862 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1870 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1871 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1872 if (
$object->fk_warehouse > 0) {
1873 $warehousestatic =
new Entrepot($db);
1874 $warehousestatic->fetch(
$object->fk_warehouse);
1875 print $warehousestatic->getNomUrl(1);
1883 print
'<div class="fichehalfright">';
1885 print
'<div class="underbanner clearboth"></div>';
1887 print
'<table class="border tableforfield centpercent">';
1891 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1893 print $formother->showColor(
$object->color,
'');
1899 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1900 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1902 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1908 $langs->load(
"languages");
1909 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1911 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1915 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1921 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1922 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1923 print
'<td>'.$object->openid.
'</td>';
1930 if (!method_exists($mc,
'formObjectOptions')) {
1931 if (
isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1932 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1934 print $langs->trans(
"AllEntities");
1936 $mc->getInfo(
$object->entity);
1939 print
"</td></tr>\n";
1945 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1949 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1954 $societe->fetch(
$object->socid);
1955 if ($societe->id > 0) {
1956 $s .= $societe->getNomUrl(1,
'');
1959 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1961 if (!empty(
$object->contact_id)) {
1963 $contact->fetch(
$object->contact_id);
1964 if ($contact->id > 0) {
1965 if (
$object->socid > 0 && $s) {
1970 $s .= $contact->getNomUrl(1,
'');
1980 $langs->load(
"members");
1981 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1985 $adh->fetch(
$object->fk_member);
1986 $adh->ref = $adh->getFullname($langs);
1987 print $adh->getNomUrl(-1);
1989 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1996 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1998 print
"</td></tr>\n";
2009 print
'<!-- credential section -->'.
"\n";
2010 print
'<div class="div-table-responsive-no-min">';
2011 print
'<table class="noborder tableforfield centpercent">';
2014 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2015 print
'<div class="centpercent display-flex">';
2016 print
'<div class="left inline-block">';
2017 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2024 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2026 if (
$object->datestartvalidity) {
2027 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2030 if (
$object->dateendvalidity) {
2031 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2039 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2040 if (!empty(
$object->ldap_sid)) {
2041 if ($passDoNotExpire) {
2042 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2043 } elseif ($userChangePassNextLogon) {
2044 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2045 } elseif ($userDisabled) {
2046 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2048 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2051 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2054 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2055 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2059 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2060 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2062 $valuetoshow = $hookmanager->resPrint;
2064 $valuetoshow .= $hookmanager->resPrint;
2068 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2069 print
'<td class="wordbreak">';
2076 if (
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') && $permissiontoeditpasswordandsee) {
2077 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2079 print
'<div class="centpercent display-flex">';
2080 print
'<span class="badge badge-info">999</span>';
2081 print
'<div class="left inline-block">';
2082 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2084 print
'</span></span>';
2089 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2090 foreach ($tmparrayofauthmode as $tmpauthmode) {
2091 $langs->load(
"oauth");
2093 $tmpauthmode = trim($tmpauthmode);
2094 if (preg_match(
'/oauth/', $tmpauthmode)) {
2095 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2096 print
'<tr class="nooddeven">';
2097 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2098 print
' '.ucfirst($nameofservice).
' ';
2101 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2102 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2110 if (!empty(
$object->email_oauth2)) {
2111 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2121 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2122 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2125 print
'<div class="centpercent display-flex">';
2126 print
'<span class="badge badge-info">999</span>';
2130 print
'<div class="left inline-block">';
2131 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2136 if (!empty(
$object->api_key)) {
2137 print
'<span class="opacitymedium">';
2142 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">';
2152 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2154 if (
$object->datepreviouslogin) {
2155 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2158 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2168 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2169 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2171 print $hookmanager->resPrint;
2177 print
'<div class="clearboth"></div>';
2186 print
'<div class="tabsAction">';
2188 $parameters = array();
2189 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2190 if (empty($reshook)) {
2194 'class' =>
'classfortooltip'
2198 if (empty($user->socid)) {
2199 $canSendMail =
false;
2201 $langs->load(
"mails");
2202 $canSendMail =
true;
2203 unset($params[
'attr'][
'title']);
2205 $langs->load(
"mails");
2206 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2208 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2213 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2216 unset($params[
'attr'][
'title']);
2219 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2221 unset($params[
'attr'][
'title']);
2229 'class' =>
'classfortooltip'
2234 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2235 $cloneButtonId =
'';
2238 if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
2240 $cloneButtonId =
'action-clone';
2242 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2246 if (
$object->status == $object::STATUS_DISABLED) {
2247 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2249 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2251 unset($params[
'attr'][
'title']);
2252 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2255 if (
$object->status == $object::STATUS_DISABLED) {
2256 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2257 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2258 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2261 unset($params[
'attr'][
'title']);
2262 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2264 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2265 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2270 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2272 unset($params[
'attr'][
'title']);
2273 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2276 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2278 unset($params[
'attr'][
'title']);
2279 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2281 if ($user->id == $id) {
2282 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2283 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2287 if ($user->id != $id && $permissiontodisable &&
2289 if ($user->admin || !
$object->admin) {
2290 unset($params[
'attr'][
'title']);
2291 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2293 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2294 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2304 if (
GETPOST(
'modelselected')) {
2305 $action =
'presend';
2309 $modelmail =
'user';
2310 $defaulttopic =
'Information';
2311 $diroutput = $conf->user->dir_output;
2312 $trackid =
'use'.$object->id;
2314 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2316 if ($action !=
'presend' && $action !=
'send') {
2321 if ($permissiontoreadgroup) {
2322 print
'<!-- Group section -->'.
"\n";
2330 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2332 if (!empty($groupslist)) {
2333 foreach ($groupslist as $groupforuser) {
2334 $exclude[] = $groupforuser->id;
2339 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2340 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2341 print $hookmanager->resPrint;
2343 if (empty($reshook)) {
2344 if ($permissiontoeditgroup) {
2345 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2346 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2347 print
'<input type="hidden" name="action" value="addgroup" />';
2348 print
'<input type="hidden" name="page_y" value="" />';
2351 print
'<!-- List of groups of the user -->'.
"\n";
2352 print
'<table class="noborder centpercent">'.
"\n";
2353 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2354 print
'<th class="liste_titre right">';
2355 if ($permissiontoeditgroup) {
2356 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2358 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2359 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2361 print
'</th></tr>'.
"\n";
2364 if (!empty($groupslist)) {
2365 foreach ($groupslist as $group) {
2366 print
'<tr class="oddeven">';
2367 print
'<td class="tdoverflowmax200">';
2368 if ($permissiontoeditgroup) {
2369 print $group->getNomUrl(1);
2371 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2374 print
'<td class="right">';
2375 if ($permissiontoeditgroup) {
2376 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2377 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2382 print
"</td></tr>\n";
2385 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2390 if ($permissiontoeditgroup) {
2402 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2403 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2404 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2405 print
'<input type="hidden" name="action" value="update">';
2406 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2410 print
'<table class="border centpercent">';
2414 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2423 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2425 if ($permissiontoedit && !
$object->ldap_sid) {
2426 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2428 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2435 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2437 if ($permissiontoedit && !
$object->ldap_sid) {
2438 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2440 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2446 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2448 if ($user->admin && !
$object->ldap_sid) {
2449 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2451 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2458 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2460 if ($user->id ==
$object->id || !$user->admin) {
2462 $type = $langs->trans(
"Internal");
2464 $type = $langs->trans(
"External");
2467 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2469 print
' ('.$langs->trans(
"DomainUser").
')';
2478 $eventsCompanyContact = array();
2479 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2481 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2482 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2483 print
'<span class="clearbothonsmartphone"></span>';
2484 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2485 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2487 print
' ('.$langs->trans(
"DomainUser").
')';
2490 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2491 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2492 print
'<span class="clearbothonsmartphone"></span>';
2493 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2494 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2496 print
' ('.$langs->trans(
"DomainUser").
')';
2499 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2500 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2501 print
'<span class="clearbothonsmartphone"></span>';
2502 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2503 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2505 print
' ('.$langs->trans(
"DomainUser").
')';
2508 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2509 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2510 print
'<span class="clearbothonsmartphone"></span>';
2511 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2512 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2518 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2520 $langs->load(
"admin");
2522 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2523 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2527 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2528 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2535 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2538 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2541 if ($conf->use_javascript_ajax) {
2542 print
'<script type="text/javascript">
2544 var admin = $("select[name=admin]").val();
2546 $("input[name=superadmin]")
2547 .prop("disabled", true)
2548 .prop("checked", false);
2550 if ($("input[name=superadmin]").is(":checked")) {
2551 $("select[name=entity]")
2552 .prop("disabled", true);
2554 $("select[name=admin]").change(function() {
2555 if ( $(this).val() == 0 ) {
2556 $("input[name=superadmin]")
2557 .prop("disabled", true)
2558 .prop("checked", false);
2559 $("select[name=entity]")
2560 .prop("disabled", false);
2562 $("input[name=superadmin]")
2563 .prop("disabled", false);
2566 $("input[name=superadmin]").change(function() {
2567 if ( $(this).is(":checked")) {
2568 $("select[name=entity]")
2569 .prop("disabled", true);
2571 $("select[name=entity]")
2572 .prop("disabled", false);
2579 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2580 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2584 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2585 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2587 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2597 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2598 if ($permissiontoedit && !
$object->ldap_sid) {
2599 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2600 } elseif (
$object->civility_code) {
2601 print $langs->trans(
"Civility".
$object->civility_code);
2607 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2609 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2610 if ($permissiontoedit) {
2611 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2613 print $arraygender[
$object->gender];
2619 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2620 if ($permissiontoedit) {
2621 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2624 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2633 if ($nbofusers > 1) {
2635 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2637 if ($permissiontoedit) {
2638 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(GETPOSTISSET(
'fk_user') ?
GETPOSTINT(
'fk_user') :
$object->fk_user,
'fk_user', 1, array(
$object->id), 0,
'',
'', (string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2640 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2641 $huser =
new User($db);
2642 $huser->fetch(
$object->fk_user);
2643 print $huser->getNomUrl(-1);
2650 print
'<tr><td class="titlefieldcreate">';
2651 $text = $langs->trans(
"ForceUserExpenseValidator");
2652 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2655 if ($permissiontoedit) {
2656 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array(
$object->id), 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2658 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2659 $evuser =
new User($db);
2660 $evuser->fetch(
$object->fk_user_expense_validator);
2661 print $evuser->getNomUrl(-1);
2669 print
'<tr><td class="titlefieldcreate">';
2670 $text = $langs->trans(
"ForceUserHolidayValidator");
2671 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2674 if ($permissiontoedit) {
2675 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers(
$object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array(
$object->id), 0,
'',
'', (
string)
$object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2677 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2678 $hvuser =
new User($db);
2679 $hvuser->fetch(
$object->fk_user_holiday_validator);
2680 print $hvuser->getNomUrl(-1);
2691 print
'<table class="border centpercent">';
2694 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2696 if ($permissiontoedit) {
2697 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2703 if ($permissiontoedit) {
2704 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2712 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2715 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2716 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2718 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2719 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2721 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2722 if ($permissiontoeditpasswordandsee) {
2723 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="minwidth300 maxwidth400 widthcentpercentminusx" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password" spellcheck="false">';
2724 if (!empty($conf->use_javascript_ajax)) {
2725 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->transnoentities(
'NoPasswordGenerationRuleConfigured') : $langs->transnoentities(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2728 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2732 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2733 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2735 $valuetoshow = $hookmanager->resPrint;
2737 $valuetoshow .= $hookmanager->resPrint;
2741 print
"</td></tr>\n";
2746 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2748 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2749 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off" spellcheck="false">';
2750 if (!empty($conf->use_javascript_ajax)) {
2751 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2759 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2760 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2762 if ($permissiontoedit) {
2763 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2765 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2771 print
'</table><hr><table class="border centpercent">';
2775 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2777 if ($permissiontoedit) {
2778 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2781 if ($permissiontoedit) {
2782 print
'</textarea>';
2787 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2788 if ($permissiontoedit) {
2789 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2796 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2797 if ($permissiontoedit) {
2798 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2805 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2806 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2807 if ($permissiontoedit) {
2808 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2810 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2814 print $countrylabel;
2820 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2821 if ($permissiontoedit) {
2822 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2823 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2831 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2833 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2834 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2835 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2837 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2843 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2845 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2846 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2847 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'" spellcheck="false">';
2849 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2855 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2857 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2858 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2859 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2861 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2867 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2869 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2870 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2871 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2873 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2879 foreach ($socialnetworks as $key => $value) {
2880 if ($value[
'active']) {
2881 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2883 if (!empty($value[
'icon'])) {
2884 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2886 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2887 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2889 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2890 print
$object->socialnetworks[$key];
2895 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2900 print
'</table><hr><table class="border centpercent">';
2904 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2905 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2906 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>';
2913 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2915 if ($permissiontoedit) {
2916 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2918 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2919 print
$object->accountancy_code;
2927 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2929 if ($permissiontoedit) {
2930 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2932 print $formother->showColor(
$object->color,
'');
2939 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2941 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2946 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2947 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
2949 if ($permissiontoedit) {
2950 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
2952 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2959 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";
2960 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2966 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2968 print
$object->getLibStatut(4);
2996 $langs->load(
"members");
2997 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3001 $adh->fetch(
$object->fk_member);
3002 $adh->ref = $adh->login;
3003 print $adh->getNomUrl(1);
3005 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3015 if (!method_exists($mc,
'formObjectOptions')) {
3016 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
3017 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3018 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3019 print
"</td></tr>\n";
3021 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3027 $parameters = array(
'colspan' =>
' colspan="2"');
3029 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3030 print $hookmanager->resPrint;
3031 if (empty($reshook)) {
3032 if ($permissiontoedit) {
3033 print
$object->showOptionals($extrafields,
'edit');
3035 print
$object->showOptionals($extrafields,
'view');
3040 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3042 if ($permissiontoedit) {
3043 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3045 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3046 print $doleditor->Create(1);
3058 print
'<table class="border centpercent">';
3064 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3066 if ($permissiontoedit) {
3067 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3069 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3075 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3077 if ($permissiontoedit) {
3078 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3086 if ((empty($user->socid) && in_array($id, $childids))
3087 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
3088 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
3089 $langs->load(
"salaries");
3092 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3094 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3095 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3101 $text = $langs->trans(
"THM");
3102 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3105 if ($permissiontoedit) {
3106 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3107 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3109 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
3116 $text = $langs->trans(
"TJM");
3117 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3120 if ($permissiontoedit) {
3121 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3122 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3124 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
3131 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3133 if ($permissiontoedit) {
3134 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3139 if ($dateemployment && $dateemploymentend) {
3143 if ($permissiontoedit) {
3144 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3152 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3154 if ($permissiontoedit) {
3155 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3166 print
'<div class="center">';
3167 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3168 print
' ';
3169 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3175 if ($action !=
'edit' && $action !=
'presend') {
3176 print
'<div class="fichecenter"><div class="fichehalfleft">';
3181 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3182 $genallowed = $user->hasRight(
"user",
"user",
"read");
3183 $delallowed = $user->hasRight(
"user",
"user",
"write");
3188 $societe->fetch(
$object->socid);
3193 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed,
$object->model_pdf, 0, 0, 0, 28, 0,
'',
'',
'', !is_object($societe) || empty($societe->default_lang) ?
'' : $societe->default_lang);
3194 $somethingshown = $formfile->numoffiles;
3197 $tmparray = $form->showLinkToObjectBlock($object, array(), array(), 1);
3198 $linktoelem = $tmparray[
'linktoelem'];
3199 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3200 print $htmltoenteralink;
3202 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
3206 $morehtmlcenter =
'<div class="nowraponall">';
3207 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3208 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3209 $morehtmlcenter .=
'</div>';
3211 print
'</div><div class="fichehalfright">';
3214 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3216 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3218 print
'</div></div>';
3228include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
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...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_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'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$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.