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';
259 if (
$object->admin && empty($user->admin)) {
262 setEventMessages($langs->trans(
"OnlyAdminUsersCanDeleteAdminUsers"),
null,
'errors');
266 $result =
$object->delete($user);
268 $langs->load(
"errors");
272 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
280 if ($action ==
'add' && $permissiontoadd) {
294 if (!empty(
$conf->file->main_limit_users)) {
295 $nb =
$object->getNbOfUsers(
"active");
296 if ($nb >=
$conf->file->main_limit_users) {
298 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
308 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
322 if (isModEnabled(
'socialnetworks')) {
323 $object->socialnetworks = array();
324 foreach ($socialnetworks as $key => $value) {
325 if (
GETPOST($key,
'alphanohtml')) {
331 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
338 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
340 $langs->load(
"errors");
341 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
344 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
354 if ($permissiontoseesalary) {
361 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
362 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
367 $object->dateemployment = $dateemployment;
368 $object->dateemploymentend = $dateemploymentend;
369 $object->datestartvalidity = $datestartvalidity;
370 $object->dateendvalidity = $dateendvalidity;
378 $ret = $extrafields->setOptionalsFromPost(
null,
$object);
385 if (isModEnabled(
'multicompany')) {
392 $object->entity = ($entity ==
'' ? 1 : $entity);
396 $object->entity = ($entity ==
'' ? 1 : $entity);
407 if (
GETPOST(
'password',
'password')) {
408 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
410 if (is_int($resPass) && $resPass < 0) {
411 $langs->load(
"errors");
416 if (isModEnabled(
"category")) {
418 $usercats =
GETPOST(
'usercats',
'array');
419 $object->setCategories($usercats);
423 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
427 $langs->load(
"errors");
436 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
439 $editgroup->fetch($group);
440 $editgroup->oldcopy = clone $editgroup;
444 if ($action ==
'addgroup') {
445 $result =
$object->SetInGroup($group, $editgroup->entity);
447 if ($action ==
'removegroup') {
448 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
459 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
460 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
462 if ($permissiontoedit) {
465 if (!
GETPOST(
"lastname",
'alpha')) {
470 if (!
GETPOST(
"login",
'alpha')) {
487 if (GETPOSTISSET(
"ref_employee")) {
491 if (GETPOSTISSET(
"national_registration_number")) {
492 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
495 if ($permissiontoeditpasswordandsee) {
498 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
501 if (!empty($user->admin) && $user->id != $id) {
506 if ($user->admin && !
$object->ldap_sid) {
518 if (isModEnabled(
'socialnetworks')) {
519 $object->socialnetworks = array();
520 foreach ($socialnetworks as $key => $value) {
521 if (
GETPOST($key,
'alphanohtml')) {
527 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
534 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
536 $langs->load(
"errors");
537 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
540 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
548 if ($permissiontoseesalary) {
555 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
557 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
562 $object->dateemployment = $dateemployment;
563 $object->dateemploymentend = $dateemploymentend;
564 $object->datestartvalidity = $datestartvalidity;
565 $object->dateendvalidity = $dateendvalidity;
568 if (isModEnabled(
'stock')) {
575 if (isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
589 $ret = $extrafields->setOptionalsFromPost(
null,
$object,
'@GETPOSTISSET');
597 if (!empty($_FILES[
'photo'][
'name'])) {
601 if (
$object->id == $user->id) {
606 $langs->load(
"errors");
608 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
613 $passwordismodified = 0;
616 $passwordismodified = 1;
623 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
624 $langs->load(
"errors");
625 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
633 if (!$error && GETPOSTISSET(
'contactid')) {
637 if ($contactid > 0) {
639 $contact->fetch($contactid);
641 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
642 $sql .=
" SET fk_socpeople=".((int) $contactid);
643 if (!empty($contact->socid)) {
644 $sql .=
", fk_soc=".((int) $contact->socid);
645 } elseif ($socid > 0) {
646 $sql .=
", fk_soc = null";
647 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
649 $sql .=
" WHERE rowid = ".((int)
$object->id);
650 } elseif ($socid > 0) {
651 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
652 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
653 $sql .=
" WHERE rowid = ".((int)
$object->id);
655 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
656 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
657 $sql .=
" WHERE rowid = ".((int)
$object->id);
660 $resql = $db->query($sql);
667 if (!$error && !count(
$object->errors)) {
676 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
684 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
687 if (!is_numeric($result) || $result <= 0) {
695 $langs->load(
"errors");
696 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
701 if (!$error && !count(
$object->errors)) {
703 $categories =
GETPOST(
'usercats',
'array');
704 $object->setCategories($categories);
707 if (!$error && !count(
$object->errors)) {
711 $login = $_SESSION[
"dol_login"];
714 $langs->load(
"errors");
715 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
717 if ($passwordismodified &&
$object->login == $user->login) {
719 $langs->load(
"errors");
720 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
721 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
729 if ($permissiontoeditpasswordandsee) {
730 dol_syslog(
"Not allowed to change fields, only password");
734 if (
GETPOST(
"password",
"password")) {
737 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
738 if (is_int($ret) && $ret < 0) {
747 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
748 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
752 $newpassword =
$object->setPassword($user,
'');
753 if (is_int($newpassword) && $newpassword < 0) {
755 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
758 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
759 if (
$object->send_password($user, $newpassword) > 0) {
765 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
771 if ($action ==
'adduserldap' && $permissiontoadd) {
772 $selecteduser =
GETPOST(
'users');
774 $required_fields = array(
790 if (isModEnabled(
'socialnetworks')) {
791 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
792 foreach ($arrayofsocialnetworks as $socialnetwork) {
798 $result = $ldap->connectBind();
801 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
806 if (is_array($ldapusers)) {
807 foreach ($ldapusers as $key => $attribute) {
819 $ldap_social = array();
821 if (isModEnabled(
'socialnetworks')) {
822 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
823 foreach ($arrayofsocialnetworks as $socialnetwork) {
824 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
834 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
837 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
841 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
849 $clone->api_key =
'';
851 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
852 $clone->firstname = $parts[0];
853 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
855 $clone->login = substr($parts[0], 0, 1).$parts[1];
858 $clone->context[
'createfromclone'] =
'createfromclone';
859 $id = $clone->create($user);
860 $refalreadyexists = 0;
863 $result = $clone->cloneRights(
$object->id, $id);
866 if (
GETPOST(
'clone_categories')) {
867 $result = $clone->cloneCategories(
$object->id, $id);
875 if ($clone->error ==
'ErrorProductAlreadyExists') {
879 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
880 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
883 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
887 unset($clone->context[
'createfromclone']);
894 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
905 $triggersendname =
'USER_SENTBYMAIL';
907 $mode =
'emailfromuser';
908 $trackid =
'use'.$id;
909 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
912 $upload_dir =
$conf->user->dir_output;
913 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
921$form =
new Form($db);
927if (isModEnabled(
'stock')) {
933$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
934$resql = $db->query($sql);
936 $obj = $db->fetch_object($resql);
938 $nbofusers = $obj->nb;
946 $title = $person_name.
" - ".$langs->trans(
'Card');
949 $title = $langs->trans(
"NewEmployee");
951 $title = $langs->trans(
"NewUser");
957llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
959if ($action ==
'create' || $action ==
'adduserldap') {
962 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
966 if (isModEnabled(
'ldap') && (
getDolGlobalInt(
'LDAP_SYNCHRO_ACTIVE') === Ldap::SYNCHRO_LDAP_TO_DOLIBARR)) {
971 $result = $ldap->connectBind();
973 $required_fields = array(
993 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
998 if (is_array($ldapusers)) {
999 foreach ($ldapusers as $key => $ldapuser) {
1002 foreach ($required_fields as $value) {
1004 $label .= $value.
"=******* ";
1006 $label .= $value.
"=".$ldapuser[$value].
" ";
1009 $liste[$key] = $label;
1019 print
"\n\n<!-- Form liste LDAP debut -->\n";
1021 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1022 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1023 print
'<table class="border centpercent"><tr>';
1024 print
'<td width="160">';
1025 print $langs->trans(
"LDAPUsers");
1028 print
'<input type="hidden" name="action" value="adduserldap">';
1029 if (is_array($liste) && count($liste)) {
1030 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1033 print
'</td><td class="center">';
1034 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1035 print
'</td></tr></table>';
1038 print
"\n<!-- Form liste LDAP fin -->\n\n";
1043 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1044 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1045 print
'<input type="hidden" name="action" value="add">';
1046 if (!empty($ldap_sid)) {
1047 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1049 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1055 print
'<table class="border centpercent">';
1058 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1059 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1064 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1066 if (!empty($ldap_lastname)) {
1067 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1068 print $ldap_lastname;
1070 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1075 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1077 if (!empty($ldap_firstname)) {
1078 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1079 print $ldap_firstname;
1081 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1086 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1088 if (!empty($ldap_login)) {
1089 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1091 } elseif (!empty($ldap_loginsmb)) {
1092 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1093 print $ldap_loginsmb;
1095 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
1099 if (!empty(
$conf->use_javascript_ajax)) {
1103 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1104 if ($charforseparator ==
'none') {
1105 $charforseparator =
'';
1108 jQuery(document).ready(function() {
1109 $(".createloginauto").on("keyup", function() {
1110 console.log(".createloginauto change: We generate login when we have a lastname");
1112 lastname = $("#lastname").val().toLowerCase();
1115 print
' firstname = $("#firstname").val().toLowerCase()[0];';
1117 print
' firstname = $("#firstname").val().toLowerCase();';
1123 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1127 $(
"#login").val(login);
1133 $generated_password = '';
1134 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1135 $generated_password = getRandomPassword(false);
1137 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1140 if (!empty($user->admin)) {
1141 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'star
').'</td>
';
1143 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1145 if (isModEnabled('multicompany
') && !$user->entity) {
1146 if (!empty($conf->use_javascript_ajax)) {
1147 print '<script
type=
"text/javascript">
1149 $(
"select[name=admin]").change(
function() {
1150 if ( $(
this).val() == 0 ) {
1151 $(
"input[name=superadmin]")
1152 .prop(
"disabled",
true)
1153 .prop(
"checked",
false);
1154 $(
"select[name=entity]")
1155 .prop(
"disabled",
false);
1157 $(
"input[name=superadmin]")
1158 .prop(
"disabled",
false);
1161 $(
"input[name=superadmin]").change(
function() {
1162 if ( $(
this).is(
":checked") ) {
1163 $(
"select[name=entity]")
1164 .prop(
"disabled",
true);
1166 $(
"select[name=entity]")
1167 .prop(
"disabled",
false);
1173 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1174 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1175 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1177 print "</td></tr>\n";
1181 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1183 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1184 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1188 $defaultemployee = '1
';
1190 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1191 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1192 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1196 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1198 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
');
1202 // Expense report validator
1203 if (isModEnabled('expensereport
')) {
1204 print '<tr><td
class=
"titlefieldcreate">
';
1205 $text = $langs->trans("ForceUserExpenseValidator");
1206 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1209 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
');
1214 // Holiday request validator
1215 if (isModEnabled('holiday
')) {
1216 print '<tr><td
class=
"titlefieldcreate">
';
1217 $text = $langs->trans("ForceUserHolidayValidator");
1218 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1221 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
');
1227 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1229 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1233 print '</
table><hr><
table class=
"border centpercent">
';
1237 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1239 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1243 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1248 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1251 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1252 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1254 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1255 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1257 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1258 if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read
1259 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1260 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1263 $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">';
1264 if (!empty(
$conf->use_javascript_ajax)) {
1265 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1271 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1272 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
1274 $valuetoshow = $hookmanager->resPrint;
1276 $valuetoshow .= $hookmanager->resPrint;
1282 if (isModEnabled(
'api')) {
1285 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1287 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">';
1288 if (!empty(
$conf->use_javascript_ajax)) {
1289 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1295 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1299 print
'</table><hr><table class="border centpercent">';
1303 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
1304 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1306 print
'</textarea></td></tr>';
1309 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
1310 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1314 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
1315 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1319 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1320 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1321 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1323 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1329 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td class="maxwidthonsmartphone">';
1330 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1331 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1336 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1338 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1339 if (!empty($ldap_phone)) {
1340 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1343 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1348 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1350 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1351 if (!empty($ldap_mobile)) {
1352 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1355 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1360 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1362 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1363 if (!empty($ldap_fax)) {
1364 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1367 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1372 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1374 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1375 if (!empty($ldap_mail)) {
1376 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1379 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1384 if (isModEnabled(
'socialnetworks')) {
1385 foreach ($socialnetworks as $key => $value) {
1386 if ($value[
'active']) {
1387 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1389 if (!empty($value[
'icon'])) {
1390 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1392 if (!empty($ldap_social[$key])) {
1393 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1394 print $ldap_social[$key];
1396 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1401 if (!empty($ldap_social[$key])) {
1402 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1404 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1411 if (isModEnabled(
'accounting')) {
1412 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1414 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1419 if (isModEnabled(
'agenda')) {
1420 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1422 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1427 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1428 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td><td>';
1429 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
1435 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'',
$object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1436 print
'<td class="maxwidthonsmartphone">'.
"\n";
1437 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');
1443 if (isModEnabled(
'multicompany') && is_object($mc)) {
1445 if (!method_exists($mc,
'formObjectOptions')) {
1446 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1447 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1448 print
"<td>".$mc->select_entities(
$conf->entity);
1449 print
"</td></tr>\n";
1451 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1457 $parameters = array();
1458 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1461 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1462 print
'<td class="wordbreak">';
1463 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1465 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1466 print $doleditor->Create(1);
1470 print
'<tr><td class="tdtop">';
1471 print $langs->trans(
"NotePublic");
1473 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1474 $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%');
1475 $doleditor->Create();
1476 print
"</td></tr>\n";
1479 print
'<tr><td class="tdtop">';
1480 print $langs->trans(
"NotePrivate");
1482 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1483 $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%');
1484 $doleditor->Create();
1485 print
"</td></tr>\n";
1487 print
'</table><hr><table class="border centpercent">';
1494 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1495 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1500 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1502 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1505 if ($permissiontoseesalary) {
1506 $langs->load(
"salaries");
1510 $text = $langs->trans(
"THM");
1511 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1514 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1520 $text = $langs->trans(
"TJM");
1521 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1524 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1529 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1531 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol(
$conf->currency);
1537 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1539 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1544 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1546 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1550 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1555 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1557 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1565 print $form->buttonsSaveCancel(
"CreateUser");
1571 $res =
$object->fetch($id,
'',
'', 1);
1576 $res =
$object->fetch_optionals();
1586 $passDoNotExpire = 0;
1588 $userChangePassNextLogon = 0;
1592 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
1594 $result = $ldap->connectBind();
1596 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1597 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1603 if (count($ldap->uacf) > 0) {
1604 foreach ($ldap->uacf as $key => $statut) {
1605 if ($key == 65536) {
1606 $passDoNotExpire = 1;
1607 $statutUACF = $statut;
1612 $statutUACF =
"ACCOUNTDISABLE";
1615 if ($ldap->pwdlastset == 0) {
1616 $userChangePassNextLogon = 1;
1622 if ($mode ==
'employee') {
1623 $title = $langs->trans(
"Employee");
1624 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1626 $title = $langs->trans(
"User");
1629 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1630 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1637 if ($action ==
'password') {
1638 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1642 if ($action ==
'passwordsend') {
1643 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1647 if ($action ==
'disable') {
1648 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1652 if ($action ==
'enable') {
1653 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1657 if ($action ==
'delete') {
1658 print $form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1662 if (($action ==
'clone' && (empty(
$conf->use_javascript_ajax) || !empty(
$conf->dol_use_jmobile)))
1663 || (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile))) {
1665 $formquestionclone = array(
1666 'text' => $langs->trans(
"ConfirmClone"),
1667 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1668 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1669 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1672 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1673 array_splice($formquestionclone, 2, 0, array($newElement));
1675 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);
1680 if ($action !=
'edit') {
1681 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1683 $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">';
1684 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1685 $morehtmlref .=
'</a>';
1687 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1688 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'valignmiddle nohover');
1690 dol_banner_tab(
$object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1692 print
'<div class="fichecenter">';
1693 print
'<div class="fichehalfleft">';
1695 print
'<div class="underbanner clearboth"></div>';
1696 print
'<table class="border tableforfield centpercent">';
1699 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1701 print
'<td class="error">';
1702 print $langs->trans(
"LoginAccountDisableInDolibarr");
1707 if (property_exists(
$object,
'admin')) {
1708 if (isModEnabled(
'multicompany') && !empty(
$object->admin) && empty(
$object->entity)) {
1709 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft valignmiddle"');
1710 } elseif (!empty(
$object->admin)) {
1711 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft valignmiddle"');
1721 $text = $langs->trans(
"Type");
1722 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1724 $type = $langs->trans(
"Internal");
1726 $type = $langs->trans(
"External");
1728 print
'<span class="badgeneutral">';
1731 print
' ('.$langs->trans(
"DomainUser").
')';
1734 print
'</td></tr>'.
"\n";
1737 if (
$object->ldap_sid && is_object($ldap)) {
1738 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1739 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1740 print
'</td></tr>'.
"\n";
1744 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1746 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1750 print
'</td></tr>'.
"\n";
1753 if ($nbofusers > 1) {
1755 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1757 if (empty(
$object->fk_user)) {
1758 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1760 $huser =
new User($db);
1762 $huser->fetch(
$object->fk_user);
1763 print $huser->getNomUrl(-1);
1765 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1772 if (isModEnabled(
'expensereport')) {
1774 $text = $langs->trans(
"ForceUserExpenseValidator");
1775 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1778 if (!empty(
$object->fk_user_expense_validator)) {
1779 $evuser =
new User($db);
1780 $evuser->fetch(
$object->fk_user_expense_validator);
1781 print $evuser->getNomUrl(-1);
1788 if (isModEnabled(
'holiday')) {
1790 $text = $langs->trans(
"ForceUserHolidayValidator");
1791 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1794 if (!empty(
$object->fk_user_holiday_validator)) {
1795 $hvuser =
new User($db);
1796 $hvuser->fetch(
$object->fk_user_holiday_validator);
1797 print $hvuser->getNomUrl(-1);
1805 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1806 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1810 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1817 if ($permissiontoseesalary) {
1818 $langs->load(
"salaries");
1821 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1823 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1,
$conf->currency) :
'').
'</span>';
1829 $text = $langs->trans(
"THM");
1830 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1839 $text = $langs->trans(
"TJM");
1840 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1849 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1851 if (
$object->dateemployment) {
1852 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1855 if (
$object->dateemploymentend) {
1856 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1863 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1871 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1872 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1873 if (
$object->fk_warehouse > 0) {
1874 $warehousestatic =
new Entrepot($db);
1875 $warehousestatic->fetch(
$object->fk_warehouse);
1876 print $warehousestatic->getNomUrl(1);
1884 print
'<div class="fichehalfright">';
1886 print
'<div class="underbanner clearboth"></div>';
1888 print
'<table class="border tableforfield centpercent">';
1891 if (isModEnabled(
'agenda')) {
1892 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"ColorUser").
'</td>';
1894 print $formother->showColor(
$object->color,
'');
1900 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1901 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1903 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1909 $langs->load(
"languages");
1910 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1912 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1916 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1922 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1923 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1924 print
'<td>'.$object->openid.
'</td>';
1929 if (isModEnabled(
'multicompany') && is_object($mc)) {
1931 if (!method_exists($mc,
'formObjectOptions')) {
1932 if (isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$conf->entity == 1 && $user->admin && !$user->entity) {
1933 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1935 print $langs->trans(
"AllEntities");
1937 $mc->getInfo(
$object->entity);
1940 print
"</td></tr>\n";
1946 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1949 if (isModEnabled(
"societe")) {
1950 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1955 $societe->fetch(
$object->socid);
1956 if ($societe->id > 0) {
1957 $s .= $societe->getNomUrl(1,
'');
1960 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1962 if (!empty(
$object->contact_id)) {
1964 $contact->fetch(
$object->contact_id);
1965 if ($contact->id > 0) {
1966 if (
$object->socid > 0 && $s) {
1971 $s .= $contact->getNomUrl(1,
'');
1980 if (isModEnabled(
'member')) {
1981 $langs->load(
"members");
1982 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1986 $adh->fetch(
$object->fk_member);
1987 $adh->ref = $adh->getFullname($langs);
1988 print $adh->getNomUrl(-1);
1990 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1997 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1999 print
"</td></tr>\n";
2007 print
'<div class="div-table-responsive-no-min">';
2008 print
'<table class="noborder tableforfield centpercent">';
2010 print
'<tr class="liste_titre"><th class="liste_titre">';
2011 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Security");
2013 print
'<th class="liste_titre"></th>';
2017 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2019 if (
$object->datestartvalidity) {
2020 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2023 if (
$object->dateendvalidity) {
2024 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2031 if (!empty(
$object->email_oauth2) && preg_match(
'/googleoauth/', $dolibarr_main_authentication)) {
2032 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2041 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2042 if (!empty(
$object->ldap_sid)) {
2043 if ($passDoNotExpire) {
2044 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2045 } elseif ($userChangePassNextLogon) {
2046 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2047 } elseif ($userDisabled) {
2048 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2050 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2053 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2056 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2057 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2078 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2079 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2081 $valuetoshow = $hookmanager->resPrint;
2083 $valuetoshow .= $hookmanager->resPrint;
2087 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2088 print
'<td class="wordbreak">';
2095 if (isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2096 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2098 if (!empty(
$object->api_key)) {
2099 print
'<span class="opacitymedium">';
2105 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">'.
getDolUserInt(
'API_COUNT_CALL').
'</span>';
2111 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2113 if (
$object->datepreviouslogin) {
2114 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2117 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2126 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2127 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters,
$object, $action);
2129 print $hookmanager->resPrint;
2135 print
'<div class="clearboth"></div>';
2144 print
'<div class="tabsAction">';
2146 $parameters = array();
2147 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters,
$object, $action);
2148 if (empty($reshook)) {
2152 'class' =>
'classfortooltip'
2156 if (empty($user->socid)) {
2157 $canSendMail =
false;
2159 $langs->load(
"mails");
2160 $canSendMail =
true;
2161 unset($params[
'attr'][
'title']);
2163 $langs->load(
"mails");
2164 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2166 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
2169 if ($permissiontoedit && (!isModEnabled(
'multicompany') || !$user->entity || (
$object->entity ==
$conf->entity) || (
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') &&
$object->entity == 1))) {
2171 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2172 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2174 unset($params[
'attr'][
'title']);
2177 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2179 unset($params[
'attr'][
'title']);
2180 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=edit',
'',
true, $params);
2187 'class' =>
'classfortooltip'
2192 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2193 $cloneButtonId =
'';
2196 if (!empty(
$conf->use_javascript_ajax) && empty(
$conf->dol_use_jmobile)) {
2198 $cloneButtonId =
'action-clone';
2200 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2204 if (
$object->status == $object::STATUS_DISABLED) {
2205 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2206 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2207 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2209 unset($params[
'attr'][
'title']);
2210 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2213 if (
$object->status == $object::STATUS_DISABLED) {
2214 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2215 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2216 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2219 unset($params[
'attr'][
'title']);
2220 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2222 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2223 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2228 if ($user->id != $id && $permissiontodisable &&
$object->statut == 0 &&
2230 unset($params[
'attr'][
'title']);
2231 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2234 if ($user->id != $id && $permissiontodisable &&
$object->statut == 1 &&
2236 unset($params[
'attr'][
'title']);
2237 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2239 if ($user->id == $id) {
2240 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2241 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2245 if ($user->id != $id && $permissiontodisable &&
2247 if ($user->admin || !
$object->admin) {
2248 unset($params[
'attr'][
'title']);
2249 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2251 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2252 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2262 if (
GETPOST(
'modelselected')) {
2263 $action =
'presend';
2267 $modelmail =
'user';
2268 $defaulttopic =
'Information';
2269 $diroutput =
$conf->user->dir_output;
2270 $trackid =
'use'.$object->id;
2272 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2274 if ($action !=
'presend' && $action !=
'send') {
2279 if ($permissiontoreadgroup) {
2280 print
'<!-- Group section -->'.
"\n";
2288 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2290 if (!empty($groupslist)) {
2291 foreach ($groupslist as $groupforuser) {
2292 $exclude[] = $groupforuser->id;
2297 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2298 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters,
$object, $action);
2299 print $hookmanager->resPrint;
2301 if (empty($reshook)) {
2302 if ($permissiontoeditgroup) {
2303 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2304 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2305 print
'<input type="hidden" name="action" value="addgroup" />';
2306 print
'<input type="hidden" name="page_y" value="" />';
2309 print
'<!-- List of groups of the user -->'.
"\n";
2310 print
'<table class="noborder centpercent">'.
"\n";
2311 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2312 print
'<th class="liste_titre right">';
2313 if ($permissiontoeditgroup) {
2314 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2316 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2317 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2319 print
'</th></tr>'.
"\n";
2322 if (!empty($groupslist)) {
2323 foreach ($groupslist as $group) {
2324 print
'<tr class="oddeven">';
2325 print
'<td class="tdoverflowmax200">';
2326 if ($permissiontoeditgroup) {
2327 print $group->getNomUrl(1);
2329 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2332 print
'<td class="right">';
2333 if ($permissiontoeditgroup) {
2334 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2335 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2340 print
"</td></tr>\n";
2343 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2348 if ($permissiontoeditgroup) {
2360 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2361 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2362 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2363 print
'<input type="hidden" name="action" value="update">';
2364 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2368 print
'<table class="border centpercent">';
2372 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2380 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2381 if ($permissiontoedit && !
$object->ldap_sid) {
2382 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2383 } elseif (
$object->civility_code) {
2384 print $langs->trans(
"Civility".
$object->civility_code);
2390 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2392 if ($permissiontoedit && !
$object->ldap_sid) {
2393 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2395 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2402 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2404 if ($permissiontoedit && !
$object->ldap_sid) {
2405 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2407 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2413 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2415 if ($user->admin && !
$object->ldap_sid) {
2416 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2418 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2425 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2427 $langs->load(
"admin");
2429 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2430 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2434 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2435 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2441 (!isModEnabled(
'multicompany') && $nbAdmin >= 1)
2442 || (isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2445 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2447 if (isModEnabled(
'multicompany') && !$user->entity) {
2448 if (
$conf->use_javascript_ajax) {
2449 print
'<script type="text/javascript">
2451 var admin = $("select[name=admin]").val();
2453 $("input[name=superadmin]")
2454 .prop("disabled", true)
2455 .prop("checked", false);
2457 if ($("input[name=superadmin]").is(":checked")) {
2458 $("select[name=entity]")
2459 .prop("disabled", true);
2461 $("select[name=admin]").change(function() {
2462 if ( $(this).val() == 0 ) {
2463 $("input[name=superadmin]")
2464 .prop("disabled", true)
2465 .prop("checked", false);
2466 $("select[name=entity]")
2467 .prop("disabled", false);
2469 $("input[name=superadmin]")
2470 .prop("disabled", false);
2473 $("input[name=superadmin]").change(function() {
2474 if ( $(this).is(":checked")) {
2475 $("select[name=entity]")
2476 .prop("disabled", true);
2478 $("select[name=entity]")
2479 .prop("disabled", false);
2486 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2487 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2491 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2492 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2493 if (isModEnabled(
'multicompany') && empty(
$object->entity)) {
2494 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2503 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2505 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2506 if ($permissiontoedit) {
2507 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2509 print $arraygender[
$object->gender];
2515 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'',
$object, 0).
'</td><td>';
2516 if ($permissiontoedit) {
2517 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2520 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2529 if ($nbofusers > 1) {
2531 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2533 if ($permissiontoedit) {
2534 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');
2536 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2537 $huser =
new User($db);
2538 $huser->fetch(
$object->fk_user);
2539 print $huser->getNomUrl(-1);
2545 if (isModEnabled(
'expensereport')) {
2546 print
'<tr><td class="titlefieldcreate">';
2547 $text = $langs->trans(
"ForceUserExpenseValidator");
2548 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2551 if ($permissiontoedit) {
2552 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');
2554 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2555 $evuser =
new User($db);
2556 $evuser->fetch(
$object->fk_user_expense_validator);
2557 print $evuser->getNomUrl(-1);
2564 if (isModEnabled(
'holiday')) {
2565 print
'<tr><td class="titlefieldcreate">';
2566 $text = $langs->trans(
"ForceUserHolidayValidator");
2567 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2570 if ($permissiontoedit) {
2571 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');
2573 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2574 $hvuser =
new User($db);
2575 $hvuser->fetch(
$object->fk_user_holiday_validator);
2576 print $hvuser->getNomUrl(-1);
2584 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2586 if ($user->id ==
$object->id || !$user->admin) {
2588 $type = $langs->trans(
"Internal");
2590 $type = $langs->trans(
"External");
2593 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2595 print
' ('.$langs->trans(
"DomainUser").
')';
2604 $eventsCompanyContact = array();
2605 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
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, 0,
'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(
$object->socid,
'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,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2628 print
' ('.$langs->trans(
"DomainUser").
')';
2631 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2632 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'maxwidth300');
2633 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2634 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2643 print
'<table class="border centpercent">';
2646 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2648 if ($permissiontoedit) {
2649 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2655 if ($permissiontoedit) {
2656 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2664 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2667 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2668 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2670 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2671 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2673 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2674 if ($permissiontoeditpasswordandsee) {
2675 $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">';
2676 if (!empty(
$conf->use_javascript_ajax)) {
2677 $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').
'"');
2680 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2684 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2685 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters,
$object, $action);
2687 $valuetoshow = $hookmanager->resPrint;
2689 $valuetoshow .= $hookmanager->resPrint;
2693 print
"</td></tr>\n";
2696 if (isModEnabled(
'api')) {
2697 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2699 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2700 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2701 if (!empty(
$conf->use_javascript_ajax)) {
2702 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2709 if (isset(
$conf->file->main_authentication) && preg_match(
'/openid/',
$conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2710 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2712 if ($permissiontoedit) {
2713 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2715 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2721 print
'</table><hr><table class="border centpercent">';
2725 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'',
$object, 0).
'</td>';
2727 if ($permissiontoedit) {
2728 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2731 if ($permissiontoedit) {
2732 print
'</textarea>';
2737 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'',
$object, 0).
'</td><td>';
2738 if ($permissiontoedit) {
2739 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2746 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'',
$object, 0).
'</td><td>';
2747 if ($permissiontoedit) {
2748 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2755 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'',
$object, 0).
'</td><td>';
2756 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2757 if ($permissiontoedit) {
2758 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2760 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2764 print $countrylabel;
2770 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'',
$object, 0).
'</td><td>';
2771 if ($permissiontoedit) {
2772 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2773 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2781 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2783 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2784 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2785 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2787 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2793 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2795 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2796 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2797 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'">';
2799 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2805 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2807 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2808 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2809 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2811 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2817 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2819 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2820 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2821 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2823 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2828 if (isModEnabled(
'socialnetworks')) {
2829 foreach ($socialnetworks as $key => $value) {
2830 if ($value[
'active']) {
2831 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2833 if (!empty($value[
'icon'])) {
2834 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2836 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2837 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2839 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2840 print
$object->socialnetworks[$key];
2845 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2850 print
'</table><hr><table class="border centpercent">';
2854 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2855 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2856 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>';
2861 if (isModEnabled(
'accounting')) {
2863 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2865 if ($permissiontoedit) {
2866 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2868 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2869 print
$object->accountancy_code;
2876 if (isModEnabled(
'agenda')) {
2877 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2879 if ($permissiontoedit) {
2880 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2882 print $formother->showColor(
$object->color,
'');
2889 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2891 print $form->showphoto(
'userphoto',
$object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2896 if (isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2897 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'',
$object, 0).
'</td>';
2899 if ($permissiontoedit) {
2900 print $form->selectCategories(Categorie::TYPE_USER,
'usercats',
$object);
2902 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2909 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";
2910 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2916 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2918 print
$object->getLibStatut(4);
2945 if (isModEnabled(
'member')) {
2946 $langs->load(
"members");
2947 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2951 $adh->fetch(
$object->fk_member);
2952 $adh->ref = $adh->login;
2953 print $adh->getNomUrl(1);
2955 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2963 if (isModEnabled(
'multicompany') && is_object($mc)) {
2965 if (!method_exists($mc,
'formObjectOptions')) {
2966 if (empty(
$conf->multicompany->transverse_mode) &&
$conf->entity == 1 && $user->admin && !$user->entity) {
2967 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2968 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
2969 print
"</td></tr>\n";
2971 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2977 $parameters = array(
'colspan' =>
' colspan="2"');
2979 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters,
$object, $action);
2980 print $hookmanager->resPrint;
2981 if (empty($reshook)) {
2982 if ($permissiontoedit) {
2983 print
$object->showOptionals($extrafields,
'edit');
2985 print
$object->showOptionals($extrafields,
'view');
2990 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2992 if ($permissiontoedit) {
2993 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2995 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
2996 print $doleditor->Create(1);
3008 print
'<table class="border centpercent">';
3014 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3016 if ($permissiontoedit) {
3017 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3019 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3025 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3027 if ($permissiontoedit) {
3028 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3036 if ($permissiontoseesalary) {
3037 $langs->load(
"salaries");
3040 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3042 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3048 $text = $langs->trans(
"THM");
3049 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3052 if ($permissiontoedit) {
3053 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3062 $text = $langs->trans(
"TJM");
3063 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3066 if ($permissiontoedit) {
3067 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3076 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3078 if ($permissiontoedit) {
3079 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3084 if ($dateemployment && $dateemploymentend) {
3088 if ($permissiontoedit) {
3089 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3097 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3099 if ($permissiontoedit) {
3100 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3111 print
'<div class="center">';
3112 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3113 print
' ';
3114 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3120 if ($action !=
'edit' && $action !=
'presend') {
3121 print
'<div class="fichecenter"><div class="fichehalfleft">';
3126 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3127 $genallowed = $user->hasRight(
"user",
"user",
"read");
3128 $delallowed = $user->hasRight(
"user",
"user",
"write");
3133 $societe->fetch(
$object->socid);
3138 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);
3139 $somethingshown = $formfile->numoffiles;
3142 $tmparray = $form->showLinkToObjectBlock(
$object, array(), array(), 1);
3143 $linktoelem = $tmparray[
'linktoelem'];
3144 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3145 print $htmltoenteralink;
3147 $somethingshown = $form->showLinkedObjectBlock(
$object, $linktoelem);
3151 $morehtmlcenter =
'<div class="nowraponall">';
3152 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3153 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3154 $morehtmlcenter .=
'</div>';
3156 print
'</div><div class="fichehalfright">';
3159 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3161 $somethingshown = $formactions->showactions(
$object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3163 print
'</div></div>';
3166 if (isModEnabled(
'ldap') && !empty(
$object->ldap_sid)) {
3173include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
3175if (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.