40require
'../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
53require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
54if (isModEnabled(
'ldap')) {
55 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
57if (isModEnabled(
'member')) {
58 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
60if (isModEnabled(
'category')) {
61 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63if (isModEnabled(
'stock')) {
64 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
78$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
81$action =
GETPOST(
'action',
'aZ09');
82$mode =
GETPOST(
'mode',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
85$cancel =
GETPOST(
'cancel',
'alpha');
86$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
87$backtopage =
GETPOST(
'backtopage');
89if (empty($id) && $action !=
'add' && $action !=
'create') {
99$childids = $user->getAllChildIds(1);
105$extrafields->fetch_name_optionals_label(
$object->table_element);
110$hookmanager->initHooks(array(
'usercard',
'globalcard'));
117 $res =
$object->fetch($id,
'',
'', 1);
122if ($user->socid > 0) {
123 $socid = $user->socid;
129$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
130$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontoreadgroup = $permissiontoread;
134$permissiontoeditgroup = $permissiontoedit;
136 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
137 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
140$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
141$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
142$permissiontocloneuser = $permissiontoadd;
145 $permissiontoclonesuperadmin =
false;
146 $permissiontocloneadmin =
false;
147 $permissiontocloneuser =
false;
150if ($user->id != $id && !$permissiontoread) {
154$caneditpasswordandsee =
false;
155$caneditpasswordandsend =
false;
158$permissiontoeditpasswordandsee =
false;
159$permissiontoeditpasswordandsend =
false;
162 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
163 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
164 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
168$permissiontoseesalary = (empty($user->socid) && (
169 (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
170 || (isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
171 || (isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
172 || (!isModEnabled(
'salaries') && !isModEnabled(
'hrm') && (
$id == 0 || in_array($id, $childids))));
174$passwordismodified =
false;
182$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
183$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
188if (empty($reshook)) {
189 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
191 if (empty($backtopage) || ($cancel && empty($id))) {
192 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
193 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
194 $backtopage = $backurlforlist;
196 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
202 if (!empty($backtopageforcancel)) {
203 header(
"Location: ".$backtopageforcancel);
205 } elseif (!empty($backtopage)) {
206 header(
"Location: ".$backtopage);
212 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
213 if ($id != $user->id) {
215 if (
$object->admin && empty($user->admin)) {
218 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
221 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
227 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
230 if ($id != $user->id) {
233 if (!empty(
$conf->file->main_limit_users)) {
234 $nb =
$object->getNbOfUsers(
"active");
235 if ($nb >=
$conf->file->main_limit_users) {
237 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
243 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
249 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
250 if ($id != $user->id) {
251 if (!GETPOSTISSET(
'token')) {
252 print
'Error, token required for this critical operation';
260 $result =
$object->delete($user);
262 $langs->load(
"errors");
266 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
273 if ($action ==
'add' && $permissiontoadd) {
287 if (!empty(
$conf->file->main_limit_users)) {
288 $nb =
$object->getNbOfUsers(
"active");
289 if ($nb >=
$conf->file->main_limit_users) {
291 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
301 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
315 if (isModEnabled(
'socialnetworks')) {
316 $object->socialnetworks = array();
317 foreach ($socialnetworks as $key => $value) {
318 if (
GETPOST($key,
'alphanohtml')) {
324 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
331 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
333 $langs->load(
"errors");
334 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
337 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
347 if ($permissiontoseesalary) {
354 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
355 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
360 $object->dateemployment = $dateemployment;
361 $object->dateemploymentend = $dateemploymentend;
362 $object->datestartvalidity = $datestartvalidity;
363 $object->dateendvalidity = $dateendvalidity;
371 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
378 if (isModEnabled(
'multicompany')) {
385 $object->entity = ($entity ==
'' ? 1 : $entity);
389 $object->entity = ($entity ==
'' ? 1 : $entity);
400 if (
GETPOST(
'password',
'password')) {
401 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
403 if (is_int($resPass) && $resPass < 0) {
404 $langs->load(
"errors");
409 if (isModEnabled(
"category")) {
411 $usercats =
GETPOST(
'usercats',
'array');
412 $object->setCategories($usercats);
416 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
420 $langs->load(
"errors");
429 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
432 $editgroup->fetch($group);
433 $editgroup->oldcopy = clone $editgroup;
437 if ($action ==
'addgroup') {
438 $result =
$object->SetInGroup($group, $editgroup->entity);
440 if ($action ==
'removegroup') {
441 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
452 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
453 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
455 if ($permissiontoedit) {
458 if (!
GETPOST(
"lastname",
'alpha')) {
463 if (!
GETPOST(
"login",
'alpha')) {
480 if (GETPOSTISSET(
"ref_employee")) {
484 if (GETPOSTISSET(
"national_registration_number")) {
485 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
488 if ($permissiontoeditpasswordandsee) {
491 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
494 if (!empty($user->admin) && $user->id != $id) {
499 if ($user->admin && !
$object->ldap_sid) {
511 if (isModEnabled(
'socialnetworks')) {
512 $object->socialnetworks = array();
513 foreach ($socialnetworks as $key => $value) {
514 if (
GETPOST($key,
'alphanohtml')) {
520 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
527 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
529 $langs->load(
"errors");
530 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
533 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
541 if ($permissiontoseesalary) {
548 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
550 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
555 $object->dateemployment = $dateemployment;
556 $object->dateemploymentend = $dateemploymentend;
557 $object->datestartvalidity = $datestartvalidity;
558 $object->dateendvalidity = $dateendvalidity;
561 if (isModEnabled(
'stock')) {
568 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
582 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
590 if (!empty($_FILES[
'photo'][
'name'])) {
594 if (
$object->id == $user->id) {
599 $langs->load(
"errors");
601 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
606 $passwordismodified = 0;
609 $passwordismodified = 1;
616 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
617 $langs->load(
"errors");
618 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
626 if (!$error && GETPOSTISSET(
'contactid')) {
630 if ($contactid > 0) {
632 $contact->fetch($contactid);
634 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
635 $sql .=
" SET fk_socpeople=".((int) $contactid);
636 if (!empty($contact->socid)) {
637 $sql .=
", fk_soc=".((int) $contact->socid);
638 } elseif ($socid > 0) {
639 $sql .=
", fk_soc = null";
640 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
642 $sql .=
" WHERE rowid = ".((int)
$object->id);
643 } elseif ($socid > 0) {
644 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
645 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
646 $sql .=
" WHERE rowid = ".((int)
$object->id);
648 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
649 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
650 $sql .=
" WHERE rowid = ".((int)
$object->id);
653 $resql = $db->query($sql);
660 if (!$error && !count(
$object->errors)) {
669 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
677 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
679 if (!($result > 0)) {
687 $langs->load(
"errors");
688 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
693 if (!$error && !count(
$object->errors)) {
695 $categories =
GETPOST(
'usercats',
'array');
696 $object->setCategories($categories);
699 if (!$error && !count(
$object->errors)) {
703 $login = $_SESSION[
"dol_login"];
706 $langs->load(
"errors");
707 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
709 if ($passwordismodified &&
$object->login == $user->login) {
711 $langs->load(
"errors");
712 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
713 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
721 if ($permissiontoeditpasswordandsee) {
722 dol_syslog(
"Not allowed to change fields, only password");
726 if (
GETPOST(
"password",
"password")) {
729 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
730 if (is_int($ret) && $ret < 0) {
739 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
740 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
744 $newpassword =
$object->setPassword($user,
'');
745 if (is_int($newpassword) && $newpassword < 0) {
747 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
750 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
751 if (
$object->send_password($user, $newpassword) > 0) {
757 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
763 if ($action ==
'adduserldap' && $permissiontoadd) {
764 $selecteduser =
GETPOST(
'users');
766 $required_fields = array(
782 if (isModEnabled(
'socialnetworks')) {
783 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
784 foreach ($arrayofsocialnetworks as $socialnetwork) {
790 $result = $ldap->connectBind();
793 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
798 if (is_array($ldapusers)) {
799 foreach ($ldapusers as $key => $attribute) {
811 $ldap_social = array();
813 if (isModEnabled(
'socialnetworks')) {
814 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
815 foreach ($arrayofsocialnetworks as $socialnetwork) {
816 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
826 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
829 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
833 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
841 $clone->api_key =
'';
843 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
844 $clone->firstname = $parts[0];
845 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
847 $clone->login = substr($parts[0], 0, 1).$parts[1];
850 $clone->context[
'createfromclone'] =
'createfromclone';
851 $id = $clone->create($user);
852 $refalreadyexists = 0;
855 $result = $clone->cloneRights(
$object->id, $id);
858 if (
GETPOST(
'clone_categories')) {
859 $result = $clone->cloneCategories(
$object->id, $id);
867 if ($clone->error ==
'ErrorProductAlreadyExists') {
871 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
872 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
875 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
879 unset($clone->context[
'createfromclone']);
886 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
897 $triggersendname =
'USER_SENTBYMAIL';
899 $mode =
'emailfromuser';
900 $trackid =
'use'.$id;
901 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
904 $upload_dir =
$conf->user->dir_output;
905 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
913$form =
new Form($db);
919if (isModEnabled(
'stock')) {
925$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
926$resql = $db->query($sql);
928 $obj = $db->fetch_object($resql);
930 $nbofusers = $obj->nb;
938 $title = $person_name.
" - ".$langs->trans(
'Card');
941 $title = $langs->trans(
"NewEmployee");
943 $title = $langs->trans(
"NewUser");
949llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
951if ($action ==
'create' || $action ==
'adduserldap') {
954 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
958 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
963 $result = $ldap->connectBind();
965 $required_fields = array(
985 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
990 if (is_array($ldapusers)) {
991 foreach ($ldapusers as $key => $ldapuser) {
994 foreach ($required_fields as $value) {
996 $label .= $value.
"=******* ";
998 $label .= $value.
"=".$ldapuser[$value].
" ";
1001 $liste[$key] = $label;
1011 print
"\n\n<!-- Form liste LDAP debut -->\n";
1013 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1014 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1015 print
'<table class="border centpercent"><tr>';
1016 print
'<td width="160">';
1017 print $langs->trans(
"LDAPUsers");
1020 print
'<input type="hidden" name="action" value="adduserldap">';
1021 if (is_array($liste) && count($liste)) {
1022 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1025 print
'</td><td class="center">';
1026 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1027 print
'</td></tr></table>';
1030 print
"\n<!-- Form liste LDAP fin -->\n\n";
1035 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1036 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1037 print
'<input type="hidden" name="action" value="add">';
1038 if (!empty($ldap_sid)) {
1039 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1041 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1047 print
'<table class="border centpercent">';
1050 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1051 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1056 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1058 if (!empty($ldap_lastname)) {
1059 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1060 print $ldap_lastname;
1062 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1067 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1069 if (!empty($ldap_firstname)) {
1070 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1071 print $ldap_firstname;
1073 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1078 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1080 if (!empty($ldap_login)) {
1081 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1083 } elseif (!empty($ldap_loginsmb)) {
1084 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1085 print $ldap_loginsmb;
1087 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1091 if (!empty(
$conf->use_javascript_ajax)) {
1095 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1096 if ($charforseparator ==
'none') {
1097 $charforseparator =
'';
1100 jQuery(document).ready(function() {
1101 $(".createloginauto").on("keyup", function() {
1102 console.log(".createloginauto change: We generate login when we have a lastname");
1104 lastname = $("#lastname").val().toLowerCase();
1107 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1109 print
' firstname = $("#firstname").val().toLowerCase();';
1115 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1119 $(
"#login").val(login);
1125 $generated_password = '';
1126 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1127 $generated_password = getRandomPassword(false);
1129 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1132 if (!empty($user->admin)) {
1133 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1135 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1137 if (isModEnabled('multicompany
') && !$user->entity) {
1138 if (!empty($conf->use_javascript_ajax)) {
1139 print '<script
type=
"text/javascript">
1141 $(
"select[name=admin]").change(
function() {
1142 if ( $(
this).val() == 0 ) {
1143 $(
"input[name=superadmin]")
1144 .prop(
"disabled",
true)
1145 .prop(
"checked",
false);
1146 $(
"select[name=entity]")
1147 .prop(
"disabled",
false);
1149 $(
"input[name=superadmin]")
1150 .prop(
"disabled",
false);
1153 $(
"input[name=superadmin]").change(
function() {
1154 if ( $(
this).is(
":checked") ) {
1155 $(
"select[name=entity]")
1156 .prop(
"disabled",
true);
1158 $(
"select[name=entity]")
1159 .prop(
"disabled",
false);
1165 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1166 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1167 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1169 print "</td></tr>\n";
1173 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1175 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1176 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1180 $defaultemployee = '1
';
1182 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1183 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1184 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1188 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1190 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
');
1194 // Expense report validator
1195 if (isModEnabled('expensereport
')) {
1196 print '<tr><td
class=
"titlefieldcreate">
';
1197 $text = $langs->trans("ForceUserExpenseValidator");
1198 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1201 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
');
1206 // Holiday request validator
1207 if (isModEnabled('holiday
')) {
1208 print '<tr><td
class=
"titlefieldcreate">
';
1209 $text = $langs->trans("ForceUserHolidayValidator");
1210 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1213 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
');
1219 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1221 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1225 print '</
table><hr><
table class=
"border centpercent">
';
1229 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1231 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1235 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1240 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1243 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1244 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1246 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1247 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1249 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1250 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1251 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1252 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1255 $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">';
1256 if (!empty(
$conf->use_javascript_ajax)) {
1257 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1263 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1264 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1266 $valuetoshow = $hookmanager->resPrint;
1268 $valuetoshow .= $hookmanager->resPrint;
1274 if (isModEnabled(
'api')) {
1277 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1279 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">';
1280 if (!empty(
$conf->use_javascript_ajax)) {
1281 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1287 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1291 print
'</table><hr><table class="border centpercent">';
1295 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1296 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1298 print
'</textarea></td></tr>';
1301 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1302 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1306 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1307 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1311 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1312 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1313 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1315 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1321 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1322 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1323 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1328 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1330 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1331 if (!empty($ldap_phone)) {
1332 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1335 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1340 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1342 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1343 if (!empty($ldap_mobile)) {
1344 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1347 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1352 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1354 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1355 if (!empty($ldap_fax)) {
1356 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1359 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1364 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1366 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1367 if (!empty($ldap_mail)) {
1368 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1371 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1376 if (isModEnabled(
'socialnetworks')) {
1377 foreach ($socialnetworks as $key => $value) {
1378 if ($value[
'active']) {
1379 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1381 if (!empty($value[
'icon'])) {
1382 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1384 if (!empty($ldap_social[$key])) {
1385 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1386 print $ldap_social[$key];
1388 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1393 if (!empty($ldap_social[$key])) {
1394 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1396 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1403 if (isModEnabled(
'accounting')) {
1404 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1406 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1411 if (isModEnabled(
'agenda')) {
1412 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1414 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1419 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1420 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1421 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
1427 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1428 print
'<td class="maxwidthonsmartphone">'.
"\n";
1429 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');
1435 if (isModEnabled(
'multicompany') && is_object($mc)) {
1437 if (!method_exists($mc,
'formObjectOptions')) {
1438 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1439 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1440 print
"<td>".$mc->select_entities(
$conf->entity);
1441 print
"</td></tr>\n";
1443 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1449 $parameters = array();
1450 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1453 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1454 print
'<td class="wordbreak">';
1455 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1457 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1458 print $doleditor->Create(1);
1462 print
'<tr><td class="tdtop">';
1463 print $langs->trans(
"NotePublic");
1465 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1466 $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%');
1467 $doleditor->Create();
1468 print
"</td></tr>\n";
1471 print
'<tr><td class="tdtop">';
1472 print $langs->trans(
"NotePrivate");
1474 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1475 $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%');
1476 $doleditor->Create();
1477 print
"</td></tr>\n";
1479 print
'</table><hr><table class="border centpercent">';
1486 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1487 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1492 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1494 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1497 if ($permissiontoseesalary) {
1498 $langs->load(
"salaries");
1502 $text = $langs->trans(
"THM");
1503 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1506 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1512 $text = $langs->trans(
"TJM");
1513 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1516 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1521 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1523 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1529 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1531 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1536 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1538 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1542 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1547 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1549 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1557 print $form->buttonsSaveCancel(
"CreateUser");
1563 $res =
$object->fetch($id,
'',
'', 1);
1568 $res =
$object->fetch_optionals();
1578 $passDoNotExpire = 0;
1580 $userChangePassNextLogon = 0;
1584 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1586 $result = $ldap->connectBind();
1588 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1589 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1595 if (count($ldap->uacf) > 0) {
1596 foreach ($ldap->uacf as $key => $statut) {
1597 if ($key == 65536) {
1598 $passDoNotExpire = 1;
1599 $statutUACF = $statut;
1604 $statutUACF =
"ACCOUNTDISABLE";
1607 if ($ldap->pwdlastset == 0) {
1608 $userChangePassNextLogon = 1;
1614 if ($mode ==
'employee') {
1615 $title = $langs->trans(
"Employee");
1616 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1618 $title = $langs->trans(
"User");
1621 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1622 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1629 if ($action ==
'password') {
1630 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1634 if ($action ==
'passwordsend') {
1635 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1639 if ($action ==
'disable') {
1640 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1644 if ($action ==
'enable') {
1645 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1649 if ($action ==
'delete') {
1650 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1654 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1655 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1657 $formquestionclone = array(
1658 'text' => $langs->trans(
"ConfirmClone"),
1659 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1660 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1661 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1664 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1665 array_splice($formquestionclone, 2, 0, array($newElement));
1667 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);
1672 if ($action !=
'edit') {
1673 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1675 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.
$object->id.
'&output=file&file='.urlencode(
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')).
'" class="refid valignmiddle" rel="noopener">';
1676 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1677 $morehtmlref .=
'</a>';
1679 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1680 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1682 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1684 print
'<div class="fichecenter">';
1685 print
'<div class="fichehalfleft">';
1687 print
'<div class="underbanner clearboth"></div>';
1688 print
'<table class="border tableforfield centpercent">';
1691 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1693 print
'<td class="error">';
1694 print $langs->trans(
"LoginAccountDisableInDolibarr");
1699 if (property_exists(
$object,
'admin')) {
1700 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1701 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft valignmiddle"');
1702 } elseif (!empty(
$object->admin)) {
1703 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft valignmiddle"');
1713 $text = $langs->trans(
"Type");
1714 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1716 $type = $langs->trans(
"Internal");
1718 $type = $langs->trans(
"External");
1720 print
'<span class="badgeneutral">';
1723 print
' ('.$langs->trans(
"DomainUser").
')';
1726 print
'</td></tr>'.
"\n";
1729 if (
$object->ldap_sid && is_object($ldap)) {
1730 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1731 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1732 print
'</td></tr>'.
"\n";
1736 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1738 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1742 print
'</td></tr>'.
"\n";
1745 if ($nbofusers > 1) {
1747 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1749 if (empty(
$object->fk_user)) {
1750 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1752 $huser =
new User($db);
1754 $huser->fetch(
$object->fk_user);
1755 print $huser->getNomUrl(-1);
1757 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1764 if (isModEnabled(
'expensereport')) {
1766 $text = $langs->trans(
"ForceUserExpenseValidator");
1767 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1770 if (!empty(
$object->fk_user_expense_validator)) {
1771 $evuser =
new User($db);
1772 $evuser->fetch(
$object->fk_user_expense_validator);
1773 print $evuser->getNomUrl(-1);
1780 if (isModEnabled(
'holiday')) {
1782 $text = $langs->trans(
"ForceUserHolidayValidator");
1783 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1786 if (!empty(
$object->fk_user_holiday_validator)) {
1787 $hvuser =
new User($db);
1788 $hvuser->fetch(
$object->fk_user_holiday_validator);
1789 print $hvuser->getNomUrl(-1);
1797 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1798 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1802 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1809 if ($permissiontoseesalary) {
1810 $langs->load(
"salaries");
1813 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1815 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1821 $text = $langs->trans(
"THM");
1822 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1831 $text = $langs->trans(
"TJM");
1832 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1841 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1843 if (
$object->dateemployment) {
1844 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1847 if (
$object->dateemploymentend) {
1848 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1855 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1863 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1864 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1865 if (
$object->fk_warehouse > 0) {
1866 $warehousestatic =
new Entrepot($db);
1867 $warehousestatic->fetch(
$object->fk_warehouse);
1868 print $warehousestatic->getNomUrl(1);
1876 print
'<div class="fichehalfright">';
1878 print
'<div class="underbanner clearboth"></div>';
1880 print
'<table class="border tableforfield centpercent">';
1883 if (isModEnabled(
'agenda')) {
1884 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1886 print $formother->showColor(
$object->color,
'');
1892 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1893 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1895 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1901 $langs->load(
"languages");
1902 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1904 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1908 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1914 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1915 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1916 print
'<td>'.$object->openid.
'</td>';
1921 if (isModEnabled(
'multicompany') && is_object($mc)) {
1923 if (!method_exists($mc,
'formObjectOptions')) {
1924 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1925 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1927 print $langs->trans(
"AllEntities");
1929 $mc->getInfo(
$object->entity);
1932 print
"</td></tr>\n";
1938 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1941 if (isModEnabled(
"societe")) {
1942 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1947 $societe->fetch(
$object->socid);
1948 if ($societe->id > 0) {
1949 $s .= $societe->getNomUrl(1,
'');
1952 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1954 if (!empty(
$object->contact_id)) {
1956 $contact->fetch(
$object->contact_id);
1957 if ($contact->id > 0) {
1958 if (
$object->socid > 0 && $s) {
1963 $s .= $contact->getNomUrl(1,
'');
1972 if (isModEnabled(
'member')) {
1973 $langs->load(
"members");
1974 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1978 $adh->fetch(
$object->fk_member);
1979 $adh->ref = $adh->getFullname($langs);
1980 print $adh->getNomUrl(-1);
1982 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1989 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1991 print
"</td></tr>\n";
1999 print
'<div class="div-table-responsive-no-min">';
2000 print
'<table class="noborder tableforfield centpercent">';
2002 print
'<tr class="liste_titre"><th class="liste_titre">';
2003 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
2005 print
'<th class="liste_titre"></th>';
2009 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2011 if (
$object->datestartvalidity) {
2012 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2015 if (
$object->dateendvalidity) {
2016 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2023 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
2024 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2033 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2034 if (!empty(
$object->ldap_sid)) {
2035 if ($passDoNotExpire) {
2036 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2037 } elseif ($userChangePassNextLogon) {
2038 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2039 } elseif ($userDisabled) {
2040 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2042 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2045 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2048 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2049 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2070 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2071 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2073 $valuetoshow = $hookmanager->resPrint;
2075 $valuetoshow .= $hookmanager->resPrint;
2079 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2080 print
'<td class="wordbreak">';
2087 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2088 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2090 if (!empty(
$object->api_key)) {
2091 print
'<span class="opacitymedium">';
2097 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">'.
getDolUserInt(
'API_COUNT_CALL').
'</span>';
2103 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2105 if (
$object->datepreviouslogin) {
2106 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2109 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2118 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2119 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters,
$object, $action);
2121 print $hookmanager->resPrint;
2127 print
'<div class="clearboth"></div>';
2136 print
'<div class="tabsAction">';
2138 $parameters = array();
2139 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2140 if (empty($reshook)) {
2144 'class' =>
'classfortooltip'
2148 if (empty($user->socid)) {
2149 $canSendMail =
false;
2151 $langs->load(
"mails");
2152 $canSendMail =
true;
2153 unset($params[
'attr'][
'title']);
2155 $langs->load(
"mails");
2156 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2158 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2161 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2163 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2164 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2166 unset($params[
'attr'][
'title']);
2169 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2171 unset($params[
'attr'][
'title']);
2172 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2179 'class' =>
'classfortooltip'
2184 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2185 $cloneButtonId =
'';
2188 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2190 $cloneButtonId =
'action-clone';
2192 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2196 if (
$object->status == $object::STATUS_DISABLED) {
2197 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2198 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2199 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2201 unset($params[
'attr'][
'title']);
2202 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2205 if (
$object->status == $object::STATUS_DISABLED) {
2206 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2207 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2208 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2211 unset($params[
'attr'][
'title']);
2212 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2214 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2215 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2220 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2222 unset($params[
'attr'][
'title']);
2223 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2226 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2228 unset($params[
'attr'][
'title']);
2229 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2231 if ($user->id == $id) {
2232 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2233 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2237 if ($user->id != $id && $permissiontodisable &&
2239 if ($user->admin || !
$object->admin) {
2240 unset($params[
'attr'][
'title']);
2241 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2243 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2244 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2254 if (
GETPOST(
'modelselected')) {
2255 $action =
'presend';
2259 $modelmail =
'user';
2260 $defaulttopic =
'Information';
2261 $diroutput =
$conf->user->dir_output;
2262 $trackid =
'use'.$object->id;
2264 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2266 if ($action !=
'presend' && $action !=
'send') {
2271 if ($permissiontoreadgroup) {
2272 print
'<!-- Group section -->'.
"\n";
2280 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2282 if (!empty($groupslist)) {
2283 foreach ($groupslist as $groupforuser) {
2284 $exclude[] = $groupforuser->id;
2289 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2290 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2291 print $hookmanager->resPrint;
2293 if (empty($reshook)) {
2294 if ($permissiontoeditgroup) {
2295 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2296 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2297 print
'<input type="hidden" name="action" value="addgroup" />';
2298 print
'<input type="hidden" name="page_y" value="" />';
2301 print
'<!-- List of groups of the user -->'.
"\n";
2302 print
'<table class="noborder centpercent">'.
"\n";
2303 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2304 print
'<th class="liste_titre right">';
2305 if ($permissiontoeditgroup) {
2306 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2308 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2309 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2311 print
'</th></tr>'.
"\n";
2314 if (!empty($groupslist)) {
2315 foreach ($groupslist as $group) {
2316 print
'<tr class="oddeven">';
2317 print
'<td class="tdoverflowmax200">';
2318 if ($permissiontoeditgroup) {
2319 print $group->getNomUrl(1);
2321 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2324 print
'<td class="right">';
2325 if ($permissiontoeditgroup) {
2326 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2327 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2332 print
"</td></tr>\n";
2335 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2340 if ($permissiontoeditgroup) {
2352 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2353 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2354 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2355 print
'<input type="hidden" name="action" value="update">';
2356 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2360 print
'<table class="border centpercent">';
2364 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2372 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2373 if ($permissiontoedit && !
$object->ldap_sid) {
2374 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2375 } elseif (
$object->civility_code) {
2376 print $langs->trans(
"Civility".
$object->civility_code);
2382 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2384 if ($permissiontoedit && !
$object->ldap_sid) {
2385 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2387 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2394 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2396 if ($permissiontoedit && !
$object->ldap_sid) {
2397 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2399 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2405 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2407 if ($user->admin && !
$object->ldap_sid) {
2408 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2410 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2417 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2419 $langs->load(
"admin");
2421 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2422 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2426 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2427 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2433 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2434 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2437 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2439 if (isModEnabled(
'multicompany') && !$user->entity) {
2440 if (
$conf->use_javascript_ajax) {
2441 print
'<script type="text/javascript">
2443 var admin = $("select[name=admin]").val();
2445 $("input[name=superadmin]")
2446 .prop("disabled", true)
2447 .prop("checked", false);
2449 if ($("input[name=superadmin]").is(":checked")) {
2450 $("select[name=entity]")
2451 .prop("disabled", true);
2453 $("select[name=admin]").change(function() {
2454 if ( $(this).val() == 0 ) {
2455 $("input[name=superadmin]")
2456 .prop("disabled", true)
2457 .prop("checked", false);
2458 $("select[name=entity]")
2459 .prop("disabled", false);
2461 $("input[name=superadmin]")
2462 .prop("disabled", false);
2465 $("input[name=superadmin]").change(function() {
2466 if ( $(this).is(":checked")) {
2467 $("select[name=entity]")
2468 .prop("disabled", true);
2470 $("select[name=entity]")
2471 .prop("disabled", false);
2478 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2479 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2483 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2484 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2485 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2486 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2495 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2497 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2498 if ($permissiontoedit) {
2499 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2501 print $arraygender[
$object->gender];
2507 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2508 if ($permissiontoedit) {
2509 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2512 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2521 if ($nbofusers > 1) {
2523 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2525 if ($permissiontoedit) {
2526 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');
2528 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2529 $huser =
new User($db);
2530 $huser->fetch(
$object->fk_user);
2531 print $huser->getNomUrl(-1);
2537 if (isModEnabled(
'expensereport')) {
2538 print
'<tr><td class="titlefieldcreate">';
2539 $text = $langs->trans(
"ForceUserExpenseValidator");
2540 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2543 if ($permissiontoedit) {
2544 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');
2546 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2547 $evuser =
new User($db);
2548 $evuser->fetch(
$object->fk_user_expense_validator);
2549 print $evuser->getNomUrl(-1);
2556 if (isModEnabled(
'holiday')) {
2557 print
'<tr><td class="titlefieldcreate">';
2558 $text = $langs->trans(
"ForceUserHolidayValidator");
2559 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2562 if ($permissiontoedit) {
2563 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');
2565 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2566 $hvuser =
new User($db);
2567 $hvuser->fetch(
$object->fk_user_holiday_validator);
2568 print $hvuser->getNomUrl(-1);
2576 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2578 if ($user->id ==
$object->id || !$user->admin) {
2580 $type = $langs->trans(
"Internal");
2582 $type = $langs->trans(
"External");
2585 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2587 print
' ('.$langs->trans(
"DomainUser").
')';
2596 $eventsCompanyContact = array();
2597 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2599 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2600 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2601 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2602 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2604 print
' ('.$langs->trans(
"DomainUser").
')';
2607 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2608 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2609 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2610 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2612 print
' ('.$langs->trans(
"DomainUser").
')';
2615 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2616 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2617 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2618 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2620 print
' ('.$langs->trans(
"DomainUser").
')';
2623 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2624 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2625 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2626 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2635 print
'<table class="border centpercent">';
2638 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2640 if ($permissiontoedit) {
2641 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2647 if ($permissiontoedit) {
2648 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2656 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2659 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2660 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2662 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2663 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2665 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2666 if ($permissiontoeditpasswordandsee) {
2667 $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">';
2668 if (!empty(
$conf->use_javascript_ajax)) {
2669 $valuetoshow .=
img_picto((
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ? $langs->transnoentities(
'NoPasswordGenerationRuleConfigured') : $langs->transnoentities(
'Generate')),
'refresh',
'id="generate_password" class="paddingleft'.(
getDolGlobalString(
'USER_PASSWORD_GENERATED') ===
'none' ?
' opacitymedium' :
' linkobject').
'"');
2672 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2676 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2677 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2679 $valuetoshow = $hookmanager->resPrint;
2681 $valuetoshow .= $hookmanager->resPrint;
2685 print
"</td></tr>\n";
2688 if (isModEnabled(
'api')) {
2689 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2691 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2692 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2693 if (!empty(
$conf->use_javascript_ajax)) {
2694 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2701 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2702 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2704 if ($permissiontoedit) {
2705 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2707 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2713 print
'</table><hr><table class="border centpercent">';
2717 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2719 if ($permissiontoedit) {
2720 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2723 if ($permissiontoedit) {
2724 print
'</textarea>';
2729 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2730 if ($permissiontoedit) {
2731 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2738 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2739 if ($permissiontoedit) {
2740 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2747 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2748 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2749 if ($permissiontoedit) {
2750 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2752 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2756 print $countrylabel;
2762 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2763 if ($permissiontoedit) {
2764 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2765 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2773 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2775 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2776 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2777 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2779 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2785 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2787 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2788 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2789 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'">';
2791 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2797 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2799 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2800 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2801 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2803 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2809 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2811 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2812 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2813 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2815 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2820 if (isModEnabled(
'socialnetworks')) {
2821 foreach ($socialnetworks as $key => $value) {
2822 if ($value[
'active']) {
2823 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2825 if (!empty($value[
'icon'])) {
2826 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2828 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2829 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2831 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2832 print
$object->socialnetworks[$key];
2837 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2842 print
'</table><hr><table class="border centpercent">';
2846 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2847 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2848 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>';
2853 if (isModEnabled(
'accounting')) {
2855 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2857 if ($permissiontoedit) {
2858 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2860 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2861 print
$object->accountancy_code;
2868 if (isModEnabled(
'agenda')) {
2869 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2871 if ($permissiontoedit) {
2872 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2874 print $formother->showColor(
$object->color,
'');
2881 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2883 print $form->showphoto(
'userphoto',
$object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2888 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2889 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2891 if ($permissiontoedit) {
2892 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
2894 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2901 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";
2902 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2908 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2910 print
$object->getLibStatut(4);
2937 if (isModEnabled(
'member')) {
2938 $langs->load(
"members");
2939 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2943 $adh->fetch(
$object->fk_member);
2944 $adh->ref = $adh->login;
2945 print $adh->getNomUrl(1);
2947 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2955 if (isModEnabled(
'multicompany') && is_object($mc)) {
2957 if (!method_exists($mc,
'formObjectOptions')) {
2958 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2959 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2960 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
2961 print
"</td></tr>\n";
2963 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2969 $parameters = array(
'colspan' =>
' colspan="2"');
2971 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2972 print $hookmanager->resPrint;
2973 if (empty($reshook)) {
2974 if ($permissiontoedit) {
2975 print
$object->showOptionals($extrafields,
'edit');
2977 print
$object->showOptionals($extrafields,
'view');
2982 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2984 if ($permissiontoedit) {
2985 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2987 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2988 print $doleditor->Create(1);
3000 print
'<table class="border centpercent">';
3006 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3008 if ($permissiontoedit) {
3009 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3011 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3017 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3019 if ($permissiontoedit) {
3020 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3028 if ($permissiontoseesalary) {
3029 $langs->load(
"salaries");
3032 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3034 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3040 $text = $langs->trans(
"THM");
3041 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3044 if ($permissiontoedit) {
3045 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3054 $text = $langs->trans(
"TJM");
3055 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3058 if ($permissiontoedit) {
3059 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3068 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3070 if ($permissiontoedit) {
3071 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3076 if ($dateemployment && $dateemploymentend) {
3080 if ($permissiontoedit) {
3081 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3089 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3091 if ($permissiontoedit) {
3092 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3103 print
'<div class="center">';
3104 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3105 print
' ';
3106 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3112 if ($action !=
'edit' && $action !=
'presend') {
3113 print
'<div class="fichecenter"><div class="fichehalfleft">';
3118 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3119 $genallowed = $user->hasRight(
"user",
"user",
"read");
3120 $delallowed = $user->hasRight(
"user",
"user",
"write");
3125 $societe->fetch(
$object->socid);
3130 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);
3131 $somethingshown = $formfile->numoffiles;
3134 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3135 $linktoelem = $tmparray[
'linktoelem'];
3136 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3137 print $htmltoenteralink;
3139 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3143 $morehtmlcenter =
'<div class="nowraponall">';
3144 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3145 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3146 $morehtmlcenter .=
'</div>';
3148 print
'</div><div class="fichehalfright">';
3151 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3153 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3155 print
'</div></div>';
3158 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3165include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3167if (isModEnabled(
'api')) {
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
dol_print_email($email, $cid=0, $socid=0, $addlink=0, $max=64, $showinvalid=1, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($object, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.