40require
'../main.inc.php';
52require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
65 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
68 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
78$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
81$action =
GETPOST(
'action',
'aZ09');
82$mode =
GETPOST(
'mode',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
85$cancel =
GETPOST(
'cancel',
'alpha');
86$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'usercard';
87$backtopage =
GETPOST(
'backtopage');
88$backtopageforcancel =
GETPOST(
'backtopageforcancel');
89$forcepasswordchange =
GETPOSTINT(
'forcepasswordchange');
91if (empty($id) && $action !=
'add' && $action !=
'create') {
101$childids = $user->getAllChildIds(1);
106$extrafields->fetch_name_optionals_label(
$object->table_element);
111$hookmanager->initHooks(array(
'usercard',
'globalcard'));
118 $res =
$object->fetch($id,
'',
'', 1);
123if ($user->socid > 0) {
124 $socid = $user->socid;
130$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
134$permissiontoreadgroup = $permissiontoread;
135$permissiontoeditgroup = $permissiontoedit;
137 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
138 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
141$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
142$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
143$permissiontocloneuser = $permissiontoadd;
146 $permissiontoclonesuperadmin =
false;
147 $permissiontocloneadmin =
false;
148 $permissiontocloneuser =
false;
151if ($user->id != $id && !$permissiontoread) {
155$caneditpasswordandsee =
false;
156$caneditpasswordandsend =
false;
159$permissiontoeditpasswordandsee =
false;
160$permissiontoeditpasswordandsend =
false;
163 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
164 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
165 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
169$permissiontoseesalary = (empty($user->socid) && (
170 (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
171 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
172 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
175$passwordismodified =
false;
183$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
184$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
189if (empty($reshook)) {
190 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
192 if (empty($backtopage) || ($cancel && empty($id))) {
193 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
194 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
195 $backtopage = $backurlforlist;
197 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
203 if (!empty($backtopageforcancel)) {
204 header(
"Location: ".$backtopageforcancel);
206 } elseif (!empty($backtopage)) {
207 header(
"Location: ".$backtopage);
213 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
214 if ($id != $user->id) {
216 if (
$object->admin && empty($user->admin)) {
219 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
222 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
228 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
231 if ($id != $user->id) {
234 if (!empty(
$conf->file->main_limit_users)) {
235 $nb =
$object->getNbOfUsers(
"active");
236 if ($nb >=
$conf->file->main_limit_users) {
238 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
244 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
250 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
251 if ($id != $user->id) {
253 print
'Error, token required for this critical operation';
260 if (
$object->admin && empty($user->admin)) {
263 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
264 } elseif (
$object->admin && empty(
$object->entity) && !empty($user->entity)) {
267 setEventMessages($langs->trans(
"OnlySuperAdminUsersCanDeleteSuperAdminUsers"),
null,
'errors');
271 $result =
$object->delete($user);
273 $langs->load(
"errors");
277 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
285 if ($action ==
'add' && $permissiontoadd) {
299 if (!empty(
$conf->file->main_limit_users)) {
300 $nb =
$object->getNbOfUsers(
"active");
301 if ($nb >=
$conf->file->main_limit_users) {
303 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
313 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
328 $object->socialnetworks = array();
329 foreach ($socialnetworks as $key => $value) {
330 if (
GETPOST($key,
'alphanohtml')) {
336 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
343 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
345 $langs->load(
"errors");
346 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
349 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
358 if ($permissiontoseesalary) {
371 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
373 $object->dateemployment = $dateemployment;
374 $object->dateemploymentend = $dateemploymentend;
375 $object->datestartvalidity = $datestartvalidity;
376 $object->dateendvalidity = $dateendvalidity;
378 $object->force_pass_change = $forcepasswordchange;
385 $ret = $extrafields->setOptionalsFromPost(
null, $object);
395 $cansetentity = (!empty($user->admin) && empty($user->entity));
396 $entity = $cansetentity ?
GETPOSTINT(
'entity') : $user->entity;
398 if ($cansetentity &&
GETPOSTINT(
'superadmin')) {
404 $object->entity = ($entity ==
'' ? 1 : $entity);
408 $object->entity = ($entity ==
'' ? 1 : $entity);
419 if (
GETPOST(
'password',
'password')) {
420 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
422 if (is_int($resPass) && $resPass < 0) {
423 $langs->load(
"errors");
430 $usercats =
GETPOST(
'usercats',
'array:int');
431 $object->setCategories($usercats);
435 if (!empty($backtopage)) {
436 $url = str_replace(
'__ID__', (
string) $id, $backtopage);
438 $url = $_SERVER[
'PHP_SELF'].
'?id='.
$id;
440 header(
"Location: ".$url);
444 $langs->load(
"errors");
453 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
456 $editgroup->fetch($group);
457 $editgroup->oldcopy = clone $editgroup;
461 if ($action ==
'addgroup') {
462 $result =
$object->SetInGroup($group, $editgroup->entity);
464 if ($action ==
'removegroup') {
465 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
476 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
477 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
479 if ($permissiontoedit) {
482 if (!
GETPOST(
"lastname",
'alpha')) {
487 if (!
GETPOST(
"login",
'alpha')) {
509 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
512 if ($permissiontoeditpasswordandsee) {
515 if ($permissiontoeditpasswordandsee) {
518 if (!empty($user->admin) && $user->id != $id) {
523 if ($user->admin && !
$object->ldap_sid) {
536 $object->socialnetworks = array();
537 foreach ($socialnetworks as $key => $value) {
538 if (
GETPOST($key,
'alphanohtml')) {
544 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
551 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
553 $langs->load(
"errors");
554 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
557 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
565 if ($permissiontoseesalary) {
578 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
579 $object->dateemployment = $dateemployment;
580 $object->dateemploymentend = $dateemploymentend;
581 $object->datestartvalidity = $datestartvalidity;
582 $object->dateendvalidity = $dateendvalidity;
584 $object->force_pass_change = $forcepasswordchange;
593 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
607 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
615 if (!empty($_FILES[
'photo'][
'name'])) {
619 if (
$object->id == $user->id) {
624 $langs->load(
"errors");
626 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
631 $passwordismodified = 0;
634 $passwordismodified = 1;
641 if (
$db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
642 $langs->load(
"errors");
643 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
655 if ($contactid > 0) {
657 $contact->fetch($contactid);
659 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
660 $sql .=
" SET fk_socpeople=".((int) $contactid);
661 if (!empty($contact->socid)) {
662 $sql .=
", fk_soc=".((int) $contact->socid);
663 } elseif ($socid > 0) {
664 $sql .=
", fk_soc = null";
665 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
667 $sql .=
" WHERE rowid = ".((int)
$object->id);
668 } elseif ($socid > 0) {
669 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
670 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
671 $sql .=
" WHERE rowid = ".((int)
$object->id);
673 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
674 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
675 $sql .=
" WHERE rowid = ".((int)
$object->id);
678 $resql =
$db->query($sql);
685 if (!$error && !count(
$object->errors)) {
687 $fileimg =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
690 $dirthumbs =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
694 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
695 $dir =
$conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
702 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
705 if (!is_numeric($result) || $result <= 0) {
713 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
722 $langs->load(
"errors");
723 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
728 if (!$error && !count(
$object->errors)) {
730 $categories =
GETPOST(
'usercats',
'array:int');
731 $object->setCategories($categories);
734 if (!$error && !count(
$object->errors)) {
738 $login = $_SESSION[
"dol_login"];
741 $langs->load(
"errors");
742 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
744 if ($passwordismodified &&
$object->login == $user->login) {
746 $langs->load(
"errors");
747 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
748 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
756 if ($permissiontoeditpasswordandsee) {
757 dol_syslog(
"Not allowed to change fields, only password");
761 if (
GETPOST(
"password",
"password")) {
764 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
765 if (is_int($ret) && $ret < 0) {
774 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
775 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
779 $newpassword =
$object->setPassword($user,
'');
780 if (is_int($newpassword) && $newpassword < 0) {
782 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
785 if ($action ==
'confirm_passwordsend') {
786 if (
$object->send_password($user, $newpassword) > 0) {
792 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
798 if ($action ==
'adduserldap' && $permissiontoadd) {
799 $selecteduser =
GETPOST(
'users');
801 $required_fields = array(
818 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
819 foreach ($arrayofsocialnetworks as $socialnetwork) {
825 $result = $ldap->connectBind();
828 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
833 if (is_array($ldapusers)) {
834 foreach ($ldapusers as $key => $attribute) {
846 $ldap_social = array();
849 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
850 foreach ($arrayofsocialnetworks as $socialnetwork) {
851 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
861 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
864 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
868 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
876 $clone->api_key =
'';
877 $clone->admin = ($user->admin ?
$object->admin : 0);
879 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
880 $clone->firstname = $parts[0];
881 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
883 $clone->login = substr($parts[0], 0, 1).$parts[1];
886 $clone->context[
'createfromclone'] =
'createfromclone';
887 $id = $clone->create($user);
888 $refalreadyexists = 0;
891 $result = $clone->cloneRights(
$object->id, $id);
894 if (
GETPOST(
'clone_categories')) {
895 $result = $clone->cloneCategories(
$object->id, $id);
903 if ($clone->error ==
'ErrorProductAlreadyExists') {
907 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
908 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
911 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
915 unset($clone->context[
'createfromclone']);
922 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
933 $triggersendname =
'USER_SENTBYMAIL';
935 $mode =
'emailfromuser';
936 $trackid =
'use'.$id;
937 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
940 $upload_dir =
$conf->user->dir_output;
941 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
944 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
964$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
965$resql =
$db->query($sql);
967 $obj =
$db->fetch_object($resql);
969 $nbofusers = $obj->nb;
977 $title = $person_name.
" - ".$langs->trans(
'Card');
980 $title = $langs->trans(
"NewEmployee");
982 $title = $langs->trans(
"NewUser");
988llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
990if ($action ==
'create' || $action ==
'adduserldap') {
993 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
1002 $result = $ldap->connectBind();
1004 $required_fields = array(
1024 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1029 if (is_array($ldapusers)) {
1030 foreach ($ldapusers as $key => $ldapuser) {
1033 foreach ($required_fields as $value) {
1035 $label .= $value.
"=******* ";
1037 $label .= $value.
"=".$ldapuser[$value].
" ";
1040 $liste[$key] = $label;
1050 print
"\n\n<!-- Form liste LDAP debut -->\n";
1052 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1053 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1054 print
'<table class="border centpercent"><tr>';
1055 print
'<td width="160">';
1056 print $langs->trans(
"LDAPUsers");
1059 print
'<input type="hidden" name="action" value="adduserldap">';
1060 if (is_array($liste) && count($liste)) {
1061 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1064 print
'</td><td class="center">';
1065 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1066 print
'</td></tr></table>';
1069 print
"\n<!-- Form liste LDAP fin -->\n\n";
1074 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1075 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1076 print
'<input type="hidden" name="action" value="add">';
1077 if (!empty($backtopage)) {
1078 print
'<input type="hidden" name="backtopage" value="'.dol_escape_htmltag($backtopage).
'">';
1080 if (!empty($backtopageforcancel)) {
1081 print
'<input type="hidden" name="backtopageforcancel" value="'.dol_escape_htmltag($backtopageforcancel).
'">';
1083 if (!empty($ldap_sid)) {
1084 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1086 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1092 print
'<table class="border centpercent">';
1096 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1097 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1103 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1105 if (!empty($ldap_lastname)) {
1106 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1107 print $ldap_lastname;
1109 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1114 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1116 if (!empty($ldap_firstname)) {
1117 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1118 print $ldap_firstname;
1120 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1125 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1127 if (!empty($ldap_login)) {
1128 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1130 } elseif (!empty($ldap_loginsmb)) {
1131 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1132 print $ldap_loginsmb;
1134 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1138 if (!empty(
$conf->use_javascript_ajax)) {
1142 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1143 if ($charforseparator ==
'none') {
1144 $charforseparator =
'';
1147 jQuery(document).ready(function() {
1148 $(".createloginauto").on("keyup", function() {
1149 console.log(".createloginauto change: We generate login when we have a lastname");
1151 lastname = $("#lastname").val().toLowerCase();
1154 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1155 $charforseparator =
'';
1157 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1159 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1165 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1167 login += lastname.replace(/\s+/g, \
'\').trim();
1169 $(
"#login").val(login);
1175 $generated_password = '';
1176 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1177 $generated_password = getRandomPassword(false);
1179 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1182 if (!empty($user->admin)) {
1183 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1185 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1187 if (isModEnabled('multicompany
') && !$user->entity) {
1188 if (!empty($conf->use_javascript_ajax)) {
1189 print '<script
type=
"text/javascript">
1191 $(
"select[name=admin]").change(
function() {
1192 if ( $(
this).val() == 0 ) {
1193 $(
"input[name=superadmin]")
1194 .prop(
"disabled",
true)
1195 .prop(
"checked",
false);
1196 $(
"select[name=entity]")
1197 .prop(
"disabled",
false);
1199 $(
"input[name=superadmin]")
1200 .prop(
"disabled",
false);
1203 $(
"input[name=superadmin]").change(
function() {
1204 if ( $(
this).is(
":checked") ) {
1205 $(
"select[name=entity]")
1206 .prop(
"disabled",
true);
1208 $(
"select[name=entity]")
1209 .prop(
"disabled",
false);
1215 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1216 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1217 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1219 print "</td></tr>\n";
1223 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1225 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1226 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1230 $defaultemployee = '1
';
1232 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1233 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1234 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1238 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1240 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
');
1244 // Expense report validator
1245 if (isModEnabled('expensereport
')) {
1246 print '<tr><td
class=
"titlefieldcreate">
';
1247 $text = $langs->trans("ForceUserExpenseValidator");
1248 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1251 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
');
1256 // Holiday request validator
1257 if (isModEnabled('holiday
')) {
1258 print '<tr><td
class=
"titlefieldcreate">
';
1259 $text = $langs->trans("ForceUserHolidayValidator");
1260 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1263 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
');
1269 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1271 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1275 print '</
table><hr><
table class=
"border centpercent">
';
1279 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1281 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1285 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1290 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1293 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1294 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1296 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1297 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1299 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1300 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1301 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1302 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1305 $valuetoshow .= ($valuetoshow ?
' + '.$langs->trans(
"DolibarrPassword") :
'').
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxlength="128" type="text" id="password" name="password" value="'.
dol_escape_htmltag($password).
'" autocomplete="new-password" spellcheck="false">';
1306 if (!empty(
$conf->use_javascript_ajax)) {
1307 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1312 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1313 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1315 $valuetoshow = $hookmanager->resPrint;
1317 $valuetoshow .= $hookmanager->resPrint;
1324 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
1325 print
'<tr><td class="titlefieldcreate"></td>';
1328 $permissiontoselfeditpassword = 1;
1329 if ($permissiontoselfeditpassword) {
1330 print
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.(GETPOST(
'forcepasswordchange') ==
'1' ?
' checked="checked"' :
'').
'>';
1331 print
'<label class="opacitymedium" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
1333 print
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey valignmiddle" disabled>';
1334 print $form->textwithpicto(
'<span class="opacitymedium">'.$langs->trans(
"ForcePasswordChange").
'</span>', $langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword"));
1344 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1346 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off" spellcheck="false">';
1347 if (!empty(
$conf->use_javascript_ajax)) {
1348 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1354 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1358 print
'</table><hr><table class="border centpercent">';
1362 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1363 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1365 print
'</textarea></td></tr>';
1368 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1369 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1373 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1374 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1378 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1379 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1380 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1382 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1388 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1389 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1390 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1395 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1397 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1398 if (!empty($ldap_phone)) {
1399 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1402 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1407 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1409 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1410 if (!empty($ldap_mobile)) {
1411 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1414 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'" spellcheck="false">';
1419 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1421 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1422 if (!empty($ldap_fax)) {
1423 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1426 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1431 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1433 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1434 if (!empty($ldap_mail)) {
1435 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1438 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1444 foreach ($socialnetworks as $key => $value) {
1445 if ($value[
'active']) {
1446 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1448 if (!empty($value[
'icon'])) {
1449 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1451 if (!empty($ldap_social[$key])) {
1452 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1453 print $ldap_social[$key];
1455 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1460 if (!empty($ldap_social[$key])) {
1461 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1463 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1471 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1473 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1479 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1481 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1486 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1487 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1488 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1494 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1495 print
'<td class="maxwidthonsmartphone">'.
"\n";
1496 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');
1502 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1504 if (!method_exists($mc,
'formObjectOptions')) {
1505 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1506 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1507 print
"<td>".$mc->select_entities(
$conf->entity);
1508 print
"</td></tr>\n";
1510 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1516 $parameters = array();
1517 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1520 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1521 print
'<td class="wordbreak">';
1522 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1524 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1525 print $doleditor->Create(1);
1529 print
'<tr><td class="tdtop">';
1530 print $langs->trans(
"NotePublic");
1532 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1533 $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%');
1534 $doleditor->Create();
1535 print
"</td></tr>\n";
1538 print
'<tr><td class="tdtop">';
1539 print $langs->trans(
"NotePrivate");
1541 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1542 $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%');
1543 $doleditor->Create();
1544 print
"</td></tr>\n";
1546 print
'</table><hr><table class="border centpercent">';
1553 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1554 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1559 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1561 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1564 if ($permissiontoseesalary) {
1565 $langs->load(
"salaries");
1569 $text = $langs->trans(
"THM");
1570 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1573 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1579 $text = $langs->trans(
"TJM");
1580 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1583 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1588 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1590 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1596 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1598 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1603 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1605 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1609 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1614 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1616 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1624 print $form->buttonsSaveCancel(
"CreateUser");
1630 $res =
$object->fetch($id,
'',
'', 1);
1635 $res =
$object->fetch_optionals();
1645 $passDoNotExpire = 0;
1647 $userChangePassNextLogon = 0;
1653 $result = $ldap->connectBind();
1655 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1656 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1662 if (count($ldap->uacf) > 0) {
1663 foreach ($ldap->uacf as $key => $statut) {
1664 if ($key == 65536) {
1665 $passDoNotExpire = 1;
1666 $statutUACF = $statut;
1671 $statutUACF =
"ACCOUNTDISABLE";
1674 if ($ldap->pwdlastset == 0) {
1675 $userChangePassNextLogon = 1;
1681 if ($mode ==
'employee') {
1682 $title = $langs->trans(
"Employee");
1683 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1685 $title = $langs->trans(
"User");
1688 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1689 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1696 if ($action ==
'password') {
1697 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1701 if ($action ==
'passwordsend') {
1702 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1706 if ($action ==
'disable') {
1707 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1711 if ($action ==
'enable') {
1712 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1716 if ($action ==
'delete') {
1717 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1721 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1722 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1724 $formquestionclone = array(
1725 'text' => $langs->trans(
"ConfirmClone"),
1726 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1727 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1728 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1731 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1732 array_splice($formquestionclone, 2, 0, array($newElement));
1734 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);
1739 if ($action !=
'edit') {
1740 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1742 $morehtmlref =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/vcard.php', [
'id' =>
$object->id,
'output' =>
'file',
'file' =>
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')]).
'" class="refid valignmiddle" rel="noopener">';
1743 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1744 $morehtmlref .=
'</a>';
1746 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1747 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1749 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1751 print
'<div class="fichecenter">';
1752 print
'<div class="fichehalfleft">';
1754 print
'<div class="underbanner clearboth"></div>';
1755 print
'<table class="border tableforfield centpercent">';
1758 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1759 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1760 print
'<td class="error">';
1761 print $langs->trans(
"LoginAccountDisableInDolibarr");
1767 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1768 } elseif (!empty(
$object->admin)) {
1769 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1778 $text = $langs->trans(
"Type");
1779 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1781 $type = $langs->trans(
"Internal");
1783 $type = $langs->trans(
"External");
1785 print
'<span class="badgeneutral">';
1788 print
' ('.$langs->trans(
"DomainUser").
')';
1791 print
'</td></tr>'.
"\n";
1794 if (
$object->ldap_sid && is_object($ldap)) {
1795 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1796 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1797 print
'</td></tr>'.
"\n";
1801 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1803 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1807 print
'</td></tr>'.
"\n";
1810 if ($nbofusers > 1) {
1812 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1814 if (empty(
$object->fk_user)) {
1815 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1819 $huser->fetch(
$object->fk_user);
1820 print $huser->getNomUrl(-1);
1822 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1831 $text = $langs->trans(
"ForceUserExpenseValidator");
1832 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1835 if (!empty(
$object->fk_user_expense_validator)) {
1837 $evuser->fetch(
$object->fk_user_expense_validator);
1838 print $evuser->getNomUrl(-1);
1847 $text = $langs->trans(
"ForceUserHolidayValidator");
1848 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1851 if (!empty(
$object->fk_user_holiday_validator)) {
1853 $hvuser->fetch(
$object->fk_user_holiday_validator);
1854 print $hvuser->getNomUrl(-1);
1862 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1863 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1867 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1874 if ($permissiontoseesalary) {
1875 $langs->load(
"salaries");
1878 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1880 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1886 $text = $langs->trans(
"THM");
1887 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1890 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1896 $text = $langs->trans(
"TJM");
1897 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1900 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1,
$conf->currency).
'</span>' :
'');
1906 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1908 if (
$object->dateemployment) {
1909 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1912 if (
$object->dateemploymentend) {
1913 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1920 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1928 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1929 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1930 if (
$object->fk_warehouse > 0) {
1932 $warehousestatic->fetch(
$object->fk_warehouse);
1933 print $warehousestatic->getNomUrl(1);
1941 print
'<div class="fichehalfright">';
1943 print
'<div class="underbanner clearboth"></div>';
1945 print
'<table class="border tableforfield centpercent">';
1949 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1951 print $formother->showColor(
$object->color,
'');
1957 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1958 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1960 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1966 $langs->load(
"languages");
1967 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1969 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1973 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1979 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1980 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1981 print
'<td>'.$object->openid.
'</td>';
1986 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
1988 if (!method_exists($mc,
'formObjectOptions')) {
1990 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1992 print $langs->trans(
"AllEntities");
1994 $mc->getInfo(
$object->entity);
1997 print
"</td></tr>\n";
2003 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
2007 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2012 $societe->fetch(
$object->socid);
2013 if ($societe->id > 0) {
2014 $s .= $societe->getNomUrl(1,
'');
2017 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2019 if (!empty(
$object->contact_id)) {
2021 $contact->fetch(
$object->contact_id);
2022 if ($contact->id > 0) {
2023 if (
$object->socid > 0 && $s) {
2028 $s .= $contact->getNomUrl(1,
'');
2038 $langs->load(
"members");
2039 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2043 $adh->fetch(
$object->fk_member);
2044 $adh->ref = $adh->getFullname($langs);
2045 print $adh->getNomUrl(-1);
2047 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2054 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2056 print
"</td></tr>\n";
2067 print
'<!-- credential section -->'.
"\n";
2068 print
'<div class="div-table-responsive-no-min">';
2069 print
'<table class="noborder tableforfield centpercent">';
2072 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2073 print
'<div class="centpercent display-flex">';
2074 print
'<div class="left inline-block">';
2075 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2082 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2084 if (
$object->datestartvalidity) {
2085 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2088 if (
$object->dateendvalidity) {
2089 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2096 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2097 print
'<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans(
"PasswordToChange"), $langs->trans(
"ForcePasswordChange")).
'</td>';
2099 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2100 if ($permissiontoselfeditpassword) {
2102 print
'<input type="checkbox" class="colorgrey" disabled name="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2104 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2107 print
'<span class="opacitymedium">'.yn(
$object->force_pass_change).
'</span>';
2110 print
'<input type="checkbox" name="forcepasswordchange" value="1" disabled class="valignmiddle">';
2111 print
'<span class="opacitymedium" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"No").
'</span>';
2119 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2120 if (!empty(
$object->ldap_sid)) {
2121 if ($passDoNotExpire) {
2122 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2123 } elseif ($userChangePassNextLogon) {
2124 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2125 } elseif ($userDisabled) {
2126 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2128 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2131 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2134 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2135 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2139 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2140 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2142 $valuetoshow = $hookmanager->resPrint;
2144 $valuetoshow .= $hookmanager->resPrint;
2148 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2149 print
'<td class="wordbreak">';
2156 if (
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') && $permissiontoeditpasswordandsee) {
2157 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2159 print
'<div class="centpercent display-flex">';
2160 print
'<span class="badge badge-info">999</span>';
2161 print
'<div class="left inline-block">';
2162 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2164 print
'</span></span>';
2169 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2170 foreach ($tmparrayofauthmode as $tmpauthmode) {
2171 $langs->load(
"oauth");
2173 $tmpauthmode = trim($tmpauthmode);
2174 if (preg_match(
'/oauth/', $tmpauthmode)) {
2175 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2176 print
'<tr class="nooddeven">';
2177 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2178 print
' '.ucfirst($nameofservice).
' ';
2181 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2182 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2190 if (!empty(
$object->email_oauth2)) {
2191 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2201 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin)) {
2202 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2205 print
'<div class="centpercent display-flex">';
2206 print
'<span class="badge badge-info">999</span>';
2210 print
'<div class="left inline-block">';
2211 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2216 if (!empty(
$object->api_key)) {
2217 print
'<span class="opacitymedium">';
2222 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">';
2232 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2234 if (
$object->datepreviouslogin) {
2235 print $form->textwithpicto(
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Previous"));
2238 if (
$object->datepreviouslogin) {
2239 print
' ';
2241 print $form->textwithpicto(
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel"), $langs->trans(
"Currently"));
2251 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2252 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2254 print $hookmanager->resPrint;
2260 print
'<div class="clearboth"></div>';
2269 print
'<div class="tabsAction">';
2271 $parameters = array();
2272 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2273 if (empty($reshook)) {
2277 'class' =>
'classfortooltip'
2281 if (empty($user->socid)) {
2282 $canSendMail =
false;
2284 $langs->load(
"mails");
2285 $canSendMail =
true;
2286 unset($params[
'attr'][
'title']);
2288 $langs->load(
"mails");
2289 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2291 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2296 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2299 unset($params[
'attr'][
'title']);
2302 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2304 unset($params[
'attr'][
'title']);
2312 'class' =>
'classfortooltip'
2317 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2318 $cloneButtonId =
'';
2321 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2323 $cloneButtonId =
'action-clone';
2325 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2329 if (
$object->status == $object::STATUS_DISABLED) {
2330 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2332 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2334 unset($params[
'attr'][
'title']);
2335 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2338 if (
$object->status == $object::STATUS_DISABLED) {
2339 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2340 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2341 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2344 unset($params[
'attr'][
'title']);
2345 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2347 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2348 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2353 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2355 unset($params[
'attr'][
'title']);
2356 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2359 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2361 unset($params[
'attr'][
'title']);
2362 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2364 if ($user->id == $id) {
2365 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2366 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2370 if ($user->id != $id && $permissiontodisable &&
2372 if ($user->admin || !
$object->admin) {
2373 unset($params[
'attr'][
'title']);
2374 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2376 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2377 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2387 if (
GETPOST(
'modelselected')) {
2388 $action =
'presend';
2392 $modelmail =
'user';
2393 $defaulttopic =
'Information';
2394 $diroutput =
$conf->user->dir_output;
2395 $trackid =
'use'.$object->id;
2397 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2399 if ($action !=
'presend' && $action !=
'send') {
2404 if ($permissiontoreadgroup) {
2405 print
'<!-- Group section -->'.
"\n";
2413 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2415 if (!empty($groupslist)) {
2416 foreach ($groupslist as $groupforuser) {
2417 $exclude[] = $groupforuser->id;
2422 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2423 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2424 print $hookmanager->resPrint;
2426 if (empty($reshook)) {
2427 if ($permissiontoeditgroup) {
2428 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2429 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2430 print
'<input type="hidden" name="action" value="addgroup" />';
2431 print
'<input type="hidden" name="page_y" value="" />';
2434 print
'<!-- List of groups of the user -->'.
"\n";
2435 print
'<table class="noborder centpercent">'.
"\n";
2436 print
'<tr class="liste_titre">';
2438 print
'<th class="liste_titre right" colspan="2">';
2439 if ($permissiontoeditgroup) {
2440 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2442 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2443 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2445 print
'</th></tr>'.
"\n";
2448 if (!empty($groupslist)) {
2449 foreach ($groupslist as $group) {
2450 print
'<tr class="oddeven">';
2451 print
'<td class="tdoverflowmax200">';
2452 if ($permissiontoeditgroup) {
2453 print $group->getNomUrl(1);
2455 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2458 print
'<td class="right">';
2459 if ($permissiontoeditgroup) {
2460 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2461 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2466 print
"</td></tr>\n";
2469 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2474 if ($permissiontoeditgroup) {
2486 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2487 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2488 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2489 print
'<input type="hidden" name="action" value="update">';
2490 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2494 print
'<table class="border centpercent">';
2498 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2507 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2509 if ($permissiontoedit && !
$object->ldap_sid) {
2510 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2512 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2519 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2521 if ($permissiontoedit && !
$object->ldap_sid) {
2522 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2524 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2530 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2532 if ($user->admin && !
$object->ldap_sid) {
2533 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2535 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2542 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2544 if ($user->id ==
$object->id || !$user->admin) {
2546 $type = $langs->trans(
"Internal");
2548 $type = $langs->trans(
"External");
2551 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2553 print
' ('.$langs->trans(
"DomainUser").
')';
2562 $eventsCompanyContact = array();
2563 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2565 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2566 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2567 print
'<span class="clearbothonsmartphone"></span>';
2568 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2569 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2571 print
' ('.$langs->trans(
"DomainUser").
')';
2574 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2575 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2576 print
'<span class="clearbothonsmartphone"></span>';
2577 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2578 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2580 print
' ('.$langs->trans(
"DomainUser").
')';
2583 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2584 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2585 print
'<span class="clearbothonsmartphone"></span>';
2586 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2587 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2589 print
' ('.$langs->trans(
"DomainUser").
')';
2592 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2593 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2594 print
'<span class="clearbothonsmartphone"></span>';
2595 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2596 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2602 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2604 $langs->load(
"admin");
2606 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2607 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2611 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2612 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2619 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2622 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2625 if (
$conf->use_javascript_ajax) {
2626 print
'<script type="text/javascript">
2628 var admin = $("select[name=admin]").val();
2630 $("input[name=superadmin]")
2631 .prop("disabled", true)
2632 .prop("checked", false);
2634 if ($("input[name=superadmin]").is(":checked")) {
2635 $("select[name=entity]")
2636 .prop("disabled", true);
2638 $("select[name=admin]").change(function() {
2639 if ( $(this).val() == 0 ) {
2640 $("input[name=superadmin]")
2641 .prop("disabled", true)
2642 .prop("checked", false);
2643 $("select[name=entity]")
2644 .prop("disabled", false);
2646 $("input[name=superadmin]")
2647 .prop("disabled", false);
2650 $("input[name=superadmin]").change(function() {
2651 if ( $(this).is(":checked")) {
2652 $("select[name=entity]")
2653 .prop("disabled", true);
2655 $("select[name=entity]")
2656 .prop("disabled", false);
2663 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2664 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2668 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2669 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2671 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2681 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2682 if ($permissiontoedit && !
$object->ldap_sid) {
2683 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2684 } elseif (
$object->civility_code) {
2685 print $langs->trans(
"Civility".
$object->civility_code);
2691 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2693 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2694 if ($permissiontoedit) {
2697 print $arraygender[
$object->gender];
2703 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2704 if ($permissiontoedit) {
2705 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2708 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2717 if ($nbofusers > 1) {
2719 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2721 if ($permissiontoedit) {
2722 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');
2724 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2726 $huser->fetch(
$object->fk_user);
2727 print $huser->getNomUrl(-1);
2734 print
'<tr><td class="titlefieldcreate">';
2735 $text = $langs->trans(
"ForceUserExpenseValidator");
2736 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2739 if ($permissiontoedit) {
2740 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');
2742 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2744 $evuser->fetch(
$object->fk_user_expense_validator);
2745 print $evuser->getNomUrl(-1);
2753 print
'<tr><td class="titlefieldcreate">';
2754 $text = $langs->trans(
"ForceUserHolidayValidator");
2755 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2758 if ($permissiontoedit) {
2759 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');
2761 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2763 $hvuser->fetch(
$object->fk_user_holiday_validator);
2764 print $hvuser->getNomUrl(-1);
2775 print
'<table class="border centpercent">';
2778 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2780 if ($permissiontoedit) {
2781 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2787 if ($permissiontoedit) {
2788 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2797 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2800 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2801 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2803 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2804 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((
string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (
string) $dolibarr_main_authentication), 1,
'warning');
2806 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2807 if ($permissiontoeditpasswordandsee) {
2808 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="minwidth300 maxwidth400 widthcentpercentminusx" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password" spellcheck="false">';
2809 if (!empty(
$conf->use_javascript_ajax)) {
2810 $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' ?
' ' :
' linkobject').
'"');
2813 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2817 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2818 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2820 $valuetoshow = $hookmanager->resPrint;
2822 $valuetoshow .= $hookmanager->resPrint;
2826 print
"</td></tr>\n";
2829 if ($_SESSION[
"dol_authmode"] ==
'dolibarr') {
2831 print
'<td></td><td>';
2832 $permissiontoselfeditpassword =
$object->hasRight(
'user',
'self',
'password');
2833 if ($permissiontoselfeditpassword) {
2834 if ($permissiontoedit) {
2835 print
'<input type="checkbox" name="forcepasswordchange" id="forcepasswordchange" value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2836 print
'<label class="opacitylow" for="forcepasswordchange">'.$langs->trans(
"ForcePasswordChange").
'</label>';
2838 print
'<input type="checkbox" name="forcepasswordchange" class="colorgrey" disabled value="1"'.($object->force_pass_change ?
' checked="checked"' :
'').
'>';
2839 print $langs->trans(
"ForcePasswordChange");
2842 print
'<input type="checkbox" name="forcepasswordchange" value="1" class="colorgrey" disabled>';
2843 print
'<span class="opacitymedium" title="'.$langs->trans(
"UserDoesNotHaveRightsToChangeHisPassword").
'">'.$langs->trans(
"ForcePasswordChange").
'</span>';
2852 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2854 if ($permissiontoeditpasswordandsee) {
2855 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off" spellcheck="false">';
2856 if (!empty(
$conf->use_javascript_ajax)) {
2857 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2865 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2866 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2868 if ($permissiontoedit) {
2869 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2871 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2877 print
'</table><hr><table class="border centpercent">';
2881 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2883 if ($permissiontoedit) {
2884 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2887 if ($permissiontoedit) {
2888 print
'</textarea>';
2893 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2894 if ($permissiontoedit) {
2895 print $formcompany->select_ziptown((
GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2902 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2903 if ($permissiontoedit) {
2904 print $formcompany->select_ziptown((
GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2911 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2912 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2913 if ($permissiontoedit) {
2914 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2916 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2920 print $countrylabel;
2926 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2927 if ($permissiontoedit) {
2928 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2929 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2937 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2939 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2940 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2941 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2943 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2949 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2951 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2952 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2953 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'" spellcheck="false">';
2955 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2961 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2963 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2964 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2965 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2967 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2973 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2975 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2976 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2977 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2979 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2985 foreach ($socialnetworks as $key => $value) {
2986 if ($value[
'active']) {
2987 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2989 if (!empty($value[
'icon'])) {
2990 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2992 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2993 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2995 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2996 print
$object->socialnetworks[$key];
3001 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
3006 print
'</table><hr><table class="border centpercent">';
3010 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
3011 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
3012 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>';
3019 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
3021 if ($permissiontoedit) {
3022 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3024 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
3025 print
$object->accountancy_code;
3033 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
3035 if ($permissiontoedit) {
3036 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
3038 print $formother->showColor(
$object->color,
'');
3045 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
3047 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
3052 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
3053 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
3055 if ($permissiontoedit) {
3056 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
3058 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
3065 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";
3066 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
3072 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
3074 print
$object->getLibStatut(4);
3102 $langs->load(
"members");
3103 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3107 $adh->fetch(
$object->fk_member);
3108 $adh->ref = $adh->login;
3109 print $adh->getNomUrl(1);
3111 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3119 if (
isModEnabled(
'multicompany') && isset($mc) && is_object($mc)) {
3121 if (!method_exists($mc,
'formObjectOptions')) {
3122 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
3123 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3124 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3125 print
"</td></tr>\n";
3127 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3133 $parameters = array(
'colspan' =>
' colspan="2"');
3135 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3136 print $hookmanager->resPrint;
3137 if (empty($reshook)) {
3138 if ($permissiontoedit) {
3139 print
$object->showOptionals($extrafields,
'edit');
3141 print
$object->showOptionals($extrafields,
'view');
3146 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3148 if ($permissiontoedit) {
3149 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3151 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3152 print $doleditor->Create(1);
3164 print
'<table class="border centpercent">';
3170 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3172 if ($permissiontoedit) {
3173 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3175 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3181 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3183 if ($permissiontoedit) {
3184 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3192 if ($permissiontoseesalary) {
3193 $langs->load(
"salaries");
3196 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3198 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3199 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3205 $text = $langs->trans(
"THM");
3206 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3209 if ($permissiontoedit) {
3210 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3211 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3220 $text = $langs->trans(
"TJM");
3221 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3224 if ($permissiontoedit) {
3225 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3226 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3235 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3237 if ($permissiontoedit) {
3238 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3243 if ($dateemployment && $dateemploymentend) {
3247 if ($permissiontoedit) {
3248 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3256 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3258 if ($permissiontoedit) {
3259 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3270 print
'<div class="center">';
3271 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3272 print
' ';
3273 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3279 if ($action !=
'edit' && $action !=
'presend') {
3280 print
'<div class="fichecenter"><div class="fichehalfleft">';
3285 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3286 $genallowed = $user->hasRight(
"user",
"user",
"read");
3287 $delallowed = $user->hasRight(
"user",
"user",
"write");
3292 $societe->fetch(
$object->socid);
3297 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);
3298 $somethingshown = $formfile->numoffiles;
3302 $morehtmlcenter =
'<div class="nowraponall">';
3303 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3304 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3305 $morehtmlcenter .=
'</div>';
3307 print
'</div><div class="fichehalfright">';
3310 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3312 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3314 print
'</div></div>';
3324include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=2, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
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)
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'.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into JavaScript code.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
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.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
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.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
user_prepare_head(User $object)
Prepare array with list of tabs.