40require
'../main.inc.php';
51require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
53require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
61require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
62require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
63require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
65 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
68 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
74 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
78$langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
81$action =
GETPOST(
'action',
'aZ09');
82$mode =
GETPOST(
'mode',
'alpha');
83$confirm =
GETPOST(
'confirm',
'alpha');
85$cancel =
GETPOST(
'cancel',
'alpha');
86$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'usercard';
87$backtopage =
GETPOST(
'backtopage');
88$backtopageforcancel =
GETPOST(
'backtopageforcancel');
90if (empty($id) && $action !=
'add' && $action !=
'create') {
100$childids = $user->getAllChildIds(1);
106$extrafields->fetch_name_optionals_label(
$object->table_element);
111$hookmanager->initHooks(array(
'usercard',
'globalcard'));
118 $res =
$object->fetch($id,
'',
'', 1);
123if ($user->socid > 0) {
124 $socid = $user->socid;
130$permissiontoadd = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
131$permissiontoread = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
132$permissiontoedit = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
133$permissiontodisable = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete")) && (empty($user->socid) || $user->socid ==
$object->socid);
134$permissiontoreadgroup = $permissiontoread;
135$permissiontoeditgroup = $permissiontoedit;
137 $permissiontoreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read")) && (empty($user->socid) || $user->socid ==
$object->socid);
138 $permissiontoeditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write")) && (empty($user->socid) || $user->socid ==
$object->socid);
141$permissiontoclonesuperadmin = ($permissiontoadd && empty($user->entity));
142$permissiontocloneadmin = ($permissiontoadd && !empty($user->admin));
143$permissiontocloneuser = $permissiontoadd;
146 $permissiontoclonesuperadmin =
false;
147 $permissiontocloneadmin =
false;
148 $permissiontocloneuser =
false;
151if ($user->id != $id && !$permissiontoread) {
155$caneditpasswordandsee =
false;
156$caneditpasswordandsend =
false;
159$permissiontoeditpasswordandsee =
false;
160$permissiontoeditpasswordandsend =
false;
163 $permissiontoedit = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"))) && (empty($user->socid) || $user->socid ==
$object->socid);
164 $permissiontoeditpasswordandsee = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password") && $user->admin))&& (empty($user->socid) || $user->socid ==
$object->socid);
165 $permissiontoeditpasswordandsend = ((($user->id ==
$id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")))&& (empty($user->socid) || $user->socid ==
$object->socid);
169$permissiontoseesalary = (empty($user->socid) && (
170 (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"read") && (
$id == 0 || in_array($id, $childids)))
171 || (
isModEnabled(
'salaries') && $user->hasRight(
"salaries",
"readall"))
172 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read")))
175$passwordismodified =
false;
183$parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $permissiontoeditgroup);
184$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
189if (empty($reshook)) {
190 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
192 if (empty($backtopage) || ($cancel && empty($id))) {
193 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
194 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
195 $backtopage = $backurlforlist;
197 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) &&
$id > 0) ? $id :
'__ID__');
203 if (!empty($backtopageforcancel)) {
204 header(
"Location: ".$backtopageforcancel);
206 } elseif (!empty($backtopage)) {
207 header(
"Location: ".$backtopage);
213 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $permissiontodisable) {
214 if ($id != $user->id) {
216 if (
$object->admin && empty($user->admin)) {
219 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
222 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
228 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $permissiontodisable) {
231 if ($id != $user->id) {
234 if (!empty($conf->file->main_limit_users)) {
235 $nb =
$object->getNbOfUsers(
"active");
236 if ($nb >= $conf->file->main_limit_users) {
238 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
244 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
250 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $permissiontodisable) {
251 if ($id != $user->id) {
252 if (!GETPOSTISSET(
'token')) {
253 print
'Error, token required for this critical operation';
261 $result =
$object->delete($user);
263 $langs->load(
"errors");
267 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
274 if ($action ==
'add' && $permissiontoadd) {
288 if (!empty($conf->file->main_limit_users)) {
289 $nb =
$object->getNbOfUsers(
"active");
290 if ($nb >= $conf->file->main_limit_users) {
292 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
302 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
317 $object->socialnetworks = array();
318 foreach ($socialnetworks as $key => $value) {
319 if (
GETPOST($key,
'alphanohtml')) {
325 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
332 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
334 $langs->load(
"errors");
335 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
338 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
347 if ($permissiontoseesalary) {
360 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
362 $object->dateemployment = $dateemployment;
363 $object->dateemploymentend = $dateemploymentend;
364 $object->datestartvalidity = $datestartvalidity;
365 $object->dateendvalidity = $dateendvalidity;
373 $ret = $extrafields->setOptionalsFromPost(
null, $object);
387 $object->entity = ($entity ==
'' ? 1 : $entity);
391 $object->entity = ($entity ==
'' ? 1 : $entity);
402 if (
GETPOST(
'password',
'password')) {
403 $resPass =
$object->setPassword($user,
GETPOST(
'password',
'password'));
405 if (is_int($resPass) && $resPass < 0) {
406 $langs->load(
"errors");
413 $usercats =
GETPOST(
'usercats',
'array:int');
414 $object->setCategories($usercats);
418 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
422 $langs->load(
"errors");
431 if (($action ==
'addgroup' || $action ==
'removegroup') && $permissiontoeditgroup) {
434 $editgroup->fetch($group);
435 $editgroup->oldcopy = clone $editgroup;
439 if ($action ==
'addgroup') {
440 $result =
$object->SetInGroup($group, $editgroup->entity);
442 if ($action ==
'removegroup') {
443 $result =
$object->RemoveFromGroup($group, $editgroup->entity);
454 if ($action ==
'update' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
455 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
457 if ($permissiontoedit) {
460 if (!
GETPOST(
"lastname",
'alpha')) {
465 if (!
GETPOST(
"login",
'alpha')) {
482 if (GETPOSTISSET(
"ref_employee")) {
486 if (GETPOSTISSET(
"national_registration_number")) {
487 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
490 if ($permissiontoeditpasswordandsee) {
493 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
496 if (!empty($user->admin) && $user->id != $id) {
501 if ($user->admin && !
$object->ldap_sid) {
514 $object->socialnetworks = array();
515 foreach ($socialnetworks as $key => $value) {
516 if (
GETPOST($key,
'alphanohtml')) {
522 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
529 if (
$object->signature ===
'ErrorTooManyLinksIntoHTMLString') {
531 $langs->load(
"errors");
532 setEventMessages($langs->trans(
'ErrorTooManyLinksIntoHTMLString'),
null,
'errors');
535 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
543 if ($permissiontoseesalary) {
556 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ? str_replace(
'#',
'', (
string)
GETPOST(
"color",
'alphanohtml')) :
'';
557 $object->dateemployment = $dateemployment;
558 $object->dateemploymentend = $dateemploymentend;
559 $object->datestartvalidity = $datestartvalidity;
560 $object->dateendvalidity = $dateendvalidity;
570 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
584 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
592 if (!empty($_FILES[
'photo'][
'name'])) {
596 if (
$object->id == $user->id) {
601 $langs->load(
"errors");
603 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
608 $passwordismodified = 0;
611 $passwordismodified = 1;
618 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
619 $langs->load(
"errors");
620 setEventMessages($langs->trans(
"ErrorUpdateCanceledDueToDuplicatedUniqueValue",
$object->login),
null,
'errors');
628 if (!$error && GETPOSTISSET(
'contactid')) {
632 if ($contactid > 0) {
634 $contact->fetch($contactid);
636 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
637 $sql .=
" SET fk_socpeople=".((int) $contactid);
638 if (!empty($contact->socid)) {
639 $sql .=
", fk_soc=".((int) $contact->socid);
640 } elseif ($socid > 0) {
641 $sql .=
", fk_soc = null";
642 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
644 $sql .=
" WHERE rowid = ".((int)
$object->id);
645 } elseif ($socid > 0) {
646 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
647 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
648 $sql .=
" WHERE rowid = ".((int)
$object->id);
650 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
651 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
652 $sql .=
" WHERE rowid = ".((int)
$object->id);
655 $resql = $db->query($sql);
662 if (!$error && !count(
$object->errors)) {
664 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.
$object->oldcopy->photo;
667 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
671 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
672 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
679 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
681 if (!($result > 0)) {
689 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
698 $langs->load(
"errors");
699 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
704 if (!$error && !count(
$object->errors)) {
706 $categories =
GETPOST(
'usercats',
'array:int');
707 $object->setCategories($categories);
710 if (!$error && !count(
$object->errors)) {
714 $login = $_SESSION[
"dol_login"];
717 $langs->load(
"errors");
718 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
720 if ($passwordismodified &&
$object->login == $user->login) {
722 $langs->load(
"errors");
723 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourPasswordWasModifiedPleaseLogin"),
null,
'warnings');
724 header(
"Location: ".DOL_URL_ROOT.
'/user/card.php?id='.
$object->id);
732 if ($permissiontoeditpasswordandsee) {
733 dol_syslog(
"Not allowed to change fields, only password");
737 if (
GETPOST(
"password",
"password")) {
740 $ret =
$object->setPassword($user,
GETPOST(
"password",
"password"));
741 if (is_int($ret) && $ret < 0) {
750 if ((($action ==
'confirm_password' && $confirm ==
'yes' && $permissiontoeditpasswordandsee)
751 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes' && $permissiontoeditpasswordandsend))
755 $newpassword =
$object->setPassword($user,
'');
756 if (is_int($newpassword) && $newpassword < 0) {
758 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
761 if ($action ==
'confirm_passwordsend') {
762 if (
$object->send_password($user, $newpassword) > 0) {
768 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
774 if ($action ==
'adduserldap' && $permissiontoadd) {
775 $selecteduser =
GETPOST(
'users');
777 $required_fields = array(
794 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
795 foreach ($arrayofsocialnetworks as $socialnetwork) {
801 $result = $ldap->connectBind();
804 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
809 if (is_array($ldapusers)) {
810 foreach ($ldapusers as $key => $attribute) {
822 $ldap_social = array();
825 $arrayofsocialnetworks = array(
'skype',
'twitter',
'facebook',
'linkedin');
826 foreach ($arrayofsocialnetworks as $socialnetwork) {
827 $ldap_social[$socialnetwork] = $attribute[
getDolGlobalString(
'LDAP_FIELD_'.strtoupper($socialnetwork))];
837 if ($action ==
'confirm_clone' && $confirm !=
'yes') {
840 if ($action ==
'confirm_clone' && $confirm ==
'yes' && $permissiontocloneuser) {
844 setEventMessages($langs->trans(
'ErrorNoCloneWithoutEmail'),
null,
'errors');
852 $clone->api_key =
'';
853 $clone->admin = ($user->admin ?
$object->admin : 0);
855 $parts = explode(
' ',
GETPOST(
'clone_name'), 2);
856 $clone->firstname = $parts[0];
857 $clone->lastname = isset($parts[1]) ? $parts[1] :
'';
859 $clone->login = substr($parts[0], 0, 1).$parts[1];
862 $clone->context[
'createfromclone'] =
'createfromclone';
863 $id = $clone->create($user);
864 $refalreadyexists = 0;
867 $result = $clone->cloneRights(
$object->id, $id);
870 if (
GETPOST(
'clone_categories')) {
871 $result = $clone->cloneCategories(
$object->id, $id);
879 if ($clone->error ==
'ErrorProductAlreadyExists') {
883 $mesg = $langs->trans(
"ErrorProductAlreadyExists", $clone->ref);
884 $mesg .=
' <a href="' . $_SERVER[
"PHP_SELF"] .
'?ref=' . $clone->ref .
'">' . $langs->trans(
"ShowCardHere") .
'</a>.';
887 setEventMessages(empty($clone->error) ?
'' : $langs->trans($clone->error), $clone->errors,
'errors');
891 unset($clone->context[
'createfromclone']);
898 header(
"Location: " . $_SERVER[
"PHP_SELF"] .
"?id=" . $id);
909 $triggersendname =
'USER_SENTBYMAIL';
911 $mode =
'emailfromuser';
912 $trackid =
'use'.$id;
913 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
916 $upload_dir = $conf->user->dir_output;
917 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
920 include DOL_DOCUMENT_ROOT.
'/core/actions_printing.inc.php';
928$form =
new Form($db);
940$sql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
'user WHERE entity IN ('.
getEntity(
'user').
')';
941$resql = $db->query($sql);
943 $obj = $db->fetch_object($resql);
945 $nbofusers = $obj->nb;
953 $title = $person_name.
" - ".$langs->trans(
'Card');
956 $title = $langs->trans(
"NewEmployee");
958 $title = $langs->trans(
"NewUser");
964llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-user page-card');
966if ($action ==
'create' || $action ==
'adduserldap') {
969 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc", $langs->transnoentities(
"CreateExternalUser")).
"</span><br>\n";
978 $result = $ldap->connectBind();
980 $required_fields = array(
1000 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
1005 if (is_array($ldapusers)) {
1006 foreach ($ldapusers as $key => $ldapuser) {
1009 foreach ($required_fields as $value) {
1011 $label .= $value.
"=******* ";
1013 $label .= $value.
"=".$ldapuser[$value].
" ";
1016 $liste[$key] = $label;
1026 print
"\n\n<!-- Form liste LDAP debut -->\n";
1028 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
1029 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1030 print
'<table class="border centpercent"><tr>';
1031 print
'<td width="160">';
1032 print $langs->trans(
"LDAPUsers");
1035 print
'<input type="hidden" name="action" value="adduserldap">';
1036 if (is_array($liste) && count($liste)) {
1037 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
1040 print
'</td><td class="center">';
1041 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
1042 print
'</td></tr></table>';
1045 print
"\n<!-- Form liste LDAP fin -->\n\n";
1050 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
1051 print
'<input type="hidden" name="token" value="'.newToken().
'">';
1052 print
'<input type="hidden" name="action" value="add">';
1053 if (!empty($ldap_sid)) {
1054 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
1056 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
1062 print
'<table class="border centpercent">';
1066 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
1067 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
1073 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
1075 if (!empty($ldap_lastname)) {
1076 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
1077 print $ldap_lastname;
1079 print
'<input class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
1084 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
1086 if (!empty($ldap_firstname)) {
1087 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
1088 print $ldap_firstname;
1090 print
'<input id="firstname" class="minwidth100 maxwidth150onsmartphone createloginauto" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
1095 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
1097 if (!empty($ldap_login)) {
1098 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
1100 } elseif (!empty($ldap_loginsmb)) {
1101 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
1102 print $ldap_loginsmb;
1104 print
'<input id="login" class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'" spellcheck="false">';
1108 if (!empty($conf->use_javascript_ajax)) {
1112 $charforseparator =
getDolGlobalString(
"MAIN_USER_SEPARATOR_CHAR_FOR_GENERATED_LOGIN",
'.');
1113 if ($charforseparator ==
'none') {
1114 $charforseparator =
'';
1117 jQuery(document).ready(function() {
1118 $(".createloginauto").on("keyup", function() {
1119 console.log(".createloginauto change: We generate login when we have a lastname");
1121 lastname = $("#lastname").val().toLowerCase();
1124 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim()[0];';
1126 print
' firstname = $("#firstname").val().toLowerCase().replace(/\s+/g, \'\').trim();';
1132 login = firstname + \''.
dol_escape_js($charforseparator).
'\';
1134 login += lastname.replace(/\s+/g, \
'\').trim();
1136 $(
"#login").val(login);
1142 $generated_password = '';
1143 if (empty($ldap_sid)) { // ldap_sid is for activedirectory
1144 $generated_password = getRandomPassword(false);
1146 $password = (GETPOSTISSET('password
') ? GETPOST('password
') : $generated_password);
1149 if (!empty($user->admin)) {
1150 print '<tr><td>
'.$form->textwithpicto($langs->trans("Administrator"), $langs->trans("AdministratorDesc"), 1, 'help
').'</td>
';
1152 print $form->selectyesno('admin
', GETPOST('admin
'), 1, false, 0, 1);
1154 if (isModEnabled('multicompany
') && !$user->entity) {
1155 if (!empty($conf->use_javascript_ajax)) {
1156 print '<script
type=
"text/javascript">
1158 $(
"select[name=admin]").change(
function() {
1159 if ( $(
this).val() == 0 ) {
1160 $(
"input[name=superadmin]")
1161 .prop(
"disabled",
true)
1162 .prop(
"checked",
false);
1163 $(
"select[name=entity]")
1164 .prop(
"disabled",
false);
1166 $(
"input[name=superadmin]")
1167 .prop(
"disabled",
false);
1170 $(
"input[name=superadmin]").change(
function() {
1171 if ( $(
this).is(
":checked") ) {
1172 $(
"select[name=entity]")
1173 .prop(
"disabled",
true);
1175 $(
"select[name=entity]")
1176 .prop(
"disabled",
false);
1182 $checked = (GETPOSTINT('superadmin
') ? ' checked
' : '');
1183 $disabled = (GETPOSTINT('superadmin
') ? '' : ' disabled');
1184 print '<input
type=
"checkbox" name=
"superadmin" id=
"superadmin" value=
"1"'.$checked.$disabled.' /> <label
for=
"superadmin">
'.$langs->trans("SuperAdministrator").'</span>
';
1186 print "</td></tr>\n";
1190 print '<tr><td>
'.$langs->trans("Gender").'</td>
';
1192 $arraygender = array('man
' => $langs->trans("Genderman"), 'woman
' => $langs->trans("Genderwoman"), 'other
' => $langs->trans("Genderother"));
1193 print $form->selectarray('gender
', $arraygender, GETPOST('gender
'), 1);
1197 $defaultemployee = '1
';
1199 print '<td>
'.$langs->trans('Employee
').'</td><td>
';
1200 print '<input
type=
"checkbox" name=
"employee" value=
"1"'.(GETPOST('employee
') == '1
' ? ' checked=
"checked"' : (($defaultemployee && !GETPOSTISSET('login
')) ? ' checked=
"checked"' : '')).'>
';
1201 //print $form->selectyesno("employee", (GETPOST('employee
') != '' ?GETPOST('employee
') : $defaultemployee), 1);
1205 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("HierarchicalResponsible").'</td>
';
1207 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
');
1211 // Expense report validator
1212 if (isModEnabled('expensereport
')) {
1213 print '<tr><td
class=
"titlefieldcreate">
';
1214 $text = $langs->trans("ForceUserExpenseValidator");
1215 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1218 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
');
1223 // Holiday request validator
1224 if (isModEnabled('holiday
')) {
1225 print '<tr><td
class=
"titlefieldcreate">
';
1226 $text = $langs->trans("ForceUserHolidayValidator");
1227 print $form->textwithpicto($text, $langs->trans("ValidatorIsSupervisorByDefault"), 1, 'help
');
1230 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
');
1236 print '<tr><td>
'.$langs->trans("ExternalUser").' ?</td>
';
1238 print $form->textwithpicto($langs->trans("Internal"), $langs->trans("InternalExternalDesc"), 1, 'help
', '', 0, 2);
1242 print '</
table><hr><
table class=
"border centpercent">
';
1246 print '<tr><td
class=
"titlefieldcreate">
'.$langs->trans("RangeOfLoginValidity").'</td>
';
1248 print $form->selectDate($datestartvalidity, 'datestartvalidity
', 0, 0, 1, 'formdatestartvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("from"));
1252 print $form->selectDate($dateendvalidity, 'dateendvalidity
', 0, 0, 1, 'formdateendvalidity
', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1257 print '<tr><td
class=
"fieldrequired">
'.$langs->trans("Password").'</td>
';
1260 if (preg_match('/ldap/
', $dolibarr_main_authentication)) {
1261 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("PasswordOfUserInLDAP").' (hidden)
';
1263 if (preg_match('/http/
', $dolibarr_main_authentication)) {
1264 $valuetoshow .= ($valuetoshow ? ' +
' : '').$langs->trans("HTTPBasicPassword");
1266 if (preg_match('/dolibarr/
', $dolibarr_main_authentication) || preg_match('/forceuser/
', $dolibarr_main_authentication)) {
1267 if (!empty($ldap_pass)) { // For very old system compatibility. Now clear password can't be viewed from LDAP read
1268 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1269 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1272 $valuetoshow .= ($valuetoshow ?
' + '.$langs->trans(
"DolibarrPassword") :
'').
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxlength="128" type="text" id="password" name="password" value="'.
dol_escape_htmltag($password).
'" autocomplete="new-password" spellcheck="false">';
1273 if (!empty($conf->use_javascript_ajax)) {
1274 $valuetoshow .=
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_password" class="linkobject paddingleft"');
1280 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
1281 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1283 $valuetoshow = $hookmanager->resPrint;
1285 $valuetoshow .= $hookmanager->resPrint;
1295 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1297 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off" spellcheck="false">';
1298 if (!empty($conf->use_javascript_ajax)) {
1299 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
1305 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1309 print
'</table><hr><table class="border centpercent">';
1313 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1314 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1316 print
'</textarea></td></tr>';
1319 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1320 print $formcompany->select_ziptown(
$object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1324 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1325 print $formcompany->select_ziptown(
$object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1329 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1330 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1331 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
1333 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1339 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1340 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1341 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
1346 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1348 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1349 if (!empty($ldap_phone)) {
1350 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1353 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1358 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1360 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1361 if (!empty($ldap_mobile)) {
1362 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1365 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'" spellcheck="false">';
1370 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1372 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1373 if (!empty($ldap_fax)) {
1374 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1377 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1382 print
'<tr><td'.(getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1384 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1385 if (!empty($ldap_mail)) {
1386 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1389 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'" spellcheck="false">';
1395 foreach ($socialnetworks as $key => $value) {
1396 if ($value[
'active']) {
1397 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1399 if (!empty($value[
'icon'])) {
1400 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
1402 if (!empty($ldap_social[$key])) {
1403 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1404 print $ldap_social[$key];
1406 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1411 if (!empty($ldap_social[$key])) {
1412 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1414 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1422 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1424 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1430 print
'<tr><td>'.$langs->trans(
"Color").
'</td>';
1432 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
1437 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1438 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1439 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
1445 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1446 print
'<td class="maxwidthonsmartphone">'.
"\n";
1447 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');
1455 if (!method_exists($mc,
'formObjectOptions')) {
1456 if (!
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1457 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1458 print
"<td>".$mc->select_entities($conf->entity);
1459 print
"</td></tr>\n";
1461 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1467 $parameters = array();
1468 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1471 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1472 print
'<td class="wordbreak">';
1473 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1475 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
1476 print $doleditor->Create(1);
1480 print
'<tr><td class="tdtop">';
1481 print $langs->trans(
"NotePublic");
1483 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1484 $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%');
1485 $doleditor->Create();
1486 print
"</td></tr>\n";
1489 print
'<tr><td class="tdtop">';
1490 print $langs->trans(
"NotePrivate");
1492 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1493 $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%');
1494 $doleditor->Create();
1495 print
"</td></tr>\n";
1497 print
'</table><hr><table class="border centpercent">';
1504 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1505 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1510 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1512 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1515 if ($permissiontoseesalary) {
1516 $langs->load(
"salaries");
1520 $text = $langs->trans(
"THM");
1521 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1524 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1530 $text = $langs->trans(
"TJM");
1531 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1534 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1539 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1541 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input class="width100" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
1547 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1549 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1554 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1556 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
1560 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
1565 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1567 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
1575 print $form->buttonsSaveCancel(
"CreateUser");
1581 $res =
$object->fetch($id,
'',
'', 1);
1586 $res =
$object->fetch_optionals();
1596 $passDoNotExpire = 0;
1598 $userChangePassNextLogon = 0;
1604 $result = $ldap->connectBind();
1606 $userSearchFilter =
'(' .
getDolGlobalString(
'LDAP_FILTER_CONNECTION').
'('.$ldap->getUserIdentifier().
'='.
$object->login.
'))';
1607 $entries = $ldap->fetch(
$object->login, $userSearchFilter);
1613 if (count($ldap->uacf) > 0) {
1614 foreach ($ldap->uacf as $key => $statut) {
1615 if ($key == 65536) {
1616 $passDoNotExpire = 1;
1617 $statutUACF = $statut;
1622 $statutUACF =
"ACCOUNTDISABLE";
1625 if ($ldap->pwdlastset == 0) {
1626 $userChangePassNextLogon = 1;
1632 if ($mode ==
'employee') {
1633 $title = $langs->trans(
"Employee");
1634 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1636 $title = $langs->trans(
"User");
1639 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1640 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1647 if ($action ==
'password') {
1648 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword",
$object->login),
"confirm_password",
'', 0, 1);
1652 if ($action ==
'passwordsend') {
1653 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword",
$object->login),
"confirm_passwordsend",
'', 0, 1);
1657 if ($action ==
'disable') {
1658 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser",
$object->login),
"confirm_disable",
'', 0, 1);
1662 if ($action ==
'enable') {
1663 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser",
$object->login),
"confirm_enable",
'', 0, 1);
1667 if ($action ==
'delete') {
1668 print $form->formconfirm(
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id]), $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser",
$object->login),
"confirm_delete",
'', 0, 1);
1672 if (($action ==
'clone' && (empty($conf->use_javascript_ajax) || !empty($conf->dol_use_jmobile)))
1673 || (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) {
1675 $formquestionclone = array(
1676 'text' => $langs->trans(
"ConfirmClone"),
1677 0 => array(
'type' =>
'text',
'name' =>
'clone_name',
'label' => $langs->trans(
"NewNameUserClone"),
'morecss' =>
'width200'),
1678 1 => array(
'type' =>
'checkbox',
'name' =>
'clone_rights',
'label' => $langs->trans(
"CloneUserRights"),
'value' => 0),
1679 2 => array(
'type' =>
'checkbox',
'name' =>
'clone_categories',
'label' => $langs->trans(
"CloneCategoriesProduct"),
'value' => 0),
1682 $newElement = array(
'type' =>
'text',
'name' =>
'new_email',
'label' => $langs->trans(
"NewEmailUserClone"),
'morecss' =>
'width200');
1683 array_splice($formquestionclone, 2, 0, array($newElement));
1685 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);
1690 if ($action !=
'edit') {
1691 print
dol_get_fiche_head($head,
'user', $title, -1,
'user', 0,
'',
'', 0,
'', 1);
1693 $morehtmlref =
'<a href="'.dolBuildUrl(DOL_URL_ROOT.
'/user/vcard.php', [
'id' =>
$object->id,
'output' =>
'file',
'file' =>
dol_sanitizeFileName(
$object->getFullName($langs).
'.vcf')]).
'" class="refid valignmiddle" rel="noopener">';
1694 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard").
' ('.$langs->trans(
"AddToContacts").
')',
'vcard',
'class="valignmiddle marginleftonly paddingrightonly"');
1695 $morehtmlref .=
'</a>';
1697 $urltovirtualcard =
'/user/virtualcard.php?id='.((int)
$object->id);
1698 $morehtmlref .=
dolButtonToOpenUrlInDialogPopup(
'publicvirtualcard', $langs->transnoentitiesnoconv(
"PublicVirtualCardUrl").
' - '.
$object->getFullName($langs),
img_picto($langs->trans(
"PublicVirtualCardUrl"),
'card',
'class="valignmiddle marginleftonly paddingrightonly"'), $urltovirtualcard,
'',
'refid valignmiddle nohover');
1700 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1702 print
'<div class="fichecenter">';
1703 print
'<div class="fichehalfleft">';
1705 print
'<div class="underbanner clearboth"></div>';
1706 print
'<table class="border tableforfield centpercent">';
1709 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1710 if (!empty(
$object->ldap_sid) &&
$object->status == User::STATUS_DISABLED) {
1711 print
'<td class="error">';
1712 print $langs->trans(
"LoginAccountDisableInDolibarr");
1718 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"superadmin",
'class="paddingleft valignmiddle"');
1719 } elseif (!empty(
$object->admin)) {
1720 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"admin",
'class="paddingleft valignmiddle"');
1729 $text = $langs->trans(
"Type");
1730 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1732 $type = $langs->trans(
"Internal");
1734 $type = $langs->trans(
"External");
1736 print
'<span class="badgeneutral">';
1739 print
' ('.$langs->trans(
"DomainUser").
')';
1742 print
'</td></tr>'.
"\n";
1745 if (
$object->ldap_sid && is_object($ldap)) {
1746 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1747 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1748 print
'</td></tr>'.
"\n";
1752 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1754 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1758 print
'</td></tr>'.
"\n";
1761 if ($nbofusers > 1) {
1763 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1765 if (empty(
$object->fk_user)) {
1766 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1768 $huser =
new User($db);
1770 $huser->fetch(
$object->fk_user);
1771 print $huser->getNomUrl(-1);
1773 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1782 $text = $langs->trans(
"ForceUserExpenseValidator");
1783 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1786 if (!empty(
$object->fk_user_expense_validator)) {
1787 $evuser =
new User($db);
1788 $evuser->fetch(
$object->fk_user_expense_validator);
1789 print $evuser->getNomUrl(-1);
1798 $text = $langs->trans(
"ForceUserHolidayValidator");
1799 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1802 if (!empty(
$object->fk_user_holiday_validator)) {
1803 $hvuser =
new User($db);
1804 $hvuser->fetch(
$object->fk_user_holiday_validator);
1805 print $hvuser->getNomUrl(-1);
1813 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1814 print
'<td>'.dol_escape_htmltag(
$object->job).
'</td>';
1818 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1825 if ($permissiontoseesalary) {
1826 $langs->load(
"salaries");
1829 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1831 print(
$object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price(
$object->salary, 0, $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1837 $text = $langs->trans(
"THM");
1838 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1841 print(
$object->thm !=
'' ?
'<span class="amount">'.price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency).
'</span>' :
'');
1847 $text = $langs->trans(
"TJM");
1848 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1851 print(
$object->tjm !=
'' ?
'<span class="amount">'.price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency).
'</span>' :
'');
1857 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1859 if (
$object->dateemployment) {
1860 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1863 if (
$object->dateemploymentend) {
1864 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1871 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1879 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1880 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1881 if (
$object->fk_warehouse > 0) {
1882 $warehousestatic =
new Entrepot($db);
1883 $warehousestatic->fetch(
$object->fk_warehouse);
1884 print $warehousestatic->getNomUrl(1);
1892 print
'<div class="fichehalfright">';
1894 print
'<div class="underbanner clearboth"></div>';
1896 print
'<table class="border tableforfield centpercent">';
1900 print
'<tr><td class="titlefieldmax45">'.$langs->trans(
"Color").
'</td>';
1902 print $formother->showColor(
$object->color,
'');
1908 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
1909 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1911 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
1917 $langs->load(
"languages");
1918 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1920 print $form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1924 $labellang = (
$object->lang ? $langs->trans(
'Language_'.
$object->lang) :
'');
1930 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
1931 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1932 print
'<td>'.$object->openid.
'</td>';
1939 if (!method_exists($mc,
'formObjectOptions')) {
1940 if (
isModEnabled(
'multicompany') && !
getDolGlobalString(
'MULTICOMPANY_TRANSVERSE_MODE') && $conf->entity == 1 && $user->admin && !$user->entity) {
1941 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1943 print $langs->trans(
"AllEntities");
1945 $mc->getInfo(
$object->entity);
1948 print
"</td></tr>\n";
1954 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1958 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1963 $societe->fetch(
$object->socid);
1964 if ($societe->id > 0) {
1965 $s .= $societe->getNomUrl(1,
'');
1968 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1970 if (!empty(
$object->contact_id)) {
1972 $contact->fetch(
$object->contact_id);
1973 if ($contact->id > 0) {
1974 if (
$object->socid > 0 && $s) {
1979 $s .= $contact->getNomUrl(1,
'');
1989 $langs->load(
"members");
1990 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1994 $adh->fetch(
$object->fk_member);
1995 $adh->ref = $adh->getFullname($langs);
1996 print $adh->getNomUrl(-1);
1998 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2005 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
2007 print
"</td></tr>\n";
2018 print
'<!-- credential section -->'.
"\n";
2019 print
'<div class="div-table-responsive-no-min">';
2020 print
'<table class="noborder tableforfield centpercent">';
2023 print
'<tr class="liste_titre"><th class="liste_titre" colspan="2">';
2024 print
'<div class="centpercent display-flex">';
2025 print
'<div class="left inline-block">';
2026 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"SecurityForConnection");
2033 print
'<tr class="nooddeven"><td class="titlefieldmax45 nowraponall">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2035 if (
$object->datestartvalidity) {
2036 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
2039 if (
$object->dateendvalidity) {
2040 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
2048 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2049 if (!empty(
$object->ldap_sid)) {
2050 if ($passDoNotExpire) {
2051 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
2052 } elseif ($userChangePassNextLogon) {
2053 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
2054 } elseif ($userDisabled) {
2055 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
2057 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2060 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2063 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2064 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
2068 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2069 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2071 $valuetoshow = $hookmanager->resPrint;
2073 $valuetoshow .= $hookmanager->resPrint;
2077 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Password").
'</td>';
2078 print
'<td class="wordbreak">';
2085 if (
getDolGlobalString(
'MAIN_SECURITY_ALLOW_TOTP') && $permissiontoeditpasswordandsee) {
2086 print
'<tr class="nooddeven"><td>'.$langs->trans(
"2FA").
'</td>';
2088 print
'<div class="centpercent display-flex">';
2089 print
'<span class="badge badge-info">999</span>';
2090 print
'<div class="left inline-block">';
2091 $s =
'<!-- MAIN_SECURITY_ALLOW_TOTP --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2093 print
'</span></span>';
2098 $tmparrayofauthmode = explode(
',', $dolibarr_main_authentication);
2099 foreach ($tmparrayofauthmode as $tmpauthmode) {
2100 $langs->load(
"oauth");
2102 $tmpauthmode = trim($tmpauthmode);
2103 if (preg_match(
'/oauth/', $tmpauthmode)) {
2104 $nameofservice = preg_replace(
'/oauth/',
'', $tmpauthmode);
2105 print
'<tr class="nooddeven">';
2106 print
'<td class="titlefieldmiddle">'.$langs->trans(
"OAUTH_ID");
2107 print
' '.ucfirst($nameofservice).
' ';
2110 $constoauthlogin =
'OAUTH_'.strtoupper($nameofservice).
'-Login_ID';
2111 print
'<td class="tdoverflowmax200" title="'.dolPrintHTMLForAttribute(
getDolGlobalString($constoauthlogin)).
'">';
2119 if (!empty(
$object->email_oauth2)) {
2120 print
'<tr class="nooddeven"><td class="titlefieldmiddle">'.$langs->trans(
"AlternativeEmailForOAuth2").
'</td>';
2130 if (
isModEnabled(
'api') && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2131 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
2134 print
'<div class="centpercent display-flex">';
2135 print
'<span class="badge badge-info">999</span>';
2139 print
'<div class="left inline-block">';
2140 $s =
'<!-- API_IN_TOKEN_TABLE --><span class="fa fa-pen valignmiddle btnTitle-icon"></span>';
2145 if (!empty(
$object->api_key)) {
2146 print
'<span class="opacitymedium">';
2151 print
' <span class="badge badge-info" title="'.$langs->trans(
"TotalAPICall").
'">';
2161 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
2163 if (
$object->datepreviouslogin) {
2164 print
dol_print_date(
$object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
2167 print
dol_print_date(
$object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
2177 $parameters = array(
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2178 $reshook = $hookmanager->executeHooks(
'addMoreObjectBlock', $parameters, $object, $action);
2180 print $hookmanager->resPrint;
2186 print
'<div class="clearboth"></div>';
2195 print
'<div class="tabsAction">';
2197 $parameters = array();
2198 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
2199 if (empty($reshook)) {
2203 'class' =>
'classfortooltip'
2207 if (empty($user->socid)) {
2208 $canSendMail =
false;
2210 $langs->load(
"mails");
2211 $canSendMail =
true;
2212 unset($params[
'attr'][
'title']);
2214 $langs->load(
"mails");
2215 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2217 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init']) .
'#formmailbeforetitle',
'', $canSendMail, $params);
2222 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
2225 unset($params[
'attr'][
'title']);
2228 } elseif ($permissiontoeditpasswordandsee && !
$object->ldap_sid &&
2230 unset($params[
'attr'][
'title']);
2238 'class' =>
'classfortooltip'
2243 if ((empty(
$object->entity) && $permissiontoclonesuperadmin) || (!empty(
$object->admin) && !empty(
$object->entity) && $permissiontocloneadmin) || ($permissiontocloneuser && empty(
$object->admin) && !empty(
$object->entity))) {
2244 $cloneButtonId =
'';
2247 if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) {
2249 $cloneButtonId =
'action-clone';
2251 print
dolGetButtonAction($langs->trans(
'ToClone'),
'',
'default', $cloneUserUrl, $cloneButtonId, $user->hasRight(
'user',
'user',
'write'));
2255 if (
$object->status == $object::STATUS_DISABLED) {
2256 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2258 } elseif (($user->id != $id && $permissiontoeditpasswordandsee) &&
$object->login && !
$object->ldap_sid &&
2260 unset($params[
'attr'][
'title']);
2261 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
2264 if (
$object->status == $object::STATUS_DISABLED) {
2265 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
2266 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2267 } elseif (($user->id != $id && $permissiontoeditpasswordandsend) &&
$object->login && !
$object->ldap_sid &&
2270 unset($params[
'attr'][
'title']);
2271 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
2273 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
2274 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2279 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_DISABLED &&
2281 unset($params[
'attr'][
'title']);
2282 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
2285 if ($user->id != $id && $permissiontodisable &&
$object->status == User::STATUS_ENABLED &&
2287 unset($params[
'attr'][
'title']);
2288 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' .
$object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
2290 if ($user->id == $id) {
2291 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
2292 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
2296 if ($user->id != $id && $permissiontodisable &&
2298 if ($user->admin || !
$object->admin) {
2299 unset($params[
'attr'][
'title']);
2300 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
true, $params);
2302 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
2303 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.
$object->id,
'',
false, $params);
2313 if (
GETPOST(
'modelselected')) {
2314 $action =
'presend';
2318 $modelmail =
'user';
2319 $defaulttopic =
'Information';
2320 $diroutput = $conf->user->dir_output;
2321 $trackid =
'use'.$object->id;
2323 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2325 if ($action !=
'presend' && $action !=
'send') {
2330 if ($permissiontoreadgroup) {
2331 print
'<!-- Group section -->'.
"\n";
2339 $groupslist = $usergroup->listGroupsForUser(
$object->id,
false);
2341 if (!empty($groupslist)) {
2342 foreach ($groupslist as $groupforuser) {
2343 $exclude[] = $groupforuser->id;
2348 $parameters = array(
'caneditgroup' => $permissiontoeditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2349 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
2350 print $hookmanager->resPrint;
2352 if (empty($reshook)) {
2353 if ($permissiontoeditgroup) {
2354 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$id.
'" method="POST">'.
"\n";
2355 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2356 print
'<input type="hidden" name="action" value="addgroup" />';
2357 print
'<input type="hidden" name="page_y" value="" />';
2360 print
'<!-- List of groups of the user -->'.
"\n";
2361 print
'<table class="noborder centpercent">'.
"\n";
2362 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2363 print
'<th class="liste_titre right">';
2364 if ($permissiontoeditgroup) {
2365 print $form->select_dolgroups(0,
'group', 1, $exclude, 0,
'', array(), (
string)
$object->entity,
false,
'maxwidth150');
2367 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2368 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2370 print
'</th></tr>'.
"\n";
2373 if (!empty($groupslist)) {
2374 foreach ($groupslist as $group) {
2375 print
'<tr class="oddeven">';
2376 print
'<td class="tdoverflowmax200">';
2377 if ($permissiontoeditgroup) {
2378 print $group->getNomUrl(1);
2380 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2383 print
'<td class="right">';
2384 if ($permissiontoeditgroup) {
2385 print
'<a class="reposition" href="'.dolBuildUrl($_SERVER[
'PHP_SELF'], [
'id' =>
$object->id,
'action' =>
'removegroup',
'group' => $group->id],
true).
'">';
2386 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2391 print
"</td></tr>\n";
2394 print
'<tr class="oddeven"><td colspan="2"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2399 if ($permissiontoeditgroup) {
2411 if ($action ==
'edit' && ($permissiontoedit || $permissiontoeditpasswordandsee)) {
2412 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2413 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2414 print
'<input type="hidden" name="action" value="update">';
2415 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2419 print
'<table class="border centpercent">';
2423 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2432 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2434 if ($permissiontoedit && !
$object->ldap_sid) {
2435 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2437 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2444 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2446 if ($permissiontoedit && !
$object->ldap_sid) {
2447 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2449 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2455 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2457 if ($user->admin && !
$object->ldap_sid) {
2458 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'" spellcheck="false">';
2460 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2467 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2469 if ($user->id ==
$object->id || !$user->admin) {
2471 $type = $langs->trans(
"Internal");
2473 $type = $langs->trans(
"External");
2476 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2478 print
' ('.$langs->trans(
"DomainUser").
')';
2487 $eventsCompanyContact = array();
2488 $eventsCompanyContact[] = array(
'method' =>
'getContacts',
'url' =>
dol_buildpath(
'/core/ajax/contacts.php?showempty=1&token='.
currentToken(), 1),
'htmlname' =>
'contactid',
'params' => array(
'add-customer-contact' =>
'disabled'));
2490 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2491 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2492 print
'<span class="clearbothonsmartphone"></span>';
2493 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2494 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2496 print
' ('.$langs->trans(
"DomainUser").
')';
2499 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2500 print $form->select_company(
$object->socid,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2501 print
'<span class="clearbothonsmartphone"></span>';
2502 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2503 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2505 print
' ('.$langs->trans(
"DomainUser").
')';
2508 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2509 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2510 print
'<span class="clearbothonsmartphone"></span>';
2511 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2512 print $form->select_contact(0,
$object->contact_id,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2514 print
' ('.$langs->trans(
"DomainUser").
')';
2517 print
img_picto(
'',
'company',
'class="pictofixedwidth"');
2518 print $form->select_company(0,
'socid',
'',
' ', 0, 0, $eventsCompanyContact, 0,
'widthcentpercentminusxx maxwidth300');
2519 print
'<span class="clearbothonsmartphone"></span>';
2520 print
img_picto(
'',
'contact',
'class="pictofixedwidth"');
2521 print $form->select_contact(0, 0,
'contactid', 1,
'',
'', 1,
'minwidth100imp widthcentpercentminusxx maxwidth300',
true, 1);
2527 print
'<tr><td>'.$form->textwithpicto($langs->trans(
"Administrator"), $langs->trans(
"AdministratorDesc")).
'</td>';
2529 $langs->load(
"admin");
2531 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn(
$object->admin);
2532 print
' <span class="opacitymedium">('.$langs->trans(
"ExternalUser").
')</span>';
2536 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2537 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2544 || (
isModEnabled(
'multicompany') && ((
$object->entity > 0 || ($user->entity == 0 &&
$object->entity == 0)) || $nbSuperAdmin > 1))
2547 print $form->selectyesno(
'admin',
$object->admin, 1,
false, 0, 1);
2550 if ($conf->use_javascript_ajax) {
2551 print
'<script type="text/javascript">
2553 var admin = $("select[name=admin]").val();
2555 $("input[name=superadmin]")
2556 .prop("disabled", true)
2557 .prop("checked", false);
2559 if ($("input[name=superadmin]").is(":checked")) {
2560 $("select[name=entity]")
2561 .prop("disabled", true);
2563 $("select[name=admin]").change(function() {
2564 if ( $(this).val() == 0 ) {
2565 $("input[name=superadmin]")
2566 .prop("disabled", true)
2567 .prop("checked", false);
2568 $("select[name=entity]")
2569 .prop("disabled", false);
2571 $("input[name=superadmin]")
2572 .prop("disabled", false);
2575 $("input[name=superadmin]").change(function() {
2576 if ( $(this).is(":checked")) {
2577 $("select[name=entity]")
2578 .prop("disabled", true);
2580 $("select[name=entity]")
2581 .prop("disabled", false);
2588 $checked = ((
$object->admin && !
$object->entity) ?
' checked' :
'');
2589 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2593 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2594 print
'<input type="hidden" name="superadmin" value="'.(empty(
$object->entity) ? 1 : 0).
'">';
2596 print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2606 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2607 if ($permissiontoedit && !
$object->ldap_sid) {
2608 print $formcompany->select_civility(GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') :
$object->civility_code,
'civility_code');
2609 } elseif (
$object->civility_code) {
2610 print $langs->trans(
"Civility".
$object->civility_code);
2616 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2618 $arraygender = array(
'man' => $langs->trans(
"Genderman"),
'woman' => $langs->trans(
"Genderwoman"),
'other' => $langs->trans(
"Genderother"));
2619 if ($permissiontoedit) {
2620 print $form->selectarray(
'gender', $arraygender, GETPOSTISSET(
'gender') ?
GETPOST(
'gender') :
$object->gender, 1);
2622 print $arraygender[
$object->gender];
2628 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2629 if ($permissiontoedit) {
2630 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2633 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2642 if ($nbofusers > 1) {
2644 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2646 if ($permissiontoedit) {
2647 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');
2649 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2650 $huser =
new User($db);
2651 $huser->fetch(
$object->fk_user);
2652 print $huser->getNomUrl(-1);
2659 print
'<tr><td class="titlefieldcreate">';
2660 $text = $langs->trans(
"ForceUserExpenseValidator");
2661 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2664 if ($permissiontoedit) {
2665 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');
2667 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2668 $evuser =
new User($db);
2669 $evuser->fetch(
$object->fk_user_expense_validator);
2670 print $evuser->getNomUrl(-1);
2678 print
'<tr><td class="titlefieldcreate">';
2679 $text = $langs->trans(
"ForceUserHolidayValidator");
2680 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2683 if ($permissiontoedit) {
2684 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');
2686 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2687 $hvuser =
new User($db);
2688 $hvuser->fetch(
$object->fk_user_holiday_validator);
2689 print $hvuser->getNomUrl(-1);
2700 print
'<table class="border centpercent">';
2703 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2705 if ($permissiontoedit) {
2706 print $form->selectDate($datestartvalidity ? $datestartvalidity :
$object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
2712 if ($permissiontoedit) {
2713 print $form->selectDate($dateendvalidity ? $dateendvalidity :
$object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
2721 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2724 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2725 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2727 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2728 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto((string) $text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", (string) $dolibarr_main_authentication), 1,
'warning');
2730 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication) || preg_match(
'/forceuser/', $dolibarr_main_authentication)) {
2731 if ($permissiontoeditpasswordandsee) {
2732 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="minwidth300 maxwidth400 widthcentpercentminusx" id="password" name="password" value="'.
dol_escape_htmltag(
$object->pass).
'" autocomplete="new-password" spellcheck="false">';
2733 if (!empty($conf->use_javascript_ajax)) {
2734 $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').
'"');
2737 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*',
$object->pass);
2741 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpasswordandsee' => $permissiontoeditpasswordandsee,
'caneditpasswordandsend' => $permissiontoeditpasswordandsend);
2742 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2744 $valuetoshow = $hookmanager->resPrint;
2746 $valuetoshow .= $hookmanager->resPrint;
2750 print
"</td></tr>\n";
2755 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2757 if ($permissiontoeditpasswordandsee || $user->hasRight(
"api",
"apikey",
"generate")) {
2758 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" minlength="12" maxlength="128" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off" spellcheck="false">';
2759 if (!empty($conf->use_javascript_ajax)) {
2760 print
img_picto($langs->transnoentities(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject paddingleft"');
2768 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) &&
getDolGlobalString(
'MAIN_OPENIDURL_PERUSER')) {
2769 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2771 if ($permissiontoedit) {
2772 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2774 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2780 print
'</table><hr><table class="border centpercent">';
2784 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2786 if ($permissiontoedit) {
2787 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2790 if ($permissiontoedit) {
2791 print
'</textarea>';
2796 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2797 if ($permissiontoedit) {
2798 print $formcompany->select_ziptown((GETPOSTISSET(
'zipcode') ?
GETPOST(
'zipcode') :
$object->zip),
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2805 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2806 if ($permissiontoedit) {
2807 print $formcompany->select_ziptown((GETPOSTISSET(
'town') ?
GETPOST(
'town') :
$object->town),
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2814 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td>';
2815 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
2816 if ($permissiontoedit) {
2817 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') :
$object->country_id),
'country_id');
2819 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2823 print $countrylabel;
2829 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2830 if ($permissiontoedit) {
2831 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2832 print $formcompany->select_state_ajax(
'country_id',
$object->state_id,
$object->country_id,
'state_id');
2840 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2842 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2843 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2844 print
'<input type="text" name="office_phone" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_phone.
'">';
2846 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2852 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2854 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2855 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2856 print
'<input type="text" name="user_mobile" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->user_mobile.
'" spellcheck="false">';
2858 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2864 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2866 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2867 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2868 print
'<input type="text" name="office_fax" class="flat maxwidth200 widthcentpercentminusx" value="'.$object->office_fax.
'">';
2870 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2876 print
"<tr>".
'<td'.(
getDolGlobalString(
'USER_MAIL_REQUIRED') ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2878 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2879 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2880 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2882 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2888 foreach ($socialnetworks as $key => $value) {
2889 if ($value[
'active']) {
2890 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2892 if (!empty($value[
'icon'])) {
2893 print
'<span class="fab '.$value[
'icon'].
' pictofixedwidth"></span>';
2895 if ($permissiontoedit && empty(
$object->ldap_sid)) {
2896 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200 widthcentpercentminusx" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2898 print
'<input type="hidden" name="'.$key.
'" value="'.
$object->socialnetworks[$key].
'">';
2899 print
$object->socialnetworks[$key];
2904 print
'<input type="hidden" name="'.$key.
'" value="'.(isset(
$object->socialnetworks[$key]) ?
$object->socialnetworks[$key] :
'').
'">';
2909 print
'</table><hr><table class="border centpercent">';
2913 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2914 print $formproduct->selectWarehouses(
$object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2915 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>';
2922 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2924 if ($permissiontoedit) {
2925 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2927 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2928 print
$object->accountancy_code;
2936 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2938 if ($permissiontoedit) {
2939 print $formother->selectColor(GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') :
$object->color,
'color', null, 1, array(),
'hideifnotset');
2941 print $formother->showColor(
$object->color,
'');
2948 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2950 print $form->showphoto(
'userphoto', $object, 60, 0, (
int) $permissiontoedit,
'photowithmargin',
'small', 1, 0,
'user', 1);
2955 if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"read")) {
2956 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
2958 if ($permissiontoedit) {
2959 print $form->selectCategories(Categorie::TYPE_USER,
'usercats', $object);
2961 print $form->showCategories(
$object->id, Categorie::TYPE_USER, 1);
2968 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";
2969 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
$object->lang,
'default_lang', 0, array(),
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2975 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2977 print
$object->getLibStatut(4);
3005 $langs->load(
"members");
3006 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
3010 $adh->fetch(
$object->fk_member);
3011 $adh->ref = $adh->login;
3012 print $adh->getNomUrl(1);
3014 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
3024 if (!method_exists($mc,
'formObjectOptions')) {
3025 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
3026 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
3027 print
"<td>".$mc->select_entities(
$object->entity,
'entity',
'',
false,
true,
false,
false,
true);
3028 print
"</td></tr>\n";
3030 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
3036 $parameters = array(
'colspan' =>
' colspan="2"');
3038 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
3039 print $hookmanager->resPrint;
3040 if (empty($reshook)) {
3041 if ($permissiontoedit) {
3042 print
$object->showOptionals($extrafields,
'edit');
3044 print
$object->showOptionals($extrafields,
'view');
3049 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
3051 if ($permissiontoedit) {
3052 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
3054 $doleditor =
new DolEditor(
'signature',
$object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, !
getDolGlobalString(
'FCKEDITOR_ENABLE_USERSIGN') ? 0 : 1, ROWS_4,
'90%');
3055 print $doleditor->Create(1);
3067 print
'<table class="border centpercent">';
3073 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
3075 if ($permissiontoedit) {
3076 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3078 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag(
$object->job).
'">';
3084 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
3086 if ($permissiontoedit) {
3087 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') :
$object->weeklyhours).
'">';
3095 if ($permissiontoseesalary) {
3096 $langs->load(
"salaries");
3099 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
3101 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') :
$object->salary).
'">';
3102 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3108 $text = $langs->trans(
"THM");
3109 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
3112 if ($permissiontoedit) {
3113 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') :
$object->thm).
'">';
3114 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3116 print(
$object->thm !=
'' ?
price(
$object->thm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
3123 $text = $langs->trans(
"TJM");
3124 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
3127 if ($permissiontoedit) {
3128 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') :
$object->tjm).
'">';
3129 print
' <span class="opacitymedium">'.$langs->getCurrencySymbol().
'</span>';
3131 print(
$object->tjm !=
'' ?
price(
$object->tjm, 0, $langs, 1, -1, -1, $conf->currency) :
'');
3138 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
3140 if ($permissiontoedit) {
3141 print $form->selectDate($dateemployment ? $dateemployment :
$object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"from"));
3146 if ($dateemployment && $dateemploymentend) {
3150 if ($permissiontoedit) {
3151 print $form->selectDate($dateemploymentend ? $dateemploymentend :
$object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
"to"));
3159 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
3161 if ($permissiontoedit) {
3162 echo $form->selectDate($dateofbirth ? $dateofbirth :
$object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
3173 print
'<div class="center">';
3174 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
3175 print
' ';
3176 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
3182 if ($action !=
'edit' && $action !=
'presend') {
3183 print
'<div class="fichecenter"><div class="fichehalfleft">';
3188 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".
$object->id;
3189 $genallowed = $user->hasRight(
"user",
"user",
"read");
3190 $delallowed = $user->hasRight(
"user",
"user",
"write");
3195 $societe->fetch(
$object->socid);
3200 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);
3201 $somethingshown = $formfile->numoffiles;
3204 $tmparray = $form->showLinkToObjectBlock($object, array(), array(), 1);
3205 $linktoelem = $tmparray[
'linktoelem'];
3206 $htmltoenteralink = $tmparray[
'htmltoenteralink'];
3207 print $htmltoenteralink;
3209 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
3213 $morehtmlcenter =
'<div class="nowraponall">';
3214 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'FullConversation'),
'',
'fa fa-comments imgforviewmode', DOL_URL_ROOT.
'/user/messaging.php?id='.
$object->id);
3215 $morehtmlcenter .=
dolGetButtonTitle($langs->trans(
'SeeAll'),
'',
'fa fa-bars imgforviewmode', DOL_URL_ROOT.
'/user/agenda.php?id='.
$object->id);
3216 $morehtmlcenter .=
'</div>';
3218 print
'</div><div class="fichehalfright">';
3221 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
3223 $somethingshown = $formactions->showactions($object,
'user', $socid, 1,
'listactions', $MAXEVENT,
'', $morehtmlcenter,
$object->id);
3225 print
'</div></div>';
3235include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage members of a foundation.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
addFileIntoDatabaseIndex($dir, $file, $fullpathorig='', $mode='uploaded', $setsharekey=0, $object=null, $forceFullTextIndexation='')
Add a file into database index.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
deleteFilesIntoDatabaseIndex($dir, $file, $mode='uploaded', $object=null)
Delete files into database index using search criteria.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dol_print_email($email, $contactid=0, $socid=0, $addlink=0, $max=0, $showinvalid=2, $withpicto=0, $morecss='paddingrightonly')
Show EMail link formatted for HTML output.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolUserInt($key, $default=0, $tmpuser=null)
Return Dolibarr user constant int value.
dolBuildUrl($url, $params=[], $addtoken=false)
Return path of url.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $disabled='', $morecss='classlink button bordertransp', $jsonopen='', $jsonclose='', $accesskey='')
Return HTML code to output a button to open a dialog popup box.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
currentToken()
Return the value of token currently saved into session with name 'token'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOSTFLOAT($paramname, $rounding='', $option=2)
Return the value of a $_GET or $_POST supervariable, converted into float.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getArrayOfSocialNetworks()
Get array of social network dictionary.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_clone($srcobject, $native=2)
Create a clone of instance of object (new instance with same value for each properties) With native =...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getEntity($element, $shared=1, $currentobject=null)
Get list of entity id to use.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
div refaddress div address
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
$conf db user
Active Directory does not allow anonymous connections.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...
$conf db name
Only used if Module[ID]Name translation string is not found.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token', $generic=1)
Output javascript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
dol_verifyHash($chain, $hash, $type='0')
Compute a hash and compare it to the given one For backward compatibility reasons,...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.