39 require
'../main.inc.php';
40 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
51 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
52 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
53 if (!empty($conf->ldap->enabled)) {
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
57 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
60 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
67 $action =
GETPOST(
'action',
'aZ09');
68 $mode =
GETPOST(
'mode',
'alpha');
69 $confirm =
GETPOST(
'confirm',
'alpha');
70 $group =
GETPOST(
"group",
"int", 3);
71 $cancel =
GETPOST(
'cancel',
'alpha');
72 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
74 $dateemployment =
dol_mktime(0, 0, 0,
GETPOST(
'dateemploymentmonth',
'int'),
GETPOST(
'dateemploymentday',
'int'),
GETPOST(
'dateemploymentyear',
'int'));
75 $dateemploymentend =
dol_mktime(0, 0, 0,
GETPOST(
'dateemploymentendmonth',
'int'),
GETPOST(
'dateemploymentendday',
'int'),
GETPOST(
'dateemploymentendyear',
'int'));
76 $datestartvalidity =
dol_mktime(0, 0, 0,
GETPOST(
'datestartvaliditymonth',
'int'),
GETPOST(
'datestartvalidityday',
'int'),
GETPOST(
'datestartvalidityyear',
'int'));
77 $dateendvalidity =
dol_mktime(0, 0, 0,
GETPOST(
'dateendvaliditymonth',
'int'),
GETPOST(
'dateendvalidityday',
'int'),
GETPOST(
'dateendvalidityyear',
'int'));
81 $canadduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
82 $canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
83 $canedituser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
84 $candisableuser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
85 $canreadgroup = $canreaduser;
86 $caneditgroup = $canedituser;
87 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
88 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
89 $caneditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
92 $childids = $user->getAllChildIds(1);
97 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
98 $caneditpassword = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
103 if ($user->socid > 0) {
104 $socid = $user->socid;
109 if ($user->id != $id && !$canreaduser) {
114 $langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
116 $object =
new User($db);
120 $extrafields->fetch_name_optionals_label($object->table_element);
125 $hookmanager->initHooks(array(
'usercard',
'globalcard'));
137 $parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $caneditgroup);
138 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
143 if (empty($reshook)) {
144 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
146 if (empty($backtopage) || ($cancel && empty($id))) {
147 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
148 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
149 $backtopage = $backurlforlist;
151 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
157 if (!empty($backtopageforcancel)) {
158 header(
"Location: ".$backtopageforcancel);
160 } elseif (!empty($backtopage)) {
161 header(
"Location: ".$backtopage);
167 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $candisableuser) {
168 if ($id != $user->id) {
170 if ($object->admin && empty($user->admin)) {
173 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
175 $object->setstatus(0);
176 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
182 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $candisableuser) {
185 if ($id != $user->id) {
188 if (!empty($conf->file->main_limit_users)) {
189 $nb = $object->getNbOfUsers(
"active");
190 if ($nb >= $conf->file->main_limit_users) {
192 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
197 $object->setstatus(1);
198 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
204 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $candisableuser) {
205 if ($id != $user->id) {
207 print
'Error, token required for this critical operation';
211 $object =
new User($db);
213 $object->oldcopy = clone $object;
215 $result = $object->delete($user);
217 $langs->load(
"errors");
221 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
228 if ($action ==
'add' && $canadduser) {
242 if (!empty($conf->file->main_limit_users)) {
243 $nb = $object->getNbOfUsers(
"active");
244 if ($nb >= $conf->file->main_limit_users) {
246 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
252 $object->civility_code =
GETPOST(
"civility_code",
'aZ09');
253 $object->lastname =
GETPOST(
"lastname",
'alphanohtml');
254 $object->firstname =
GETPOST(
"firstname",
'alphanohtml');
255 $object->ref_employee =
GETPOST(
"ref_employee",
'alphanohtml');
256 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
257 $object->login =
GETPOST(
"login",
'alphanohtml');
258 $object->api_key =
GETPOST(
"api_key",
'alphanohtml');
259 $object->gender =
GETPOST(
"gender",
'aZ09');
260 $object->admin =
GETPOST(
"admin",
'int');
261 $object->address =
GETPOST(
'address',
'alphanohtml');
262 $object->zip =
GETPOST(
'zipcode',
'alphanohtml');
263 $object->town =
GETPOST(
'town',
'alphanohtml');
264 $object->country_id =
GETPOST(
'country_id',
'int');
265 $object->state_id =
GETPOST(
'state_id',
'int');
266 $object->office_phone =
GETPOST(
"office_phone",
'alphanohtml');
267 $object->office_fax =
GETPOST(
"office_fax",
'alphanohtml');
268 $object->user_mobile =
GETPOST(
"user_mobile",
'alphanohtml');
271 $object->socialnetworks = array();
272 foreach ($socialnetworks as $key => $value) {
273 if (
GETPOST($key,
'alphanohtml')) {
274 $object->socialnetworks[$key] =
GETPOST($key,
'alphanohtml');
279 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
280 $object->job =
GETPOST(
"job",
'alphanohtml');
281 $object->signature =
GETPOST(
"signature",
'restricthtml');
282 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
283 $object->note_public =
GETPOST(
"note_public",
'restricthtml');
284 $object->note_private =
GETPOST(
"note_private",
'restricthtml');
285 $object->ldap_sid =
GETPOST(
"ldap_sid",
'alphanohtml');
286 $object->fk_user =
GETPOST(
"fk_user",
'int') > 0 ?
GETPOST(
"fk_user",
'int') : 0;
287 $object->fk_user_expense_validator =
GETPOST(
"fk_user_expense_validator",
'int') > 0 ?
GETPOST(
"fk_user_expense_validator",
'int') : 0;
288 $object->fk_user_holiday_validator =
GETPOST(
"fk_user_holiday_validator",
'int') > 0 ?
GETPOST(
"fk_user_holiday_validator",
'int') : 0;
289 $object->employee =
GETPOST(
'employee',
'alphanohtml');
291 $object->thm =
GETPOST(
"thm",
'alphanohtml') !=
'' ?
GETPOST(
"thm",
'alphanohtml') :
'';
293 $object->tjm =
GETPOST(
"tjm",
'alphanohtml') !=
'' ?
GETPOST(
"tjm",
'alphanohtml') :
'';
295 $object->salary =
GETPOST(
"salary",
'alphanohtml') !=
'' ?
GETPOST(
"salary",
'alphanohtml') :
'';
296 $object->salary =
price2num($object->salary);
297 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
298 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
300 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ?
GETPOST(
"color",
'alphanohtml') :
'';
302 $object->dateemployment = $dateemployment;
303 $object->dateemploymentend = $dateemploymentend;
304 $object->datestartvalidity = $datestartvalidity;
305 $object->dateendvalidity = $dateendvalidity;
306 $object->birth = $dateofbirth;
308 $object->fk_warehouse =
GETPOST(
'fk_warehouse',
'int');
310 $object->lang =
GETPOST(
'default_lang',
'aZ09');
313 $ret = $extrafields->setOptionalsFromPost(
null, $object);
319 $entity =
GETPOST(
'entity',
'int');
321 if (
GETPOST(
'superadmin',
'int')) {
324 if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
327 $object->entity = ($entity ==
'' ? 1 : $entity);
331 $object->entity = ($entity ==
'' ? 1 : $entity);
339 $id = $object->create($user);
342 if (
GETPOST(
'password',
'none')) {
343 $resPass = $object->setPassword($user,
GETPOST(
'password',
'none'));
346 $langs->load(
"errors");
351 if (!empty($conf->categorie->enabled)) {
353 $usercats =
GETPOST(
'usercats',
'array');
354 $object->setCategories($usercats);
358 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
362 $langs->load(
"errors");
371 if (($action ==
'addgroup' || $action ==
'removegroup') && $caneditgroup) {
374 $editgroup->fetch($group);
375 $editgroup->oldcopy = clone $editgroup;
378 if ($action ==
'addgroup') {
379 $result = $object->SetInGroup($group, $editgroup->entity);
381 if ($action ==
'removegroup') {
382 $result = $object->RemoveFromGroup($group, $editgroup->entity);
393 if ($action ==
'update' && !$cancel) {
394 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
399 if (!
GETPOST(
"lastname",
'alpha')) {
404 if (!
GETPOST(
"login",
'alpha')) {
413 $object->oldcopy = clone $object;
417 $object->civility_code =
GETPOST(
"civility_code",
'aZ09');
418 $object->lastname =
GETPOST(
"lastname",
'alphanohtml');
419 $object->firstname =
GETPOST(
"firstname",
'alphanohtml');
420 $object->ref_employee =
GETPOST(
"ref_employee",
'alphanohtml');
421 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
422 $object->gender =
GETPOST(
"gender",
'aZ09');
423 $object->pass =
GETPOST(
"password",
'none');
424 $object->api_key = (
GETPOST(
"api_key",
'alphanohtml')) ?
GETPOST(
"api_key",
'alphanohtml') : $object->api_key;
425 if (!empty($user->admin)) {
426 $object->admin =
GETPOST(
"admin",
"int");
428 if ($user->admin && !$object->ldap_sid) {
429 $object->login =
GETPOST(
"login",
'alphanohtml');
431 $object->address =
GETPOST(
'address',
'alphanohtml');
432 $object->zip =
GETPOST(
'zipcode',
'alphanohtml');
433 $object->town =
GETPOST(
'town',
'alphanohtml');
434 $object->country_id =
GETPOST(
'country_id',
'int');
435 $object->state_id =
GETPOST(
'state_id',
'int');
436 $object->office_phone =
GETPOST(
"office_phone",
'alphanohtml');
437 $object->office_fax =
GETPOST(
"office_fax",
'alphanohtml');
438 $object->user_mobile =
GETPOST(
"user_mobile",
'alphanohtml');
441 $object->socialnetworks = array();
442 foreach ($socialnetworks as $key => $value) {
443 if (
GETPOST($key,
'alphanohtml')) {
444 $object->socialnetworks[$key] =
GETPOST($key,
'alphanohtml');
449 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
450 $object->job =
GETPOST(
"job",
'alphanohtml');
451 $object->signature =
GETPOST(
"signature",
'restricthtml');
452 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
453 $object->openid =
GETPOST(
"openid",
'alphanohtml');
454 $object->fk_user =
GETPOST(
"fk_user",
'int') > 0 ?
GETPOST(
"fk_user",
'int') : 0;
455 $object->fk_user_expense_validator =
GETPOST(
"fk_user_expense_validator",
'int') > 0 ?
GETPOST(
"fk_user_expense_validator",
'int') : 0;
456 $object->fk_user_holiday_validator =
GETPOST(
"fk_user_holiday_validator",
'int') > 0 ?
GETPOST(
"fk_user_holiday_validator",
'int') : 0;
457 $object->employee =
GETPOST(
'employee',
'int');
459 $object->thm =
GETPOST(
"thm",
'alphanohtml') !=
'' ?
GETPOST(
"thm",
'alphanohtml') :
'';
461 $object->tjm =
GETPOST(
"tjm",
'alphanohtml') !=
'' ?
GETPOST(
"tjm",
'alphanohtml') :
'';
463 $object->salary =
GETPOST(
"salary",
'alphanohtml') !=
'' ?
GETPOST(
"salary",
'alphanohtml') :
'';
464 $object->salary =
price2num($object->salary);
465 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
466 $object->salaryextra =
price2num($object->salaryextra);
467 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
468 $object->weeklyhours =
price2num($object->weeklyhours);
470 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ?
GETPOST(
"color",
'alphanohtml') :
'';
471 $object->dateemployment = $dateemployment;
472 $object->dateemploymentend = $dateemploymentend;
473 $object->datestartvalidity = $datestartvalidity;
474 $object->dateendvalidity = $dateendvalidity;
475 $object->birth = $dateofbirth;
478 $object->fk_warehouse =
GETPOST(
'fk_warehouse',
'int');
481 $object->lang =
GETPOST(
'default_lang',
'aZ09');
484 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
485 if (
GETPOST(
'superadmin',
'int')) {
488 if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
498 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
506 if (!empty($_FILES[
'photo'][
'name'])) {
512 $langs->load(
"errors");
514 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
519 $ret = $object->update($user);
522 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
523 $langs->load(
"errors");
524 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $object->login),
null,
'errors');
533 $contactid =
GETPOST(
'contactid',
'int');
534 $socid =
GETPOST(
'socid',
'int');
536 if ($contactid > 0) {
538 $contact->fetch($contactid);
540 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
541 $sql .=
" SET fk_socpeople=".((int) $contactid);
542 if (!empty($contact->socid)) {
543 $sql .=
", fk_soc=".((int) $contact->socid);
544 } elseif ($socid > 0) {
545 $sql .=
", fk_soc = null";
546 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
null,
'warnings');
548 $sql .=
" WHERE rowid = ".((int) $object->id);
549 } elseif ($socid > 0) {
550 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
551 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
552 $sql .=
" WHERE rowid = ".((int) $object->id);
554 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
555 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
556 $sql .=
" WHERE rowid = ".((int) $object->id);
559 $resql = $db->query($sql);
566 if (!$error && !count($object->errors)) {
567 if (
GETPOST(
'deletephoto') && $object->oldcopy->photo) {
568 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.$object->oldcopy->photo;
569 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
574 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
575 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
581 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
583 if (!($result > 0)) {
587 $object->addThumbs($newfile);
591 $langs->load(
"errors");
592 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
597 if (!$error && !count($object->errors)) {
599 $categories =
GETPOST(
'usercats',
'array');
600 $object->setCategories($categories);
603 if (!$error && !count($object->errors)) {
607 $login = $_SESSION[
"dol_login"];
608 if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) {
610 $langs->load(
"errors");
611 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
618 if ($caneditpassword) {
619 dol_syslog(
"Not allowed to change fields, only password");
623 if (
GETPOST(
"password",
"none")) {
624 $object->oldcopy = clone $object;
626 $ret = $object->setPassword($user,
GETPOST(
"password",
"none"));
636 if ((($action ==
'confirm_password' && $confirm ==
'yes')
637 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes')) && $caneditpassword
641 $newpassword = $object->setPassword($user,
'');
642 if ($newpassword < 0) {
644 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
647 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
648 if ($object->send_password($user, $newpassword) > 0) {
649 setEventMessages($langs->trans(
"PasswordChangedAndSentTo", $object->email),
null,
'mesgs');
654 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
660 if ($action ==
'adduserldap' && $canadduser) {
661 $selecteduser =
GETPOST(
'users');
663 $required_fields = array(
664 $conf->global->LDAP_KEY_USERS,
665 $conf->global->LDAP_FIELD_NAME,
666 $conf->global->LDAP_FIELD_FIRSTNAME,
667 $conf->global->LDAP_FIELD_LOGIN,
668 $conf->global->LDAP_FIELD_LOGIN_SAMBA,
669 $conf->global->LDAP_FIELD_PASSWORD,
670 $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
671 $conf->global->LDAP_FIELD_PHONE,
672 $conf->global->LDAP_FIELD_FAX,
673 $conf->global->LDAP_FIELD_MOBILE,
674 $conf->global->LDAP_FIELD_SKYPE,
675 $conf->global->LDAP_FIELD_MAIL,
676 $conf->global->LDAP_FIELD_TITLE,
677 $conf->global->LDAP_FIELD_DESCRIPTION,
678 $conf->global->LDAP_FIELD_SID
682 $result = $ldap->connect_bind();
685 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
687 $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields);
690 if (is_array($ldapusers)) {
691 foreach ($ldapusers as $key => $attribute) {
692 $ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME];
693 $ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME];
694 $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN];
695 $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA];
696 $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD];
697 $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED];
698 $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE];
699 $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX];
700 $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE];
701 $ldap_social[
'skype'] = $attribute[$conf->global->LDAP_FIELD_SKYPE];
702 $ldap_social[
'twitter'] = $attribute[$conf->global->LDAP_FIELD_TWITTER];
703 $ldap_social[
'facebook'] = $attribute[$conf->global->LDAP_FIELD_FACEBOOK];
704 $ldap_social[
'linkedin'] = $attribute[$conf->global->LDAP_FIELD_LINKEDIN];
705 $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL];
706 $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
715 $triggersendname =
'USER_SENTBYMAIL';
717 $mode =
'emailfromuser';
718 $trackid =
'use'.$id;
719 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
722 $upload_dir = $conf->user->dir_output;
723 $permissiontoadd = $user->hasRight(
"user",
"user",
"write");
724 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
741 if ($object->id > 0) {
742 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
743 $title = $person_name.
" - ".$langs->trans(
'Card');
745 $title = $langs->trans(
"NewUser");
752 if ($action ==
'create' || $action ==
'adduserldap') {
755 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
762 $result = $ldap->connect_bind();
764 $required_fields = array(
765 $conf->global->LDAP_KEY_USERS,
766 $conf->global->LDAP_FIELD_FULLNAME,
767 $conf->global->LDAP_FIELD_NAME,
768 $conf->global->LDAP_FIELD_FIRSTNAME,
769 $conf->global->LDAP_FIELD_LOGIN,
770 $conf->global->LDAP_FIELD_LOGIN_SAMBA,
771 $conf->global->LDAP_FIELD_PASSWORD,
772 $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
773 $conf->global->LDAP_FIELD_PHONE,
774 $conf->global->LDAP_FIELD_FAX,
775 $conf->global->LDAP_FIELD_MOBILE,
776 $conf->global->LDAP_FIELD_SKYPE,
777 $conf->global->LDAP_FIELD_MAIL,
778 $conf->global->LDAP_FIELD_TITLE,
779 $conf->global->LDAP_FIELD_DESCRIPTION,
780 $conf->global->LDAP_FIELD_SID
784 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
787 $ldapusers = $ldap->getRecords(
'*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
789 if (is_array($ldapusers)) {
791 foreach ($ldapusers as $key => $ldapuser) {
794 foreach ($required_fields as $value) {
795 if ($value === $conf->global->LDAP_FIELD_PASSWORD || $value === $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) {
796 $label .= $value.
"=******* ";
798 $label .= $value.
"=".$ldapuser[$value].
" ";
801 $liste[$key] = $label;
811 print
"\n\n<!-- Form liste LDAP debut -->\n";
813 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
814 print
'<input type="hidden" name="token" value="'.newToken().
'">';
815 print
'<table class="border centpercent"><tr>';
816 print
'<td width="160">';
817 print $langs->trans(
"LDAPUsers");
820 print
'<input type="hidden" name="action" value="adduserldap">';
821 if (is_array($liste) && count($liste)) {
822 print
$form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
825 print
'</td><td class="center">';
826 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
827 print
'</td></tr></table>';
830 print
"\n<!-- Form liste LDAP fin -->\n\n";
835 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
836 print
'<input type="hidden" name="token" value="'.newToken().
'">';
837 print
'<input type="hidden" name="action" value="add">';
838 if (!empty($ldap_sid)) {
839 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
841 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
847 print
'<table class="border centpercent">';
850 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
851 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') : $object->civility_code,
'civility_code');
856 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
858 if (!empty($ldap_lastname)) {
859 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
860 print $ldap_lastname;
862 print
'<input class="minwidth100 maxwidth150onsmartphone" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
867 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
869 if (!empty($ldap_firstname)) {
870 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
871 print $ldap_firstname;
873 print
'<input class="minwidth100 maxwidth150onsmartphone" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
878 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
880 if (!empty($ldap_login)) {
881 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
883 } elseif (!empty($ldap_loginsmb)) {
884 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
885 print $ldap_loginsmb;
887 print
'<input class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
891 $generated_password =
'';
892 if (empty($ldap_sid)) {
898 if (!empty($user->admin)) {
899 print
'<tr><td>'.$langs->trans(
"Administrator").
'</td>';
904 if (!empty($conf->use_javascript_ajax)) {
905 print
'<script type="text/javascript">
907 $("select[name=admin]").change(function() {
908 if ( $(this).val() == 0 ) {
909 $("input[name=superadmin]")
910 .prop("disabled", true)
911 .prop("checked", false);
912 $("select[name=entity]")
913 .prop("disabled", false);
915 $("input[name=superadmin]")
916 .prop("disabled", false);
919 $("input[name=superadmin]").change(function() {
920 if ( $(this).is(":checked") ) {
921 $("select[name=entity]")
922 .prop("disabled", true);
924 $("select[name=entity]")
925 .prop("disabled", false);
931 $checked = (
GETPOST(
'superadmin',
'int') ?
' checked' :
'');
932 $disabled = (
GETPOST(
'superadmin',
'int') ?
'' :
' disabled');
933 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.$disabled.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
935 print
"</td></tr>\n";
939 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
941 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
942 print
$form->selectarray(
'gender', $arraygender,
GETPOST(
'gender'), 1);
946 $defaultemployee =
'1';
948 print
'<td>'.$langs->trans(
'Employee').
'</td><td>';
949 print
'<input type="checkbox" name="employee" value="1"'.(GETPOST(
'employee') ==
'1' ?
' checked="checked"' : (($defaultemployee && !
GETPOSTISSET(
'login')) ?
' checked="checked"' :
'')).
'>';
954 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
956 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($object->fk_user,
'fk_user', 1, array($object->id), 0,
'', 0, $conf->entity, 0, 0,
'', 0,
'',
'maxwidth300 widthcentpercentminusx');
962 print
'<tr><td class="titlefieldcreate">';
963 $text = $langs->trans(
"ForceUserExpenseValidator");
964 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
967 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array($object->id), 0,
'', 0, $conf->entity, 0, 0,
'', 0,
'',
'maxwidth300 widthcentpercentminusx');
974 print
'<tr><td class="titlefieldcreate">';
975 $text = $langs->trans(
"ForceUserHolidayValidator");
976 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
979 print
img_picto(
'',
'user',
'class="pictofixedwidth"').$form->select_dolusers($object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array($object->id), 0,
'', 0, $conf->entity, 0, 0,
'', 0,
'',
'maxwidth300 widthcentpercentminusx');
985 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
987 print
$form->textwithpicto($langs->trans(
"Internal"), $langs->trans(
"InternalExternalDesc"), 1,
'help',
'', 0, 2);
991 print
'</table><hr><table class="border centpercent">';
995 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
997 print
$form->selectDate($datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 1);
1001 print
$form->selectDate($dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0);
1006 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Password").
'</td>';
1009 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1010 $valuetoshow .= ($valuetoshow ?
' + ' :
'').$langs->trans(
"PasswordOfUserInLDAP").
' (hidden)';
1012 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1013 $valuetoshow .= ($valuetoshow ?
' + ' :
'').$langs->trans(
"HTTPBasicPassword");
1015 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication)) {
1016 if (!empty($ldap_pass)) {
1017 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1018 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1021 $valuetoshow .= ($valuetoshow ?
' + '.$langs->trans(
"DolibarrPassword") :
'').
'<input maxsize="32" type="text" name="password" value="'.
dol_escape_htmltag($password).
'" autocomplete="new-password">';
1026 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
1027 $reshook = $hookmanager->executeHooks(
'printUserPasswordField',
$parameters, $object, $action);
1029 $valuetoshow = $hookmanager->resPrint;
1031 $valuetoshow .= $hookmanager->resPrint;
1037 if (!empty($conf->api->enabled)) {
1040 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1042 print
'<input class="minwidth300 widthcentpercentminusx" maxsize="32" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off">';
1043 if (!empty($conf->use_javascript_ajax)) {
1044 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject"');
1050 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1054 print
'</table><hr><table class="border centpercent">';
1058 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1059 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1060 print $object->address;
1061 print
'</textarea></td></tr>';
1064 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1065 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1069 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1070 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1074 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1075 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1076 print
$form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id));
1078 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1083 if (empty($conf->global->USER_DISABLE_STATE)) {
1084 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1085 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1086 print $formcompany->select_state($object->state_id, $object->country_code,
'state_id');
1091 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1093 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1094 if (!empty($ldap_phone)) {
1095 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1098 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1103 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1105 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1106 if (!empty($ldap_mobile)) {
1107 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1110 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1115 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1117 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1118 if (!empty($ldap_fax)) {
1119 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1122 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1127 print
'<tr><td'.(!empty($conf->global->USER_MAIL_REQUIRED) ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1129 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1130 if (!empty($ldap_mail)) {
1131 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1134 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1140 foreach ($socialnetworks as $key => $value) {
1141 if ($value[
'active']) {
1142 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1144 if (!empty($value[
'icon'])) {
1145 print
'<span class="fa '.$value[
'icon'].
' pictofixedwidth"></span>';
1147 if (!empty($ldap_social[$key])) {
1148 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1149 print $ldap_social[$key];
1151 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1156 if (!empty($ldap_social[$key])) {
1157 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1159 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1167 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1169 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1175 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1177 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') : $object->color,
'color',
null, 1,
'',
'hideifnotset');
1182 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
1183 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1184 $cate_arbo =
$form->select_all_categories(
'user',
null,
'parent',
null,
null, 1);
1185 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1190 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1191 print
'<td class="maxwidthonsmartphone">'.
"\n";
1192 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language(
GETPOST(
'default_lang',
'alpha') ?
GETPOST(
'default_lang',
'alpha') : ($object->lang ? $object->lang :
''),
'default_lang', 0, 0, 1, 0, 0,
'maxwidth200onsmartphone widthcentpercentminusx');
1200 if (!method_exists($mc,
'formObjectOptions')) {
1201 if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
1202 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1203 print
"<td>".$mc->select_entities($conf->entity);
1204 print
"</td></tr>\n";
1206 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1213 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1216 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1217 print
'<td class="wordbreak">';
1218 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1220 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4,
'90%');
1221 print $doleditor->Create(1);
1225 print
'<tr><td class="tdtop">';
1226 print $langs->trans(
"NotePublic");
1228 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1229 $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%');
1230 $doleditor->Create();
1231 print
"</td></tr>\n";
1234 print
'<tr><td class="tdtop">';
1235 print $langs->trans(
"NotePrivate");
1237 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1238 $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%');
1239 $doleditor->Create();
1240 print
"</td></tr>\n";
1242 print
'</table><hr><table class="border centpercent">';
1248 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
1249 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1250 print $formproduct->selectWarehouses($object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1255 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1257 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1260 if ((!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1261 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
1262 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1263 $langs->load(
"salaries");
1267 $text = $langs->trans(
"THM");
1268 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1271 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1277 $text = $langs->trans(
"TJM");
1278 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1281 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1286 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1288 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1294 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1296 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1301 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1303 print
$form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1);
1307 print
$form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0);
1312 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1314 print
$form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1322 print
$form->buttonsSaveCancel(
"CreateUser");
1328 $res = $object->fetch($id,
'',
'', 1);
1333 $res = $object->fetch_optionals();
1336 if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
1337 $object->getrights();
1338 if (empty($object->nb_rights) && $object->statut != 0 && empty($object->admin)) {
1345 if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
1347 $result = $ldap->connect_bind();
1349 $userSearchFilter =
'('.$conf->global->LDAP_FILTER_CONNECTION.
'('.$ldap->getUserIdentifier().
'='.$object->login.
'))';
1350 $entries = $ldap->fetch($object->login, $userSearchFilter);
1355 $passDoNotExpire = 0;
1356 $userChangePassNextLogon = 0;
1361 if (count($ldap->uacf) > 0) {
1362 foreach ($ldap->uacf as $key => $statut) {
1363 if ($key == 65536) {
1364 $passDoNotExpire = 1;
1365 $statutUACF = $statut;
1370 $statutUACF =
"ACCOUNTDISABLE";
1373 if ($ldap->pwdlastset == 0) {
1374 $userChangePassNextLogon = 1;
1380 if ($mode ==
'employee') {
1381 $title = $langs->trans(
"Employee");
1382 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1384 $title = $langs->trans(
"User");
1387 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1388 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1397 if ($action ==
'password') {
1398 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword", $object->login),
"confirm_password",
'', 0, 1);
1404 if ($action ==
'passwordsend') {
1405 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword", $object->login),
"confirm_passwordsend",
'', 0, 1);
1411 if ($action ==
'disable') {
1412 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser", $object->login),
"confirm_disable",
'', 0, 1);
1418 if ($action ==
'enable') {
1419 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser", $object->login),
"confirm_enable",
'', 0, 1);
1425 if ($action ==
'delete') {
1426 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser", $object->login),
"confirm_delete",
'', 0, 1);
1432 if ($action !=
'edit') {
1435 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
1436 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1437 $morehtmlref .=
'</a>';
1439 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1441 print
'<div class="fichecenter">';
1442 print
'<div class="fichehalfleft">';
1444 print
'<div class="underbanner clearboth"></div>';
1445 print
'<table class="border tableforfield centpercent">';
1448 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1449 if (!empty($object->ldap_sid) && $object->statut == 0) {
1450 print
'<td class="error">';
1451 print $langs->trans(
"LoginAccountDisableInDolibarr");
1456 if (property_exists($object,
'admin')) {
1457 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
1458 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1459 } elseif (!empty($object->admin)) {
1460 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1470 $text = $langs->trans(
"Type");
1471 print
$form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1473 $type = $langs->trans(
"Internal");
1474 if ($object->socid > 0) {
1475 $type = $langs->trans(
"External");
1477 print
'<span class="badgeneutral">';
1479 if ($object->ldap_sid) {
1480 print
' ('.$langs->trans(
"DomainUser").
')';
1483 print
'</td></tr>'.
"\n";
1486 if ($object->ldap_sid) {
1487 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1488 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1489 print
'</td></tr>'.
"\n";
1493 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1494 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1496 print
'</td></tr>'.
"\n";
1501 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1503 if (empty($object->fk_user)) {
1504 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1506 $huser =
new User($db);
1507 if ($object->fk_user > 0) {
1508 $huser->fetch($object->fk_user);
1509 print $huser->getNomUrl(1);
1511 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1520 $text = $langs->trans(
"ForceUserExpenseValidator");
1521 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1524 if (!empty($object->fk_user_expense_validator)) {
1525 $evuser =
new User($db);
1526 $evuser->fetch($object->fk_user_expense_validator);
1527 print $evuser->getNomUrl(1);
1536 $text = $langs->trans(
"ForceUserHolidayValidator");
1537 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1540 if (!empty($object->fk_user_holiday_validator)) {
1541 $hvuser =
new User($db);
1542 $hvuser->fetch($object->fk_user_holiday_validator);
1543 print $hvuser->getNomUrl(1);
1550 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1551 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
1555 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1562 if ((empty($user->socid) && in_array($id, $childids))
1563 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
1564 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1565 $langs->load(
"salaries");
1568 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1570 print ($object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1576 $text = $langs->trans(
"THM");
1577 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1580 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1586 $text = $langs->trans(
"TJM");
1587 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1590 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1596 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1598 if ($object->dateemployment) {
1599 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1602 if ($object->dateemploymentend) {
1603 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1610 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1617 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
1618 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1619 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1620 if ($object->fk_warehouse > 0) {
1621 $warehousestatic =
new Entrepot($db);
1622 $warehousestatic->fetch($object->fk_warehouse);
1623 print $warehousestatic->getNomUrl(1);
1631 print
'<div class="fichehalfright">';
1633 print
'<div class="underbanner clearboth"></div>';
1635 print
'<table class="border tableforfield centpercent">';
1639 print
'<tr><td class="titlefield">'.$langs->trans(
"ColorUser").
'</td>';
1641 print $formother->showColor($object->color,
'');
1647 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
1648 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td>';
1649 print
'<td colspan="3">';
1650 print
$form->showCategories($object->id, Categorie::TYPE_USER, 1);
1656 $langs->load(
"languages");
1657 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1658 print
'<tr><td class="titlefield">';
1659 print
$form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1663 $labellang = ($object->lang ? $langs->trans(
'Language_'.$object->lang) :
'');
1664 print
picto_from_langcode($object->lang,
'class="paddingrightonly saturatemedium opacitylow"');
1669 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) {
1670 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1671 print
'<td>'.$object->openid.
'</td>';
1678 if (!method_exists($mc,
'formObjectOptions')) {
1679 if (
isModEnabled(
'multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
1680 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1681 if (empty($object->entity)) {
1682 print $langs->trans(
"AllEntities");
1684 $mc->getInfo($object->entity);
1687 print
"</td></tr>\n";
1693 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1697 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1700 if (isset($object->socid) && $object->socid > 0) {
1702 $societe->fetch($object->socid);
1703 if ($societe->id > 0) {
1704 $s .= $societe->getNomUrl(1,
'');
1707 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1709 if (!empty($object->contact_id)) {
1711 $contact->fetch($object->contact_id);
1712 if ($contact->id > 0) {
1713 if ($object->socid > 0 && $s) {
1718 $s .= $contact->getNomUrl(1,
'');
1728 $langs->load(
"members");
1729 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1731 if ($object->fk_member) {
1733 $adh->fetch($object->fk_member);
1734 $adh->ref = $adh->getFullname($langs);
1735 print $adh->getNomUrl(-1);
1737 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1744 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1746 print
"</td></tr>\n";
1753 print
'<div class="div-table-responsive-no-min">';
1754 print
'<table class="border tableforfield centpercent">';
1755 print
'<tr class="liste_titre"><td class="liste_titre">';
1756 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Credentials");
1758 print
'<td class="liste_titre"></td>';
1762 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1764 if ($object->datestartvalidity) {
1765 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1768 if ($object->dateendvalidity) {
1769 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1777 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1778 if (!empty($object->ldap_sid)) {
1779 if ($passDoNotExpire) {
1780 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1781 } elseif ($userChangePassNextLogon) {
1782 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1783 } elseif ($userDisabled) {
1784 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1786 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1789 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1792 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1793 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1814 $parameters = array(
'valuetoshow' => $valuetoshow);
1815 $reshook = $hookmanager->executeHooks(
'printUserPasswordField',
$parameters, $object, $action);
1817 $valuetoshow = $hookmanager->resPrint;
1819 $valuetoshow .= $hookmanager->resPrint;
1823 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"Password").
'</td>';
1824 print
'<td class="wordbreak">';
1831 if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1832 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1834 if (!empty($object->api_key)) {
1835 print
'<span class="opacitymedium">';
1842 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1844 if ($object->datepreviouslogin) {
1845 print
dol_print_date($object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1847 if ($object->datelastlogin) {
1848 print
dol_print_date($object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1859 print
'<div style="clear:both"></div>';
1868 print
'<div class="tabsAction">';
1871 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1872 if (empty($reshook)) {
1873 if (empty($user->socid)) {
1874 $canSendMail =
false;
1878 'class' =>
'classfortooltip'
1881 if (!empty($object->email)) {
1882 $langs->load(
"mails");
1883 $canSendMail =
true;
1885 $langs->load(
"mails");
1886 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
1888 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
1891 if ($caneditfield && (!
isModEnabled(
'multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1895 'class' =>
'classfortooltip'
1898 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
1899 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
1900 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1902 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
1904 } elseif ($caneditpassword && !$object->ldap_sid &&
1905 (!
isModEnabled(
'multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1909 'class' =>
'classfortooltip'
1912 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit',
'',
true, $params);
1919 'class' =>
'classfortooltip'
1922 if ($conf->global->USER_PASSWORD_GENERATED !=
'none') {
1923 if ($object->statut == 0) {
1924 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
1925 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1926 } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
1927 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1928 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
1931 if ($object->statut == 0) {
1932 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
1933 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1934 } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
1935 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1936 if ($object->email) {
1937 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
1939 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
1940 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1949 'class' =>
'classfortooltip'
1952 if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
1953 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1954 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
1957 if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
1958 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1959 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
1961 if ($user->id == $id) {
1962 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
1963 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1967 if ($user->id <> $id && $candisableuser &&
1968 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1969 if ($user->admin || !$object->admin) {
1970 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'',
true, $params);
1972 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
1973 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'',
false, $params);
1983 if (
GETPOST(
'modelselected')) {
1984 $action =
'presend';
1988 $modelmail =
'user';
1989 $defaulttopic =
'Information';
1990 $diroutput = $conf->user->dir_output;
1991 $trackid =
'use'.$object->id;
1993 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1995 if ($action !=
'presend' && $action !=
'send') {
2000 if ($canreadgroup) {
2001 print
'<!-- Group section -->'.
"\n";
2009 $groupslist = $usergroup->listGroupsForUser($object->id,
false);
2011 if (!empty($groupslist)) {
2012 foreach ($groupslist as $groupforuser) {
2013 $exclude[] = $groupforuser->id;
2018 $parameters = array(
'caneditgroup' => $caneditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2019 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup',
$parameters, $object, $action);
2020 print $hookmanager->resPrint;
2022 if (empty($reshook)) {
2023 if ($caneditgroup) {
2024 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">'.
"\n";
2025 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2026 print
'<input type="hidden" name="action" value="addgroup" />';
2027 print
'<input type="hidden" name="page_y" value="" />';
2030 print
'<table class="noborder centpercent">'.
"\n";
2031 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2032 print
'<th class="liste_titre right">';
2033 if ($caneditgroup) {
2034 print
$form->select_dolgroups(
'',
'group', 1, $exclude, 0,
'',
'', $object->entity);
2036 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2037 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2039 print
'</th></tr>'.
"\n";
2042 if (!empty($groupslist)) {
2043 foreach ($groupslist as $group) {
2044 print
'<tr class="oddeven">';
2046 if ($caneditgroup) {
2047 print $group->getNomUrl(1);
2049 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2052 print
'<td class="right">';
2053 if ($caneditgroup) {
2054 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2055 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2060 print
"</td></tr>\n";
2063 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
2068 if ($caneditgroup) {
2080 if ($action ==
'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id))) {
2081 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2082 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2083 print
'<input type="hidden" name="action" value="update">';
2084 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2088 print
'<table class="border centpercent">';
2091 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
2092 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2100 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2101 if ($caneditfield && !$object->ldap_sid) {
2102 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') : $object->civility_code,
'civility_code');
2103 } elseif ($object->civility_code) {
2104 print $langs->trans(
"Civility".$object->civility_code);
2110 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2112 if ($caneditfield && !$object->ldap_sid) {
2113 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2115 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2116 print $object->lastname;
2122 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2124 if ($caneditfield && !$object->ldap_sid) {
2125 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2127 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2128 print $object->firstname;
2133 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2135 if ($user->admin && !$object->ldap_sid) {
2136 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2138 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2139 print $object->login;
2145 print
'<tr><td>'.$langs->trans(
"Administrator").
'</td>';
2146 if ($object->socid > 0) {
2147 $langs->load(
"admin");
2149 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn($object->admin);
2150 print
' ('.$langs->trans(
"ExternalUser").
')';
2154 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2155 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2159 && ($user->id != $object->id)
2162 || (
isModEnabled(
'multicompany') && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1))
2165 print
$form->selectyesno(
'admin', $object->admin, 1);
2168 if ($conf->use_javascript_ajax) {
2169 print
'<script type="text/javascript">
2171 var admin = $("select[name=admin]").val();
2173 $("input[name=superadmin]")
2174 .prop("disabled", true)
2175 .prop("checked", false);
2177 if ($("input[name=superadmin]").is(":checked")) {
2178 $("select[name=entity]")
2179 .prop("disabled", true);
2181 $("select[name=admin]").change(function() {
2182 if ( $(this).val() == 0 ) {
2183 $("input[name=superadmin]")
2184 .prop("disabled", true)
2185 .prop("checked", false);
2186 $("select[name=entity]")
2187 .prop("disabled", false);
2189 $("input[name=superadmin]")
2190 .prop("disabled", false);
2193 $("input[name=superadmin]").change(function() {
2194 if ( $(this).is(":checked")) {
2195 $("select[name=entity]")
2196 .prop("disabled", true);
2198 $("select[name=entity]")
2199 .prop("disabled", false);
2206 $checked = (($object->admin && !$object->entity) ?
' checked' :
'');
2207 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2210 $yn =
yn($object->admin);
2211 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2212 print
'<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).
'">';
2213 if (
isModEnabled(
'multicompany') && empty($object->entity)) {
2214 print
$form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2223 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2225 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
2226 if ($caneditfield) {
2229 print $arraygender[$object->gender];
2235 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2236 if ($caneditfield) {
2237 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2240 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2250 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2252 if ($caneditfield) {
2253 print
img_picto(
'',
'user').$form->select_dolusers($object->fk_user,
'fk_user', 1, array($object->id), 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2255 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2256 $huser =
new User($db);
2257 $huser->fetch($object->fk_user);
2258 print $huser->getNomUrl(1);
2265 print
'<tr><td class="titlefieldcreate">';
2266 $text = $langs->trans(
"ForceUserExpenseValidator");
2267 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2270 if ($caneditfield) {
2271 print
img_picto(
'',
'user').$form->select_dolusers($object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array($object->id), 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2273 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2274 $evuser =
new User($db);
2275 $evuser->fetch($object->fk_user_expense_validator);
2276 print $evuser->getNomUrl(1);
2284 print
'<tr><td class="titlefieldcreate">';
2285 $text = $langs->trans(
"ForceUserHolidayValidator");
2286 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2289 if ($caneditfield) {
2290 print
img_picto(
'',
'user').$form->select_dolusers($object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array($object->id), 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'widthcentpercentminusx maxwidth300');
2292 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2293 $hvuser =
new User($db);
2294 $hvuser->fetch($object->fk_user_holiday_validator);
2295 print $hvuser->getNomUrl(1);
2302 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2304 if ($user->id == $object->id || !$user->admin) {
2306 $type = $langs->trans(
"Internal");
2307 if ($object->socid) {
2308 $type = $langs->trans(
"External");
2310 print
$form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2311 if ($object->ldap_sid) {
2312 print
' ('.$langs->trans(
"DomainUser").
')';
2317 if ($object->contact_id) {
2318 $type = $object->contact_id;
2321 if ($object->socid > 0 && !($object->contact_id > 0)) {
2322 print
img_picto(
'',
'company').$form->select_company($object->socid,
'socid',
'',
' ');
2323 print
img_picto(
'',
'contact').$form->selectcontacts(0, 0,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2324 if ($object->ldap_sid) {
2325 print
' ('.$langs->trans(
"DomainUser").
')';
2327 } elseif ($object->socid > 0 && $object->contact_id > 0) {
2328 print
img_picto(
'',
'company').$form->select_company($object->socid,
'socid',
'',
' ');
2329 print
img_picto(
'',
'contact').$form->selectcontacts(0, $object->contact_id,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2330 if ($object->ldap_sid) {
2331 print
' ('.$langs->trans(
"DomainUser").
')';
2333 } elseif (!($object->socid > 0) && $object->contact_id > 0) {
2334 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ');
2335 print
img_picto(
'',
'contact').$form->selectcontacts(0, $object->contact_id,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2336 if ($object->ldap_sid) {
2337 print
' ('.$langs->trans(
"DomainUser").
')';
2340 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ');
2341 print
img_picto(
'',
'contact').$form->selectcontacts(0, 0,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2351 print
'<table class="border centpercent">';
2354 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2356 if ($caneditfield) {
2357 print
$form->selectDate($datestartvalidity ? $datestartvalidity : $object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 1, 0,
'',
'',
'',
'', 1,
'',
'');
2367 if ($caneditfield) {
2368 print
$form->selectDate($dateendvalidity ? $datendevalidity : $object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'');
2376 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2379 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2380 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2382 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2383 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2385 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication)) {
2386 if ($caneditpassword) {
2387 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="flat" name="password" value="'.
dol_escape_htmltag($object->pass).
'" autocomplete="new-password">';
2389 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*', $object->pass);
2394 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpassword' => $caneditpassword);
2395 $reshook = $hookmanager->executeHooks(
'printUserPasswordField',
$parameters, $object, $action);
2397 $valuetoshow = $hookmanager->resPrint;
2399 $valuetoshow .= $hookmanager->resPrint;
2403 print
"</td></tr>\n";
2406 if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
2407 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2409 print
'<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2410 if (!empty($conf->use_javascript_ajax)) {
2411 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject"');
2417 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) {
2418 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2420 if ($caneditfield) {
2421 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2423 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2424 print $object->openid;
2429 print
'</table><hr><table class="border centpercent">';
2433 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2435 if ($caneditfield) {
2436 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2438 print $object->address;
2439 if ($caneditfield) {
2440 print
'</textarea>';
2445 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2446 if ($caneditfield) {
2447 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2454 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2455 if ($caneditfield) {
2456 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2458 print $object->town;
2463 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td>';
2464 if ($caneditfield) {
2465 print
$form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id),
'country_id');
2467 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2470 $countrylabel =
getCountry($object->country_id,
'0');
2471 print $countrylabel;
2476 if (empty($conf->global->USER_DISABLE_STATE)) {
2477 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2478 if ($caneditfield) {
2479 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2480 print $formcompany->select_state($object->state_id, $object->country_code,
'state_id');
2482 print $object->state_label;
2488 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2490 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2491 if ($caneditfield && empty($object->ldap_sid)) {
2492 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2494 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2495 print $object->office_phone;
2500 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2502 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2503 if ($caneditfield && empty($object->ldap_sid)) {
2504 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2506 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2507 print $object->user_mobile;
2512 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2514 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2515 if ($caneditfield && empty($object->ldap_sid)) {
2516 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2518 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2519 print $object->office_fax;
2524 print
"<tr>".
'<td'.(!empty($conf->global->USER_MAIL_REQUIRED) ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2526 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2527 if ($caneditfield && empty($object->ldap_sid)) {
2528 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2530 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2531 print $object->email;
2536 foreach ($socialnetworks as $key => $value) {
2537 if ($value[
'active']) {
2538 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2540 if (!empty($value[
'icon'])) {
2541 print
'<span class="fa '.$value[
'icon'].
' pictofixedwidth"></span>';
2543 if ($caneditfield && empty($object->ldap_sid)) {
2544 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset($object->socialnetworks[$key])?$object->socialnetworks[$key]:
'').
'">';
2546 print
'<input type="hidden" name="'.$key.
'" value="'.$object->socialnetworks[$key].
'">';
2547 print $object->socialnetworks[$key];
2552 print
'<input type="hidden" name="'.$key.
'" value="'.(isset($object->socialnetworks[$key])?$object->socialnetworks[$key]:
'').
'">';
2557 print
'</table><hr><table class="border centpercent">';
2560 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
2561 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2562 print $formproduct->selectWarehouses($object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2563 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>';
2570 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2572 if ($caneditfield) {
2573 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2575 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2576 print $object->accountancy_code;
2584 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2586 if ($caneditfield) {
2587 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') : $object->color,
'color',
null, 1,
'',
'hideifnotset');
2589 print $formother->showColor($object->color,
'');
2596 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2598 print
$form->showphoto(
'userphoto', $object, 60, 0, $caneditfield,
'photowithmargin',
'small', 1, 0,
'user', 1);
2603 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
2604 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
2606 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2607 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_USER,
null,
null,
null,
null, 1);
2609 $cats = $c->containing($object->id, Categorie::TYPE_USER);
2610 $arrayselected = array();
2611 foreach ($cats as $cat) {
2612 $arrayselected[] = $cat->id;
2614 if ($caneditfield) {
2615 print
$form->multiselectarray(
'usercats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
2617 print
$form->showCategories($object->id, Categorie::TYPE_USER, 1);
2624 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";
2625 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language($object->lang,
'default_lang', 0,
null,
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2631 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2633 print $object->getLibStatut(4);
2638 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2640 if ($object->socid > 0) {
2642 $societe->fetch($object->socid);
2643 print $societe->getNomUrl(1,
'');
2644 if ($object->contact_id) {
2646 $contact->fetch($object->contact_id);
2647 print
' / <a href="'.DOL_URL_ROOT.
'/contact/card.php?id='.$object->contact_id.
'">'.
img_object($langs->trans(
"ShowContact"),
'contact').
' '.
dol_trunc($contact->getFullName($langs), 32).
'</a>';
2650 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2652 print
' <span class="opacitymedium hideonsmartphone">('.$langs->trans(
"UseTypeFieldToChange").
')</span>';
2659 $langs->load(
"members");
2660 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2662 if ($object->fk_member) {
2664 $adh->fetch($object->fk_member);
2665 $adh->ref = $adh->login;
2666 print $adh->getNomUrl(1);
2668 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2678 if (!method_exists($mc,
'formObjectOptions')) {
2679 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2680 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2681 print
"<td>".$mc->select_entities($object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2682 print
"</td></tr>\n";
2684 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2692 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
2693 print $hookmanager->resPrint;
2694 if (empty($reshook)) {
2695 if ($caneditfield) {
2696 print $object->showOptionals($extrafields,
'edit');
2698 print $object->showOptionals($extrafields,
'view');
2703 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2705 if ($caneditfield) {
2706 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2708 $doleditor =
new DolEditor(
'signature', $object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4,
'90%');
2709 print $doleditor->Create(1);
2721 print
'<table class="border centpercent">';
2727 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2729 if ($caneditfield) {
2730 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag($object->job).
'">';
2732 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag($object->job).
'">';
2738 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2740 if ($caneditfield) {
2741 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') : $object->weeklyhours).
'">';
2749 if ((empty($user->socid) && in_array($id, $childids))
2750 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
2751 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2752 $langs->load(
"salaries");
2755 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2757 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') : $object->salary).
'">';
2763 $text = $langs->trans(
"THM");
2764 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2767 if ($caneditfield) {
2768 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') : $object->thm).
'">';
2770 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
2777 $text = $langs->trans(
"TJM");
2778 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2781 if ($caneditfield) {
2782 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') : $object->tjm).
'">';
2784 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
2791 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2793 if ($caneditfield) {
2794 print
$form->selectDate($dateemployment ? $dateemployment : $object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1);
2799 if ($dateemployment && $dateemploymentend) {
2803 if ($caneditfield) {
2804 print
$form->selectDate($dateemploymentend ? $dateemploymentend : $object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0);
2812 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2814 if ($caneditfield) {
2815 echo
$form->selectDate($dateofbirth ? $dateofbirth : $object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2826 print
'<div class="center">';
2827 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2828 print
' ';
2829 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2835 if ($action !=
'edit' && $action !=
'presend') {
2836 print
'<div class="fichecenter"><div class="fichehalfleft">';
2841 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2842 $genallowed = $user->hasRight(
"user",
"user",
"read");
2843 $delallowed = $user->hasRight(
"user",
"user",
"write");
2845 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', empty($soc->default_lang) ?
'' : $soc->default_lang);
2846 $somethingshown = $formfile->numoffiles;
2849 $linktoelem =
$form->showLinkToObjectBlock($object,
null,
null);
2850 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
2852 print
'</div><div class="fichehalfright">';
2855 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2857 $somethingshown =
$formactions->showactions($object,
'user', $socid, 1,
'listactions', 0,
'',
'', $object->id);
2859 print
'</div></div>';
2862 if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
2868 if (!empty($conf->api->enabled)) {
2869 $constname =
'api_key';
2872 include_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) if(preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) if($action=='set') elseif($action=='specimen') elseif($action=='setmodel') elseif($action=='del') elseif($action=='setdoc') $formactions
View.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage members of a foundation.
Class to manage categories.
Class to manage a WYSIWYG editor.
Class to manage warehouses.
Class to manage LDAP features.
const SYNCHRO_LDAP_TO_DOLIBARR
Ldap to Dolibarr synchronization.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage user groups.
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
acceptLocalLinktoMedia()
Check the syntax of some PHP code.
dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='rowid', $fieldref='ref', $morehtmlref='', $moreparam='', $nodbprefix=0, $morehtmlleft='', $morehtmlstatus='', $onlybanner=0, $morehtmlright='')
Show tab footer of a card.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
GETPOSTINT($paramname, $method=0)
Return value of a param into GET or POST supervariable.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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 '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
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.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonAction($label, $text='', $actionType='default', $url='', $id='', $userRight=1, $params=array())
Function dolGetButtonAction.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom='UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
isModEnabled($module)
Is Dolibarr module enabled.
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.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
dolJSToSetRandomPassword($htmlname, $htmlnameofbutton='generate_token')
Ouput javacript to autoset a generated password using default module into a HTML element.
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $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.