40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
54if (isModEnabled(
'ldap')) {
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
57if (isModEnabled(
'member')) {
58 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
60if (isModEnabled(
'category')) {
61 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63if (isModEnabled(
'stock')) {
64 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
78$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
81$action =
GETPOST(
'action',
'aZ09');
82$mode =
GETPOST(
'mode',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
85$cancel =
GETPOST(
'cancel',
'alpha');
86$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
87$backtopage =
GETPOST(
'backtopage');
89if (empty($id) && $action !=
'add' && $action !=
'create') {
99$childids = $user->getAllChildIds(1);
105$extrafields->fetch_name_optionals_label(
$object->table_element);
110$hookmanager->initHooks(array(
'usercard',
'globalcard'));
117 $res =
$object->fetch($id,
'',
'', 1);
122if ($user->socid > 0) {
123 $socid = $user->socid;
129$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
130$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontoreadgroup = $permissiontoread;
134$permissiontoeditgroup = $permissiontoedit;
136 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
137 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
140$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
141$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
142$permissiontocloneuser = $permissiontoadd;
145 $permissiontoclonesuperadmin =
false;
146 $permissiontocloneadmin =
false;
147 $permissiontocloneuser =
false;
150if ($user->id != $id && !$permissiontoread) {
154$caneditpasswordandsee =
false;
155$caneditpasswordandsend =
false;
158$permissiontoeditpasswordandsee =
false;
159$permissiontoeditpasswordandsend =
false;
162 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
163 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
164 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
167$passwordismodified =
false;
175$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
176$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
181if (empty($reshook)) {
182 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
184 if (empty($backtopage) || ($cancel && empty($id))) {
185 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
186 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
187 $backtopage = $backurlforlist;
189 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
195 if (!empty($backtopageforcancel)) {
196 header(
"Location: ".$backtopageforcancel);
198 } elseif (!empty($backtopage)) {
199 header(
"Location: ".$backtopage);
205 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
206 if ($id != $user->id) {
208 if (
$object->admin && empty($user->admin)) {
211 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
214 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
220 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
223 if ($id != $user->id) {
226 if (!empty(
$conf->file->main_limit_users)) {
227 $nb =
$object->getNbOfUsers(
"active");
228 if ($nb >=
$conf->file->main_limit_users) {
230 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
236 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
242 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
243 if ($id != $user->id) {
244 if (!GETPOSTISSET(
'token')) {
245 print
'Error, token required for this critical operation';
253 $result =
$object->delete($user);
255 $langs->load(
"errors");
259 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
266 if ($action ==
'add' && $permissiontoadd) {
280 if (!empty(
$conf->file->main_limit_users)) {
281 $nb =
$object->getNbOfUsers(
"active");
282 if ($nb >=
$conf->file->main_limit_users) {
284 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
294 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
308 if (isModEnabled(
'socialnetworks')) {
309 $object->socialnetworks = array();
310 foreach ($socialnetworks as $key => $value) {
311 if (
GETPOST($key,
'alphanohtml')) {
317 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
320 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
335 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
336 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
340 $object->dateemployment = $dateemployment;
341 $object->dateemploymentend = $dateemploymentend;
342 $object->datestartvalidity = $datestartvalidity;
343 $object->dateendvalidity = $dateendvalidity;
351 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
358 if (isModEnabled(
'multicompany')) {
365 $object->entity = ($entity ==
'' ? 1 : $entity);
369 $object->entity = ($entity ==
'' ? 1 : $entity);
380 if (
GETPOST(
'password',
'password')) {
381 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
383 if (is_int($resPass) && $resPass < 0) {
384 $langs->load(
"errors");
389 if (isModEnabled(
"category")) {
391 $usercats =
GETPOST(
'usercats',
'array');
392 $object->setCategories($usercats);
396 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
400 $langs->load(
"errors");
409 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
412 $editgroup->fetch($group);
413 $editgroup->oldcopy = clone $editgroup;
417 if ($action ==
'addgroup') {
418 $result =
$object->SetInGroup($group, $editgroup->entity);
420 if ($action ==
'removegroup') {
421 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
432 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
433 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
435 if ($permissiontoedit) {
438 if (!
GETPOST(
"lastname",
'alpha')) {
443 if (!
GETPOST(
"login",
'alpha')) {
460 if (GETPOSTISSET(
"ref_employee")) {
464 if (GETPOSTISSET(
"national_registration_number")) {
465 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
468 if ($permissiontoeditpasswordandsee) {
471 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
474 if (!empty($user->admin) && $user->id !=
$id) {
479 if ($user->admin && !
$object->ldap_sid) {
491 if (isModEnabled(
'socialnetworks')) {
492 $object->socialnetworks = array();
493 foreach ($socialnetworks as $key => $value) {
494 if (
GETPOST($key,
'alphanohtml')) {
500 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
503 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
516 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
518 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
522 $object->dateemployment = $dateemployment;
523 $object->dateemploymentend = $dateemploymentend;
524 $object->datestartvalidity = $datestartvalidity;
525 $object->dateendvalidity = $dateendvalidity;
528 if (isModEnabled(
'stock')) {
535 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
549 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
557 if (!empty($_FILES[
'photo'][
'name'])) {
561 if (
$object->id == $user->id) {
566 $langs->load(
"errors");
568 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
573 $passwordismodified = 0;
576 $passwordismodified = 1;
583 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
584 $langs->load(
"errors");
585 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
593 if (!$error && GETPOSTISSET(
'contactid')) {
597 if ($contactid > 0) {
599 $contact->fetch($contactid);
601 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
602 $sql .=
" SET fk_socpeople=".((int) $contactid);
603 if (!empty($contact->socid)) {
604 $sql .=
", fk_soc=".((int) $contact->socid);
605 } elseif ($socid > 0) {
606 $sql .=
", fk_soc = null";
607 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
609 $sql .=
" WHERE rowid = ".((int)
$object->id);
610 } elseif ($socid > 0) {
611 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
612 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
613 $sql .=
" WHERE rowid = ".((int)
$object->id);
615 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
616 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
617 $sql .=
" WHERE rowid = ".((int)
$object->id);
620 $resql = $db->query($sql);
627 if (!$error && !count(
$object->errors)) {
636 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
644 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
646 if (!($result > 0)) {
654 $langs->load(
"errors");
655 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
660 if (!$error && !count(
$object->errors)) {
662 $categories =
GETPOST(
'usercats',
'array');
663 $object->setCategories($categories);
666 if (!$error && !count(
$object->errors)) {
670 $login = $_SESSION[
"dol_login"];
673 $langs->load(
"errors");
674 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
676 if ($passwordismodified &&
$object->login == $user->login) {
678 $langs->load(
"errors");
679 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
680 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
688 if ($permissiontoeditpasswordandsee) {
689 dol_syslog(
"Not allowed to change fields, only password");
693 if (
GETPOST(
"password",
"password")) {
696 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
697 if (is_int($ret) && $ret < 0) {
706 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
707 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
711 $newpassword =
$object->setPassword($user,
'');
712 if (is_int($newpassword) && $newpassword < 0) {
714 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
717 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
718 if (
$object->send_password($user, $newpassword) > 0) {
724 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
730 if ($action ==
'adduserldap' && $permissiontoadd) {
731 $selecteduser =
GETPOST(
'users');
733 $required_fields = array(
749 if (isModEnabled(
'socialnetworks')) {
750 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
751 foreach ($arrayofsocialnetworks as $socialnetwork) {
757 $result = $ldap->connectBind();
760 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
765 if (is_array($ldapusers)) {
766 foreach ($ldapusers as $key => $attribute) {
778 $ldap_social = array();
780 if (isModEnabled(
'socialnetworks')) {
781 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
782 foreach ($arrayofsocialnetworks as $socialnetwork) {
783 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
793 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
796 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
800 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
808 $clone->api_key =
'';
810 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
811 $clone->firstname = $parts[0];
812 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
814 $clone->login = substr($parts[0], 0, 1).$parts[1];
817 $clone->context[
'createfromclone'] =
'createfromclone';
818 $id = $clone->create($user);
819 $refalreadyexists = 0;
822 $result = $clone->cloneRights(
$object->id, $id);
825 if (
GETPOST(
'clone_categories')) {
826 $result = $clone->cloneCategories(
$object->id, $id);
834 if ($clone->error ==
'ErrorProductAlreadyExists') {
838 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
839 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
842 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
846 unset($clone->context[
'createfromclone']);
853 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
864 $triggersendname =
'USER_SENTBYMAIL';
866 $mode =
'emailfromuser';
867 $trackid =
'use'.$id;
868 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
871 $upload_dir =
$conf->user->dir_output;
872 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
880$form =
new Form($db);
886if (isModEnabled(
'stock')) {
892$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
893$resql = $db->query($sql);
895 $obj = $db->fetch_object($resql);
897 $nbofusers = $obj->nb;
905 $title = $person_name.
" - ".$langs->trans(
'Card');
908 $title = $langs->trans(
"NewEmployee");
910 $title = $langs->trans(
"NewUser");
916llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
918if ($action ==
'create' || $action ==
'adduserldap') {
921 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
925 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
930 $result = $ldap->connectBind();
932 $required_fields = array(
952 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
957 if (is_array($ldapusers)) {
958 foreach ($ldapusers as $key => $ldapuser) {
961 foreach ($required_fields as $value) {
963 $label .= $value.
"=******* ";
965 $label .= $value.
"=".$ldapuser[$value].
" ";
968 $liste[$key] = $label;
978 print
"\n\n<!-- Form liste LDAP debut -->\n";
980 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
981 print
'<input type="hidden" name="token" value="'.newToken().
'">';
982 print
'<table class="border centpercent"><tr>';
983 print
'<td width="160">';
984 print $langs->trans(
"LDAPUsers");
987 print
'<input type="hidden" name="action" value="adduserldap">';
988 if (is_array($liste) && count($liste)) {
989 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
992 print
'</td><td class="center">';
993 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
994 print
'</td></tr></table>';
997 print
"\n<!-- Form liste LDAP fin -->\n\n";
1002 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1003 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1004 print
'<input type="hidden" name="action" value="add">';
1005 if (!empty($ldap_sid)) {
1006 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1008 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1014 print
'<table class="border centpercent">';
1017 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1018 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1023 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1025 if (!empty($ldap_lastname)) {
1026 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1027 print $ldap_lastname;
1029 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1034 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1036 if (!empty($ldap_firstname)) {
1037 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1038 print $ldap_firstname;
1040 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1045 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1047 if (!empty($ldap_login)) {
1048 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1050 } elseif (!empty($ldap_loginsmb)) {
1051 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1052 print $ldap_loginsmb;
1054 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1058 if (!empty(
$conf->use_javascript_ajax)) {
1062 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1063 if ($charforseparator ==
'none') {
1064 $charforseparator =
'';
1067 jQuery(document).ready(function() {
1068 $(".createloginauto").on("keyup", function() {
1069 console.log(".createloginauto change: We generate login when we have a lastname");
1071 lastname = $("#lastname").val().toLowerCase();
1074 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1076 print
' firstname = $("#firstname").val().toLowerCase();';
1082 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1086 $(
"#login").val(login);
1092 $generated_password = '';
1093 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1094 $generated_password = getRandomPassword(false);
1096 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1099 if (!empty($user->admin)) {
1100 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1102 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1104 if (isModEnabled('multicompany
') && !$user->entity) {
1105 if (!empty($conf->use_javascript_ajax)) {
1106 print '<script
type=
"text/javascript">
1108 $(
"select[name=admin]").change(
function() {
1109 if ( $(
this).val() == 0 ) {
1110 $(
"input[name=superadmin]")
1111 .prop(
"disabled",
true)
1112 .prop(
"checked",
false);
1113 $(
"select[name=entity]")
1114 .prop(
"disabled",
false);
1116 $(
"input[name=superadmin]")
1117 .prop(
"disabled",
false);
1120 $(
"input[name=superadmin]").change(
function() {
1121 if ( $(
this).is(
":checked") ) {
1122 $(
"select[name=entity]")
1123 .prop(
"disabled",
true);
1125 $(
"select[name=entity]")
1126 .prop(
"disabled",
false);
1132 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1133 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1134 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1136 print "</td></tr>\n";
1140 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1142 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1143 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1147 $defaultemployee = '1
';
1149 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1150 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1151 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1155 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1157 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
');
1161 // Expense report validator
1162 if (isModEnabled('expensereport
')) {
1163 print '<tr><td
class=
"titlefieldcreate">
';
1164 $text = $langs->trans("ForceUserExpenseValidator");
1165 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1168 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
');
1173 // Holiday request validator
1174 if (isModEnabled('holiday
')) {
1175 print '<tr><td
class=
"titlefieldcreate">
';
1176 $text = $langs->trans("ForceUserHolidayValidator");
1177 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1180 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
');
1186 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1188 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1192 print '</
table><hr><
table class=
"border centpercent">
';
1196 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1198 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1202 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1207 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1210 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1211 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1213 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1214 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1216 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1217 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1218 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1219 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1222 $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">';
1223 if (!empty(
$conf->use_javascript_ajax)) {
1224 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1230 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1231 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1233 $valuetoshow = $hookmanager->resPrint;
1235 $valuetoshow .= $hookmanager->resPrint;
1241 if (isModEnabled(
'api')) {
1244 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1246 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">';
1247 if (!empty(
$conf->use_javascript_ajax)) {
1248 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1254 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1258 print
'</table><hr><table class="border centpercent">';
1262 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1263 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1265 print
'</textarea></td></tr>';
1268 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1269 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1273 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1274 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1278 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1279 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1280 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1282 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1288 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1289 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1290 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1295 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1297 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1298 if (!empty($ldap_phone)) {
1299 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1302 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1307 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1309 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1310 if (!empty($ldap_mobile)) {
1311 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1314 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1319 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1321 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1322 if (!empty($ldap_fax)) {
1323 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1326 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1331 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1333 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1334 if (!empty($ldap_mail)) {
1335 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1338 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1343 if (isModEnabled(
'socialnetworks')) {
1344 foreach ($socialnetworks as $key => $value) {
1345 if ($value[
'active']) {
1346 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1348 if (!empty($value[
'icon'])) {
1349 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1351 if (!empty($ldap_social[$key])) {
1352 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1353 print $ldap_social[$key];
1355 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1360 if (!empty($ldap_social[$key])) {
1361 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1363 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1370 if (isModEnabled(
'accounting')) {
1371 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1373 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1378 if (isModEnabled(
'agenda')) {
1379 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1381 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1386 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1387 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1388 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
1394 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1395 print
'<td class="maxwidthonsmartphone">'.
"\n";
1396 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');
1402 if (isModEnabled(
'multicompany') && is_object($mc)) {
1404 if (!method_exists($mc,
'formObjectOptions')) {
1405 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1406 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1407 print
"<td>".$mc->select_entities(
$conf->entity);
1408 print
"</td></tr>\n";
1410 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1416 $parameters = array();
1417 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1420 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1421 print
'<td class="wordbreak">';
1422 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1424 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1425 print $doleditor->Create(1);
1429 print
'<tr><td class="tdtop">';
1430 print $langs->trans(
"NotePublic");
1432 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1433 $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%');
1434 $doleditor->Create();
1435 print
"</td></tr>\n";
1438 print
'<tr><td class="tdtop">';
1439 print $langs->trans(
"NotePrivate");
1441 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1442 $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%');
1443 $doleditor->Create();
1444 print
"</td></tr>\n";
1446 print
'</table><hr><table class="border centpercent">';
1453 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1454 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1459 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1461 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1464 if ((isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1465 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1466 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1467 $langs->load(
"salaries");
1471 $text = $langs->trans(
"THM");
1472 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1475 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1481 $text = $langs->trans(
"TJM");
1482 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1485 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1490 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1492 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1498 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1500 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1505 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1507 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1511 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1516 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1518 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1526 print $form->buttonsSaveCancel(
"CreateUser");
1532 $res =
$object->fetch($id,
'',
'', 1);
1537 $res =
$object->fetch_optionals();
1547 $passDoNotExpire = 0;
1549 $userChangePassNextLogon = 0;
1553 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1555 $result = $ldap->connectBind();
1557 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1558 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1564 if (count($ldap->uacf) > 0) {
1565 foreach ($ldap->uacf as $key => $statut) {
1566 if ($key == 65536) {
1567 $passDoNotExpire = 1;
1568 $statutUACF = $statut;
1573 $statutUACF =
"ACCOUNTDISABLE";
1576 if ($ldap->pwdlastset == 0) {
1577 $userChangePassNextLogon = 1;
1583 if ($mode ==
'employee') {
1584 $title = $langs->trans(
"Employee");
1585 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1587 $title = $langs->trans(
"User");
1590 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1591 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1598 if ($action ==
'password') {
1599 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1603 if ($action ==
'passwordsend') {
1604 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1608 if ($action ==
'disable') {
1609 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1613 if ($action ==
'enable') {
1614 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1618 if ($action ==
'delete') {
1619 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1623 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1624 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1626 $formquestionclone = array(
1627 'text' => $langs->trans(
"ConfirmClone"),
1628 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1629 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1630 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1633 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1634 array_splice($formquestionclone, 2, 0, array($newElement));
1636 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);
1641 if ($action !=
'edit') {
1642 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1644 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid valignmiddle" rel="noopener">';
1645 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1646 $morehtmlref .=
'</a>';
1648 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1649 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1651 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1653 print
'<div class="fichecenter">';
1654 print
'<div class="fichehalfleft">';
1656 print
'<div class="underbanner clearboth"></div>';
1657 print
'<table class="border tableforfield centpercent">';
1660 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1662 print
'<td class="error">';
1663 print $langs->trans(
"LoginAccountDisableInDolibarr");
1668 if (property_exists(
$object,
'admin')) {
1669 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1670 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft valignmiddle"');
1671 } elseif (!empty(
$object->admin)) {
1672 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft valignmiddle"');
1682 $text = $langs->trans(
"Type");
1683 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1685 $type = $langs->trans(
"Internal");
1687 $type = $langs->trans(
"External");
1689 print
'<span class="badgeneutral">';
1692 print
' ('.$langs->trans(
"DomainUser").
')';
1695 print
'</td></tr>'.
"\n";
1698 if (
$object->ldap_sid && is_object($ldap)) {
1699 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1700 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1701 print
'</td></tr>'.
"\n";
1705 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1707 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1711 print
'</td></tr>'.
"\n";
1714 if ($nbofusers > 1) {
1716 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1718 if (empty(
$object->fk_user)) {
1719 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1721 $huser =
new User($db);
1723 $huser->fetch(
$object->fk_user);
1724 print $huser->getNomUrl(-1);
1726 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1733 if (isModEnabled(
'expensereport')) {
1735 $text = $langs->trans(
"ForceUserExpenseValidator");
1736 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1739 if (!empty(
$object->fk_user_expense_validator)) {
1740 $evuser =
new User($db);
1741 $evuser->fetch(
$object->fk_user_expense_validator);
1742 print $evuser->getNomUrl(-1);
1749 if (isModEnabled(
'holiday')) {
1751 $text = $langs->trans(
"ForceUserHolidayValidator");
1752 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1755 if (!empty(
$object->fk_user_holiday_validator)) {
1756 $hvuser =
new User($db);
1757 $hvuser->fetch(
$object->fk_user_holiday_validator);
1758 print $hvuser->getNomUrl(-1);
1766 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1767 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1771 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1778 if ((empty($user->socid) && in_array($id, $childids))
1779 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
1780 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1781 $langs->load(
"salaries");
1784 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1786 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1792 $text = $langs->trans(
"THM");
1793 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1802 $text = $langs->trans(
"TJM");
1803 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1812 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1814 if (
$object->dateemployment) {
1815 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1818 if (
$object->dateemploymentend) {
1819 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1826 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1834 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1835 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1836 if (
$object->fk_warehouse > 0) {
1837 $warehousestatic =
new Entrepot($db);
1838 $warehousestatic->fetch(
$object->fk_warehouse);
1839 print $warehousestatic->getNomUrl(1);
1847 print
'<div class="fichehalfright">';
1849 print
'<div class="underbanner clearboth"></div>';
1851 print
'<table class="border tableforfield centpercent">';
1854 if (isModEnabled(
'agenda')) {
1855 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1857 print $formother->showColor(
$object->color,
'');
1863 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1864 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1866 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1872 $langs->load(
"languages");
1873 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1875 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1879 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1885 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1886 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1887 print
'<td>'.$object->openid.
'</td>';
1892 if (isModEnabled(
'multicompany') && is_object($mc)) {
1894 if (!method_exists($mc,
'formObjectOptions')) {
1895 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1896 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1898 print $langs->trans(
"AllEntities");
1900 $mc->getInfo(
$object->entity);
1903 print
"</td></tr>\n";
1909 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1912 if (isModEnabled(
"societe")) {
1913 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1918 $societe->fetch(
$object->socid);
1919 if ($societe->id > 0) {
1920 $s .= $societe->getNomUrl(1,
'');
1923 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1925 if (!empty(
$object->contact_id)) {
1927 $contact->fetch(
$object->contact_id);
1928 if ($contact->id > 0) {
1929 if (
$object->socid > 0 && $s) {
1934 $s .= $contact->getNomUrl(1,
'');
1943 if (isModEnabled(
'member')) {
1944 $langs->load(
"members");
1945 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1949 $adh->fetch(
$object->fk_member);
1950 $adh->ref = $adh->getFullname($langs);
1951 print $adh->getNomUrl(-1);
1953 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1960 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1962 print
"</td></tr>\n";
1970 print
'<div class="div-table-responsive-no-min">';
1971 print
'<table class="noborder tableforfield centpercent">';
1973 print
'<tr class="liste_titre"><th class="liste_titre">';
1974 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
1976 print
'<th class="liste_titre"></th>';
1980 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1982 if (
$object->datestartvalidity) {
1983 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1986 if (
$object->dateendvalidity) {
1987 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1994 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
1995 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2004 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2005 if (!empty(
$object->ldap_sid)) {
2006 if ($passDoNotExpire) {
2007 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2008 } elseif ($userChangePassNextLogon) {
2009 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2010 } elseif ($userDisabled) {
2011 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2013 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2016 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2019 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2020 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2041 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2042 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2044 $valuetoshow = $hookmanager->resPrint;
2046 $valuetoshow .= $hookmanager->resPrint;
2050 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2051 print
'<td class="wordbreak">';
2058 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2059 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2061 if (!empty(
$object->api_key)) {
2062 print
'<span class="opacitymedium">';
2068 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">'.
getDolUserInt(
'API_COUNT_CALL').
'</span>';
2074 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2076 if (
$object->datepreviouslogin) {
2077 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2080 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2089 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2090 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters,
$object, $action);
2092 print $hookmanager->resPrint;
2098 print
'<div class="clearboth"></div>';
2107 print
'<div class="tabsAction">';
2109 $parameters = array();
2110 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2111 if (empty($reshook)) {
2115 'class' =>
'classfortooltip'
2119 if (empty($user->socid)) {
2120 $canSendMail =
false;
2122 $langs->load(
"mails");
2123 $canSendMail =
true;
2124 unset($params[
'attr'][
'title']);
2126 $langs->load(
"mails");
2127 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2129 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2132 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2134 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2135 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2137 unset($params[
'attr'][
'title']);
2140 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2142 unset($params[
'attr'][
'title']);
2143 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2150 'class' =>
'classfortooltip'
2155 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2156 $cloneButtonId =
'';
2159 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2161 $cloneButtonId =
'action-clone';
2163 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2167 if (
$object->status == $object::STATUS_DISABLED) {
2168 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2169 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2170 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2172 unset($params[
'attr'][
'title']);
2173 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2176 if (
$object->status == $object::STATUS_DISABLED) {
2177 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2178 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2179 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2182 unset($params[
'attr'][
'title']);
2183 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2185 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2186 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2191 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2193 unset($params[
'attr'][
'title']);
2194 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2197 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2199 unset($params[
'attr'][
'title']);
2200 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2202 if ($user->id == $id) {
2203 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2204 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2208 if ($user->id != $id && $permissiontodisable &&
2210 if ($user->admin || !
$object->admin) {
2211 unset($params[
'attr'][
'title']);
2212 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2214 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2215 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2225 if (
GETPOST(
'modelselected')) {
2226 $action =
'presend';
2230 $modelmail =
'user';
2231 $defaulttopic =
'Information';
2232 $diroutput =
$conf->user->dir_output;
2233 $trackid =
'use'.$object->id;
2235 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2237 if ($action !=
'presend' && $action !=
'send') {
2242 if ($permissiontoreadgroup) {
2243 print
'<!-- Group section -->'.
"\n";
2251 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2253 if (!empty($groupslist)) {
2254 foreach ($groupslist as $groupforuser) {
2255 $exclude[] = $groupforuser->id;
2260 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2261 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2262 print $hookmanager->resPrint;
2264 if (empty($reshook)) {
2265 if ($permissiontoeditgroup) {
2266 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2267 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2268 print
'<input type="hidden" name="action" value="addgroup" />';
2269 print
'<input type="hidden" name="page_y" value="" />';
2272 print
'<!-- List of groups of the user -->'.
"\n";
2273 print
'<table class="noborder centpercent">'.
"\n";
2274 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2275 print
'<th class="liste_titre right">';
2276 if ($permissiontoeditgroup) {
2277 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2279 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2280 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2282 print
'</th></tr>'.
"\n";
2285 if (!empty($groupslist)) {
2286 foreach ($groupslist as $group) {
2287 print
'<tr class="oddeven">';
2288 print
'<td class="tdoverflowmax200">';
2289 if ($permissiontoeditgroup) {
2290 print $group->getNomUrl(1);
2292 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2295 print
'<td class="right">';
2296 if ($permissiontoeditgroup) {
2297 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2298 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2303 print
"</td></tr>\n";
2306 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2311 if ($permissiontoeditgroup) {
2323 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2324 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2325 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2326 print
'<input type="hidden" name="action" value="update">';
2327 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2331 print
'<table class="border centpercent">';
2335 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2343 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2344 if ($permissiontoedit && !
$object->ldap_sid) {
2345 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2346 } elseif (
$object->civility_code) {
2347 print $langs->trans(
"Civility".
$object->civility_code);
2353 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2355 if ($permissiontoedit && !
$object->ldap_sid) {
2356 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2358 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2365 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2367 if ($permissiontoedit && !
$object->ldap_sid) {
2368 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2370 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2376 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2378 if ($user->admin && !
$object->ldap_sid) {
2379 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2381 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2388 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2390 $langs->load(
"admin");
2392 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2393 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2397 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2398 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2404 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2405 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2408 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2410 if (isModEnabled(
'multicompany') && !$user->entity) {
2411 if (
$conf->use_javascript_ajax) {
2412 print
'<script type="text/javascript">
2414 var admin = $("select[name=admin]").val();
2416 $("input[name=superadmin]")
2417 .prop("disabled", true)
2418 .prop("checked", false);
2420 if ($("input[name=superadmin]").is(":checked")) {
2421 $("select[name=entity]")
2422 .prop("disabled", true);
2424 $("select[name=admin]").change(function() {
2425 if ( $(this).val() == 0 ) {
2426 $("input[name=superadmin]")
2427 .prop("disabled", true)
2428 .prop("checked", false);
2429 $("select[name=entity]")
2430 .prop("disabled", false);
2432 $("input[name=superadmin]")
2433 .prop("disabled", false);
2436 $("input[name=superadmin]").change(function() {
2437 if ( $(this).is(":checked")) {
2438 $("select[name=entity]")
2439 .prop("disabled", true);
2441 $("select[name=entity]")
2442 .prop("disabled", false);
2449 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2450 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2454 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2455 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2456 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2457 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2466 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2468 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2469 if ($permissiontoedit) {
2470 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2472 print $arraygender[
$object->gender];
2478 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2479 if ($permissiontoedit) {
2480 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2483 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2492 if ($nbofusers > 1) {
2494 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2496 if ($permissiontoedit) {
2497 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');
2499 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2500 $huser =
new User($db);
2501 $huser->fetch(
$object->fk_user);
2502 print $huser->getNomUrl(-1);
2508 if (isModEnabled(
'expensereport')) {
2509 print
'<tr><td class="titlefieldcreate">';
2510 $text = $langs->trans(
"ForceUserExpenseValidator");
2511 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2514 if ($permissiontoedit) {
2515 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');
2517 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2518 $evuser =
new User($db);
2519 $evuser->fetch(
$object->fk_user_expense_validator);
2520 print $evuser->getNomUrl(-1);
2527 if (isModEnabled(
'holiday')) {
2528 print
'<tr><td class="titlefieldcreate">';
2529 $text = $langs->trans(
"ForceUserHolidayValidator");
2530 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2533 if ($permissiontoedit) {
2534 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');
2536 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2537 $hvuser =
new User($db);
2538 $hvuser->fetch(
$object->fk_user_holiday_validator);
2539 print $hvuser->getNomUrl(-1);
2547 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2549 if ($user->id ==
$object->id || !$user->admin) {
2551 $type = $langs->trans(
"Internal");
2553 $type = $langs->trans(
"External");
2556 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2558 print
' ('.$langs->trans(
"DomainUser").
')';
2567 $eventsCompanyContact = array();
2568 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2570 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2571 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2572 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2573 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2575 print
' ('.$langs->trans(
"DomainUser").
')';
2578 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2579 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2580 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2581 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2583 print
' ('.$langs->trans(
"DomainUser").
')';
2586 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2587 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2588 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2589 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2591 print
' ('.$langs->trans(
"DomainUser").
')';
2594 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2595 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2596 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2597 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2606 print
'<table class="border centpercent">';
2609 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2611 if ($permissiontoedit) {
2612 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2618 if ($permissiontoedit) {
2619 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2627 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2630 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2631 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2633 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2634 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2636 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2637 if ($permissiontoeditpasswordandsee) {
2638 $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">';
2639 if (!empty(
$conf->use_javascript_ajax)) {
2640 $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').
'"');
2643 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2647 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2648 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2650 $valuetoshow = $hookmanager->resPrint;
2652 $valuetoshow .= $hookmanager->resPrint;
2656 print
"</td></tr>\n";
2659 if (isModEnabled(
'api')) {
2660 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2662 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2663 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2664 if (!empty(
$conf->use_javascript_ajax)) {
2665 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2672 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2673 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2675 if ($permissiontoedit) {
2676 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2678 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2684 print
'</table><hr><table class="border centpercent">';
2688 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2690 if ($permissiontoedit) {
2691 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2694 if ($permissiontoedit) {
2695 print
'</textarea>';
2700 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2701 if ($permissiontoedit) {
2702 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2709 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2710 if ($permissiontoedit) {
2711 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2718 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2719 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2720 if ($permissiontoedit) {
2721 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2723 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2727 print $countrylabel;
2733 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2734 if ($permissiontoedit) {
2735 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2736 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2744 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2746 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2747 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2748 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2750 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2756 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2758 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2759 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2760 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'">';
2762 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2768 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2770 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2771 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2772 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2774 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2780 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2782 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2783 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2784 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2786 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2791 if (isModEnabled(
'socialnetworks')) {
2792 foreach ($socialnetworks as $key => $value) {
2793 if ($value[
'active']) {
2794 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2796 if (!empty($value[
'icon'])) {
2797 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2799 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2800 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2802 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2803 print
$object->socialnetworks[$key];
2808 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2813 print
'</table><hr><table class="border centpercent">';
2817 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2818 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2819 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>';
2824 if (isModEnabled(
'accounting')) {
2826 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2828 if ($permissiontoedit) {
2829 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2831 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2832 print
$object->accountancy_code;
2839 if (isModEnabled(
'agenda')) {
2840 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2842 if ($permissiontoedit) {
2843 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2845 print $formother->showColor(
$object->color,
'');
2852 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2854 print $form->showphoto(
'userphoto',
$object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2859 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2860 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2862 if ($permissiontoedit) {
2863 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
2865 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2872 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";
2873 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2879 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2881 print
$object->getLibStatut(4);
2908 if (isModEnabled(
'member')) {
2909 $langs->load(
"members");
2910 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2914 $adh->fetch(
$object->fk_member);
2915 $adh->ref = $adh->login;
2916 print $adh->getNomUrl(1);
2918 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2926 if (isModEnabled(
'multicompany') && is_object($mc)) {
2928 if (!method_exists($mc,
'formObjectOptions')) {
2929 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2930 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2931 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
2932 print
"</td></tr>\n";
2934 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2940 $parameters = array(
'colspan' =>
' colspan="2"');
2942 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2943 print $hookmanager->resPrint;
2944 if (empty($reshook)) {
2945 if ($permissiontoedit) {
2946 print
$object->showOptionals($extrafields,
'edit');
2948 print
$object->showOptionals($extrafields,
'view');
2953 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2955 if ($permissiontoedit) {
2956 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2958 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2959 print $doleditor->Create(1);
2971 print
'<table class="border centpercent">';
2977 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2979 if ($permissiontoedit) {
2980 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2982 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
2988 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2990 if ($permissiontoedit) {
2991 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
2999 if ((empty($user->socid) && in_array($id, $childids))
3000 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
3001 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
3002 $langs->load(
"salaries");
3005 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3007 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3013 $text = $langs->trans(
"THM");
3014 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3017 if ($permissiontoedit) {
3018 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3027 $text = $langs->trans(
"TJM");
3028 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3031 if ($permissiontoedit) {
3032 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3041 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3043 if ($permissiontoedit) {
3044 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3049 if ($dateemployment && $dateemploymentend) {
3053 if ($permissiontoedit) {
3054 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3062 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3064 if ($permissiontoedit) {
3065 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3076 print
'<div class="center">';
3077 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3078 print
' ';
3079 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3085 if ($action !=
'edit' && $action !=
'presend') {
3086 print
'<div class="fichecenter"><div class="fichehalfleft">';
3091 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3092 $genallowed = $user->hasRight(
"user",
"user",
"read");
3093 $delallowed = $user->hasRight(
"user",
"user",
"write");
3098 $societe->fetch(
$object->socid);
3103 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);
3104 $somethingshown = $formfile->numoffiles;
3107 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3108 $linktoelem = $tmparray[
'linktoelem'];
3109 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3110 print $htmltoenteralink;
3112 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3116 $morehtmlcenter =
'<div class="nowraponall">';
3117 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3118 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3119 $morehtmlcenter .=
'</div>';
3121 print
'</div><div class="fichehalfright">';
3124 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3126 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3128 print
'</div></div>';
3131 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3138include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3140if (isModEnabled(
'api')) {
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.