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 $langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks',
'other'));
70 $action =
GETPOST(
'action',
'aZ09');
71 $mode =
GETPOST(
'mode',
'alpha');
72 $confirm =
GETPOST(
'confirm',
'alpha');
73 $group =
GETPOST(
"group",
"int", 3);
74 $cancel =
GETPOST(
'cancel',
'alpha');
75 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
77 $dateemployment =
dol_mktime(0, 0, 0,
GETPOST(
'dateemploymentmonth',
'int'),
GETPOST(
'dateemploymentday',
'int'),
GETPOST(
'dateemploymentyear',
'int'));
78 $dateemploymentend =
dol_mktime(0, 0, 0,
GETPOST(
'dateemploymentendmonth',
'int'),
GETPOST(
'dateemploymentendday',
'int'),
GETPOST(
'dateemploymentendyear',
'int'));
79 $datestartvalidity =
dol_mktime(0, 0, 0,
GETPOST(
'datestartvaliditymonth',
'int'),
GETPOST(
'datestartvalidityday',
'int'),
GETPOST(
'datestartvalidityyear',
'int'));
80 $dateendvalidity =
dol_mktime(0, 0, 0,
GETPOST(
'dateendvaliditymonth',
'int'),
GETPOST(
'dateendvalidityday',
'int'),
GETPOST(
'dateendvalidityyear',
'int'));
83 $childids = $user->getAllChildIds(1);
85 $object =
new User($db);
89 $extrafields->fetch_name_optionals_label($object->table_element);
94 $hookmanager->initHooks(array(
'usercard',
'globalcard'));
101 $res = $object->fetch($id,
'',
'', 1);
106 if ($user->socid > 0) {
107 $socid = $user->socid;
113 $canadduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
114 $canreaduser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"read"));
115 $canedituser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"write"));
116 $candisableuser = (!empty($user->admin) || $user->hasRight(
"user",
"user",
"delete"));
117 $canreadgroup = $canreaduser;
118 $caneditgroup = $canedituser;
119 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
120 $canreadgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"read"));
121 $caneditgroup = (!empty($user->admin) || $user->hasRight(
"user",
"group_advance",
"write"));
124 if ($user->id != $id && !$canreaduser) {
131 $canedituser = (($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write"));
132 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
133 $caneditpassword = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"password")) || (($user->id != $id) && $user->hasRight(
"user",
"user",
"password")));
141 $parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $caneditgroup);
142 $reshook = $hookmanager->executeHooks(
'doActions',
$parameters, $object, $action);
147 if (empty($reshook)) {
148 $backurlforlist = DOL_URL_ROOT.
'/user/list.php';
150 if (empty($backtopage) || ($cancel && empty($id))) {
151 if (empty($backtopage) || ($cancel && strpos($backtopage,
'__ID__'))) {
152 if (empty($id) && (($action !=
'add' && $action !=
'create') || $cancel)) {
153 $backtopage = $backurlforlist;
155 $backtopage = DOL_URL_ROOT.
'/user/card.php?id='.((!empty($id) && $id > 0) ? $id :
'__ID__');
161 if (!empty($backtopageforcancel)) {
162 header(
"Location: ".$backtopageforcancel);
164 } elseif (!empty($backtopage)) {
165 header(
"Location: ".$backtopage);
171 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $candisableuser) {
172 if ($id != $user->id) {
174 if ($object->admin && empty($user->admin)) {
177 setEventMessages($langs->trans(
"OnlyAdminUsersCanDisableAdminUsers"),
null,
'errors');
179 $object->setstatus(0);
180 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
186 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $candisableuser) {
189 if ($id != $user->id) {
192 if (!empty($conf->file->main_limit_users)) {
193 $nb = $object->getNbOfUsers(
"active");
194 if ($nb >= $conf->file->main_limit_users) {
196 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
201 $object->setstatus(1);
202 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
208 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $candisableuser) {
209 if ($id != $user->id) {
211 print
'Error, token required for this critical operation';
215 $object =
new User($db);
217 $object->oldcopy = clone $object;
219 $result = $object->delete($user);
221 $langs->load(
"errors");
225 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
232 if ($action ==
'add' && $canadduser) {
246 if (!empty($conf->file->main_limit_users)) {
247 $nb = $object->getNbOfUsers(
"active");
248 if ($nb >= $conf->file->main_limit_users) {
250 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"),
null,
'errors');
256 $object->civility_code =
GETPOST(
"civility_code",
'aZ09');
257 $object->lastname =
GETPOST(
"lastname",
'alphanohtml');
258 $object->firstname =
GETPOST(
"firstname",
'alphanohtml');
259 $object->ref_employee =
GETPOST(
"ref_employee",
'alphanohtml');
260 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
261 $object->login =
GETPOST(
"login",
'alphanohtml');
262 $object->api_key =
GETPOST(
"api_key",
'alphanohtml');
263 $object->gender =
GETPOST(
"gender",
'aZ09');
264 $object->admin =
GETPOST(
"admin",
'int');
265 $object->address =
GETPOST(
'address',
'alphanohtml');
266 $object->zip =
GETPOST(
'zipcode',
'alphanohtml');
267 $object->town =
GETPOST(
'town',
'alphanohtml');
268 $object->country_id =
GETPOST(
'country_id',
'int');
269 $object->state_id =
GETPOST(
'state_id',
'int');
270 $object->office_phone =
GETPOST(
"office_phone",
'alphanohtml');
271 $object->office_fax =
GETPOST(
"office_fax",
'alphanohtml');
272 $object->user_mobile =
GETPOST(
"user_mobile",
'alphanohtml');
275 $object->socialnetworks = array();
276 foreach ($socialnetworks as $key => $value) {
277 if (
GETPOST($key,
'alphanohtml')) {
278 $object->socialnetworks[$key] =
GETPOST($key,
'alphanohtml');
283 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
284 $object->job =
GETPOST(
"job",
'alphanohtml');
285 $object->signature =
GETPOST(
"signature",
'restricthtml');
286 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
287 $object->note_public =
GETPOST(
"note_public",
'restricthtml');
288 $object->note_private =
GETPOST(
"note_private",
'restricthtml');
289 $object->ldap_sid =
GETPOST(
"ldap_sid",
'alphanohtml');
290 $object->fk_user =
GETPOST(
"fk_user",
'int') > 0 ?
GETPOST(
"fk_user",
'int') : 0;
291 $object->fk_user_expense_validator =
GETPOST(
"fk_user_expense_validator",
'int') > 0 ?
GETPOST(
"fk_user_expense_validator",
'int') : 0;
292 $object->fk_user_holiday_validator =
GETPOST(
"fk_user_holiday_validator",
'int') > 0 ?
GETPOST(
"fk_user_holiday_validator",
'int') : 0;
293 $object->employee =
GETPOST(
'employee',
'alphanohtml');
295 $object->thm =
GETPOST(
"thm",
'alphanohtml') !=
'' ?
GETPOST(
"thm",
'alphanohtml') :
'';
297 $object->tjm =
GETPOST(
"tjm",
'alphanohtml') !=
'' ?
GETPOST(
"tjm",
'alphanohtml') :
'';
299 $object->salary =
GETPOST(
"salary",
'alphanohtml') !=
'' ?
GETPOST(
"salary",
'alphanohtml') :
'';
300 $object->salary =
price2num($object->salary);
301 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
302 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
304 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ?
GETPOST(
"color",
'alphanohtml') :
'';
306 $object->dateemployment = $dateemployment;
307 $object->dateemploymentend = $dateemploymentend;
308 $object->datestartvalidity = $datestartvalidity;
309 $object->dateendvalidity = $dateendvalidity;
310 $object->birth = $dateofbirth;
312 $object->fk_warehouse =
GETPOST(
'fk_warehouse',
'int');
314 $object->lang =
GETPOST(
'default_lang',
'aZ09');
317 $ret = $extrafields->setOptionalsFromPost(
null, $object);
323 $entity =
GETPOST(
'entity',
'int');
325 if (
GETPOST(
'superadmin',
'int')) {
328 if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
331 $object->entity = ($entity ==
'' ? 1 : $entity);
335 $object->entity = ($entity ==
'' ? 1 : $entity);
343 $id = $object->create($user);
346 if (
GETPOST(
'password',
'none')) {
347 $resPass = $object->setPassword($user,
GETPOST(
'password',
'none'));
350 $langs->load(
"errors");
355 if (!empty($conf->categorie->enabled)) {
357 $usercats =
GETPOST(
'usercats',
'array');
358 $object->setCategories($usercats);
362 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?id='.$id);
366 $langs->load(
"errors");
375 if (($action ==
'addgroup' || $action ==
'removegroup') && $caneditgroup) {
378 $editgroup->fetch($group);
379 $editgroup->oldcopy = clone $editgroup;
382 if ($action ==
'addgroup') {
383 $result = $object->SetInGroup($group, $editgroup->entity);
385 if ($action ==
'removegroup') {
386 $result = $object->RemoveFromGroup($group, $editgroup->entity);
397 if ($action ==
'update' && $canedituser) {
398 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
403 if (!
GETPOST(
"lastname",
'alpha')) {
408 if (!
GETPOST(
"login",
'alpha')) {
417 $object->oldcopy = clone $object;
421 $object->civility_code =
GETPOST(
"civility_code",
'aZ09');
422 $object->lastname =
GETPOST(
"lastname",
'alphanohtml');
423 $object->firstname =
GETPOST(
"firstname",
'alphanohtml');
428 $object->ref_employee =
GETPOST(
"ref_employee",
'alphanohtml');
434 $object->national_registration_number =
GETPOST(
"national_registration_number",
'alphanohtml');
436 $object->gender =
GETPOST(
"gender",
'aZ09');
437 if ($caneditpassword) {
438 $object->pass =
GETPOST(
"password",
'none');
440 if ($caneditpassword || $user->hasRight(
"api",
"apikey",
"generate")) {
441 $object->api_key = (
GETPOST(
"api_key",
'alphanohtml')) ?
GETPOST(
"api_key",
'alphanohtml') : $object->api_key;
443 if (!empty($user->admin)) {
444 $object->admin =
GETPOST(
"admin",
"int");
446 if ($user->admin && !$object->ldap_sid) {
447 $object->login =
GETPOST(
"login",
'alphanohtml');
449 $object->address =
GETPOST(
'address',
'alphanohtml');
450 $object->zip =
GETPOST(
'zipcode',
'alphanohtml');
451 $object->town =
GETPOST(
'town',
'alphanohtml');
452 $object->country_id =
GETPOST(
'country_id',
'int');
453 $object->state_id =
GETPOST(
'state_id',
'int');
454 $object->office_phone =
GETPOST(
"office_phone",
'alphanohtml');
455 $object->office_fax =
GETPOST(
"office_fax",
'alphanohtml');
456 $object->user_mobile =
GETPOST(
"user_mobile",
'alphanohtml');
459 $object->socialnetworks = array();
460 foreach ($socialnetworks as $key => $value) {
461 if (
GETPOST($key,
'alphanohtml')) {
462 $object->socialnetworks[$key] =
GETPOST($key,
'alphanohtml');
467 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
468 $object->job =
GETPOST(
"job",
'alphanohtml');
469 $object->signature =
GETPOST(
"signature",
'restricthtml');
470 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
471 $object->openid =
GETPOST(
"openid",
'alphanohtml');
472 $object->fk_user =
GETPOST(
"fk_user",
'int') > 0 ?
GETPOST(
"fk_user",
'int') : 0;
473 $object->fk_user_expense_validator =
GETPOST(
"fk_user_expense_validator",
'int') > 0 ?
GETPOST(
"fk_user_expense_validator",
'int') : 0;
474 $object->fk_user_holiday_validator =
GETPOST(
"fk_user_holiday_validator",
'int') > 0 ?
GETPOST(
"fk_user_holiday_validator",
'int') : 0;
475 $object->employee =
GETPOST(
'employee',
'int');
477 $object->thm =
GETPOST(
"thm",
'alphanohtml') !=
'' ?
GETPOST(
"thm",
'alphanohtml') :
'';
479 $object->tjm =
GETPOST(
"tjm",
'alphanohtml') !=
'' ?
GETPOST(
"tjm",
'alphanohtml') :
'';
481 $object->salary =
GETPOST(
"salary",
'alphanohtml') !=
'' ?
GETPOST(
"salary",
'alphanohtml') :
'';
482 $object->salary =
price2num($object->salary);
483 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
484 $object->salaryextra =
price2num($object->salaryextra);
485 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
486 $object->weeklyhours =
price2num($object->weeklyhours);
488 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ?
GETPOST(
"color",
'alphanohtml') :
'';
489 $object->dateemployment = $dateemployment;
490 $object->dateemploymentend = $dateemploymentend;
491 $object->datestartvalidity = $datestartvalidity;
492 $object->dateendvalidity = $dateendvalidity;
493 $object->birth = $dateofbirth;
496 $object->fk_warehouse =
GETPOST(
'fk_warehouse',
'int');
499 $object->lang =
GETPOST(
'default_lang',
'aZ09');
502 if (
isModEnabled(
'multicompany') && empty($user->entity) && !empty($user->admin)) {
503 if (
GETPOST(
'superadmin',
'int')) {
506 if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
516 $ret = $extrafields->setOptionalsFromPost(
null, $object,
'@GETPOSTISSET');
524 if (!empty($_FILES[
'photo'][
'name'])) {
530 $langs->load(
"errors");
532 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
537 $ret = $object->update($user);
540 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
541 $langs->load(
"errors");
542 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $object->login),
null,
'errors');
551 $contactid =
GETPOST(
'contactid',
'int');
552 $socid =
GETPOST(
'socid',
'int');
554 if ($contactid > 0) {
556 $contact->fetch($contactid);
558 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
559 $sql .=
" SET fk_socpeople=".((int) $contactid);
560 if (!empty($contact->socid)) {
561 $sql .=
", fk_soc=".((int) $contact->socid);
562 } elseif ($socid > 0) {
563 $sql .=
", fk_soc = null";
564 setEventMessages($langs->trans(
"WarningUserDifferentContactSocid"),
'',
'warnings');
566 $sql .=
" WHERE rowid = ".((int) $object->id);
567 } elseif ($socid > 0) {
568 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
569 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
570 $sql .=
" WHERE rowid = ".((int) $object->id);
572 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
573 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
574 $sql .=
" WHERE rowid = ".((int) $object->id);
577 $resql = $db->query($sql);
584 if (!$error && !count($object->errors)) {
585 if (
GETPOST(
'deletephoto') && $object->oldcopy->photo) {
586 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/'.$object->oldcopy->photo;
587 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'photos/thumbs';
592 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
593 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user').
'/photos';
599 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
601 if (!($result > 0)) {
605 $object->addThumbs($newfile);
609 $langs->load(
"errors");
610 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
615 if (!$error && !count($object->errors)) {
617 $categories =
GETPOST(
'usercats',
'array');
618 $object->setCategories($categories);
621 if (!$error && !count($object->errors)) {
625 $login = $_SESSION[
"dol_login"];
626 if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login) {
628 $langs->load(
"errors");
629 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"),
null,
'warnings');
636 if ($caneditpassword) {
637 dol_syslog(
"Not allowed to change fields, only password");
641 if (
GETPOST(
"password",
"none")) {
642 $object->oldcopy = clone $object;
644 $ret = $object->setPassword($user,
GETPOST(
"password",
"none"));
654 if ((($action ==
'confirm_password' && $confirm ==
'yes')
655 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes')) && $caneditpassword
659 $newpassword = $object->setPassword($user,
'');
660 if ($newpassword < 0) {
662 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"),
null,
'errors');
665 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
666 if ($object->send_password($user, $newpassword) > 0) {
667 setEventMessages($langs->trans(
"PasswordChangedAndSentTo", $object->email),
null,
'mesgs');
672 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword),
null,
'warnings');
678 if ($action ==
'adduserldap' && $canadduser) {
679 $selecteduser =
GETPOST(
'users');
681 $required_fields = array(
682 $conf->global->LDAP_KEY_USERS,
683 $conf->global->LDAP_FIELD_NAME,
684 $conf->global->LDAP_FIELD_FIRSTNAME,
685 $conf->global->LDAP_FIELD_LOGIN,
686 $conf->global->LDAP_FIELD_LOGIN_SAMBA,
687 $conf->global->LDAP_FIELD_PASSWORD,
688 $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
689 $conf->global->LDAP_FIELD_PHONE,
690 $conf->global->LDAP_FIELD_FAX,
691 $conf->global->LDAP_FIELD_MOBILE,
692 $conf->global->LDAP_FIELD_SKYPE,
693 $conf->global->LDAP_FIELD_MAIL,
694 $conf->global->LDAP_FIELD_TITLE,
695 $conf->global->LDAP_FIELD_DESCRIPTION,
696 $conf->global->LDAP_FIELD_SID
700 $result = $ldap->connect_bind();
703 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
705 $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields);
708 if (is_array($ldapusers)) {
709 foreach ($ldapusers as $key => $attribute) {
710 $ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME];
711 $ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME];
712 $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN];
713 $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA];
714 $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD];
715 $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED];
716 $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE];
717 $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX];
718 $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE];
719 $ldap_social[
'skype'] = $attribute[$conf->global->LDAP_FIELD_SKYPE];
720 $ldap_social[
'twitter'] = $attribute[$conf->global->LDAP_FIELD_TWITTER];
721 $ldap_social[
'facebook'] = $attribute[$conf->global->LDAP_FIELD_FACEBOOK];
722 $ldap_social[
'linkedin'] = $attribute[$conf->global->LDAP_FIELD_LINKEDIN];
723 $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL];
724 $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
733 $triggersendname =
'USER_SENTBYMAIL';
735 $mode =
'emailfromuser';
736 $trackid =
'use'.$id;
737 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
740 $upload_dir = $conf->user->dir_output;
741 $permissiontoadd = $user->hasRight(
"user",
"user",
"write");
742 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
759 if ($object->id > 0) {
760 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
761 $title = $person_name.
" - ".$langs->trans(
'Card');
763 $title = $langs->trans(
"NewUser");
770 if ($action ==
'create' || $action ==
'adduserldap') {
773 print
'<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
780 $result = $ldap->connect_bind();
782 $required_fields = array(
783 $conf->global->LDAP_KEY_USERS,
784 $conf->global->LDAP_FIELD_FULLNAME,
785 $conf->global->LDAP_FIELD_NAME,
786 $conf->global->LDAP_FIELD_FIRSTNAME,
787 $conf->global->LDAP_FIELD_LOGIN,
788 $conf->global->LDAP_FIELD_LOGIN_SAMBA,
789 $conf->global->LDAP_FIELD_PASSWORD,
790 $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
791 $conf->global->LDAP_FIELD_PHONE,
792 $conf->global->LDAP_FIELD_FAX,
793 $conf->global->LDAP_FIELD_MOBILE,
794 $conf->global->LDAP_FIELD_SKYPE,
795 $conf->global->LDAP_FIELD_MAIL,
796 $conf->global->LDAP_FIELD_TITLE,
797 $conf->global->LDAP_FIELD_DESCRIPTION,
798 $conf->global->LDAP_FIELD_SID
802 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
805 $ldapusers = $ldap->getRecords(
'*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
807 if (is_array($ldapusers)) {
809 foreach ($ldapusers as $key => $ldapuser) {
812 foreach ($required_fields as $value) {
813 if ($value === $conf->global->LDAP_FIELD_PASSWORD || $value === $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) {
814 $label .= $value.
"=******* ";
816 $label .= $value.
"=".$ldapuser[$value].
" ";
819 $liste[$key] = $label;
829 print
"\n\n<!-- Form liste LDAP debut -->\n";
831 print
'<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
832 print
'<input type="hidden" name="token" value="'.newToken().
'">';
833 print
'<table class="border centpercent"><tr>';
834 print
'<td width="160">';
835 print $langs->trans(
"LDAPUsers");
838 print
'<input type="hidden" name="action" value="adduserldap">';
839 if (is_array($liste) && count($liste)) {
840 print
$form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
843 print
'</td><td class="center">';
844 print
'<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
845 print
'</td></tr></table>';
848 print
"\n<!-- Form liste LDAP fin -->\n\n";
853 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
854 print
'<input type="hidden" name="token" value="'.newToken().
'">';
855 print
'<input type="hidden" name="action" value="add">';
856 if (!empty($ldap_sid)) {
857 print
'<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
859 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'">';
865 print
'<table class="border centpercent">';
868 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
869 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') : $object->civility_code,
'civility_code');
874 print
'<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
876 if (!empty($ldap_lastname)) {
877 print
'<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
878 print $ldap_lastname;
880 print
'<input class="minwidth100 maxwidth150onsmartphone" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
885 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
887 if (!empty($ldap_firstname)) {
888 print
'<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
889 print $ldap_firstname;
891 print
'<input class="minwidth100 maxwidth150onsmartphone" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
896 print
'<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
898 if (!empty($ldap_login)) {
899 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
901 } elseif (!empty($ldap_loginsmb)) {
902 print
'<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
903 print $ldap_loginsmb;
905 print
'<input class="maxwidth200 maxwidth150onsmartphone" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
909 $generated_password =
'';
910 if (empty($ldap_sid)) {
916 if (!empty($user->admin)) {
917 print
'<tr><td>'.$langs->trans(
"Administrator").
'</td>';
922 if (!empty($conf->use_javascript_ajax)) {
923 print
'<script type="text/javascript">
925 $("select[name=admin]").change(function() {
926 if ( $(this).val() == 0 ) {
927 $("input[name=superadmin]")
928 .prop("disabled", true)
929 .prop("checked", false);
930 $("select[name=entity]")
931 .prop("disabled", false);
933 $("input[name=superadmin]")
934 .prop("disabled", false);
937 $("input[name=superadmin]").change(function() {
938 if ( $(this).is(":checked") ) {
939 $("select[name=entity]")
940 .prop("disabled", true);
942 $("select[name=entity]")
943 .prop("disabled", false);
949 $checked = (
GETPOST(
'superadmin',
'int') ?
' checked' :
'');
950 $disabled = (
GETPOST(
'superadmin',
'int') ?
'' :
' disabled');
951 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.$disabled.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
953 print
"</td></tr>\n";
957 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
959 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
960 print
$form->selectarray(
'gender', $arraygender,
GETPOST(
'gender'), 1);
964 $defaultemployee =
'1';
966 print
'<td>'.$langs->trans(
'Employee').
'</td><td>';
967 print
'<input type="checkbox" name="employee" value="1"'.(GETPOST(
'employee') ==
'1' ?
' checked="checked"' : (($defaultemployee && !
GETPOSTISSET(
'login')) ?
' checked="checked"' :
'')).
'>';
972 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
974 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');
980 print
'<tr><td class="titlefieldcreate">';
981 $text = $langs->trans(
"ForceUserExpenseValidator");
982 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
985 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');
992 print
'<tr><td class="titlefieldcreate">';
993 $text = $langs->trans(
"ForceUserHolidayValidator");
994 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
997 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');
1003 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
1005 print
$form->textwithpicto($langs->trans(
"Internal"), $langs->trans(
"InternalExternalDesc"), 1,
'help',
'', 0, 2);
1009 print
'</table><hr><table class="border centpercent">';
1013 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1015 print
$form->selectDate($datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 1);
1019 print
$form->selectDate($dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0);
1024 print
'<tr><td class="fieldrequired">'.$langs->trans(
"Password").
'</td>';
1027 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1028 $valuetoshow .= ($valuetoshow ?
' + ' :
'').$langs->trans(
"PasswordOfUserInLDAP").
' (hidden)';
1030 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1031 $valuetoshow .= ($valuetoshow ?
' + ' :
'').$langs->trans(
"HTTPBasicPassword");
1033 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication)) {
1034 if (!empty($ldap_pass)) {
1035 $valuetoshow .= ($valuetoshow ?
' + ' :
'').
'<input type="hidden" name="password" value="'.
dol_escape_htmltag($ldap_pass).
'">';
1036 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
1039 $valuetoshow .= ($valuetoshow ?
' + '.$langs->trans(
"DolibarrPassword") :
'').
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxsize="32" type="text" id="password" name="password" value="'.
dol_escape_htmltag($password).
'" autocomplete="new-password">';
1040 if (!empty($conf->use_javascript_ajax)) {
1041 $valuetoshow .=
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_password" class="linkobject"');
1047 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
1048 $reshook = $hookmanager->executeHooks(
'printUserPasswordField',
$parameters, $object, $action);
1050 $valuetoshow = $hookmanager->resPrint;
1052 $valuetoshow .= $hookmanager->resPrint;
1058 if (!empty($conf->api->enabled)) {
1061 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1063 print
'<input class="minwidth300 maxwidth400 widthcentpercentminusx" maxsize="32" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off">';
1064 if (!empty($conf->use_javascript_ajax)) {
1065 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject"');
1071 print
'<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
1075 print
'</table><hr><table class="border centpercent">';
1079 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1080 print
'<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1081 print $object->address;
1082 print
'</textarea></td></tr>';
1085 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1086 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1090 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1091 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1095 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1096 print
img_picto(
'',
'country',
'class="pictofixedwidth"');
1097 print
$form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id));
1099 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1104 if (empty($conf->global->USER_DISABLE_STATE)) {
1105 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1106 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
1107 print $formcompany->select_state($object->state_id, $object->country_code,
'state_id');
1112 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1114 print
img_picto(
'',
'object_phoning',
'class="pictofixedwidth"');
1115 if (!empty($ldap_phone)) {
1116 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1119 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1124 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1126 print
img_picto(
'',
'object_phoning_mobile',
'class="pictofixedwidth"');
1127 if (!empty($ldap_mobile)) {
1128 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1131 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1136 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1138 print
img_picto(
'',
'object_phoning_fax',
'class="pictofixedwidth"');
1139 if (!empty($ldap_fax)) {
1140 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1143 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1148 print
'<tr><td'.(!empty($conf->global->USER_MAIL_REQUIRED) ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1150 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
1151 if (!empty($ldap_mail)) {
1152 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1155 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1161 foreach ($socialnetworks as $key => $value) {
1162 if ($value[
'active']) {
1163 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1165 if (!empty($value[
'icon'])) {
1166 print
'<span class="fa '.$value[
'icon'].
' pictofixedwidth"></span>';
1168 if (!empty($ldap_social[$key])) {
1169 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1170 print $ldap_social[$key];
1172 print
'<input class="maxwidth200 widthcentpercentminusx" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1177 if (!empty($ldap_social[$key])) {
1178 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1180 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1188 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1190 print
'<input type="text" class="maxwidthonsmartphone" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1196 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1198 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') : $object->color,
'color',
null, 1,
'',
'hideifnotset');
1203 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
1204 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td>';
1205 $cate_arbo =
$form->select_all_categories(
'user',
null,
'parent',
null,
null, 1);
1206 print
img_picto(
'',
'category',
'class="pictofixedwidth"').$form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), 0, 0,
'maxwdith300 widthcentpercentminusx', 0,
'90%');
1212 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0,
'string',
'', 0, 0,
'id', $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup"))).
'</td>';
1213 print
'<td class="maxwidthonsmartphone">'.
"\n";
1214 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,
'maxwidth300 widthcentpercentminusx');
1222 if (!method_exists($mc,
'formObjectOptions')) {
1223 if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
1224 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1225 print
"<td>".$mc->select_entities($conf->entity);
1226 print
"</td></tr>\n";
1228 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1235 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1238 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1239 print
'<td class="wordbreak">';
1240 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1242 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true, $acceptlocallinktomedia, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4,
'90%');
1243 print $doleditor->Create(1);
1247 print
'<tr><td class="tdtop">';
1248 print $langs->trans(
"NotePublic");
1250 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1251 $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%');
1252 $doleditor->Create();
1253 print
"</td></tr>\n";
1256 print
'<tr><td class="tdtop">';
1257 print $langs->trans(
"NotePrivate");
1259 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1260 $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%');
1261 $doleditor->Create();
1262 print
"</td></tr>\n";
1264 print
'</table><hr><table class="border centpercent">';
1270 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
1271 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1272 print $formproduct->selectWarehouses($object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1277 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1279 print
'<input class="maxwidth200 maxwidth150onsmartphone" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1282 if ((!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"read") && in_array($id, $childids))
1283 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
1284 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1285 $langs->load(
"salaries");
1289 $text = $langs->trans(
"THM");
1290 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1293 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1299 $text = $langs->trans(
"TJM");
1300 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1303 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1308 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1310 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
dol_escape_htmltag(
GETPOST(
'salary')).
'"> '.$langs->getCurrencySymbol($conf->currency);
1316 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1318 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1323 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1325 print
$form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1);
1329 print
$form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0);
1334 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1336 print
$form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0, 0,
'', 0,
'',
'', 1,
'',
'',
'tzserver');
1344 print
$form->buttonsSaveCancel(
"CreateUser");
1350 $res = $object->fetch($id,
'',
'', 1);
1355 $res = $object->fetch_optionals();
1358 if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
1359 $object->getrights();
1360 if (empty($object->nb_rights) && $object->statut != 0 && empty($object->admin)) {
1367 if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
1369 $result = $ldap->connect_bind();
1371 $userSearchFilter =
'('.$conf->global->LDAP_FILTER_CONNECTION.
'('.$ldap->getUserIdentifier().
'='.$object->login.
'))';
1372 $entries = $ldap->fetch($object->login, $userSearchFilter);
1377 $passDoNotExpire = 0;
1378 $userChangePassNextLogon = 0;
1383 if (count($ldap->uacf) > 0) {
1384 foreach ($ldap->uacf as $key => $statut) {
1385 if ($key == 65536) {
1386 $passDoNotExpire = 1;
1387 $statutUACF = $statut;
1392 $statutUACF =
"ACCOUNTDISABLE";
1395 if ($ldap->pwdlastset == 0) {
1396 $userChangePassNextLogon = 1;
1402 if ($mode ==
'employee') {
1403 $title = $langs->trans(
"Employee");
1404 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1406 $title = $langs->trans(
"User");
1409 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
1410 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1419 if ($action ==
'password') {
1420 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword", $object->login),
"confirm_password",
'', 0, 1);
1426 if ($action ==
'passwordsend') {
1427 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword", $object->login),
"confirm_passwordsend",
'', 0, 1);
1433 if ($action ==
'disable') {
1434 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser", $object->login),
"confirm_disable",
'', 0, 1);
1440 if ($action ==
'enable') {
1441 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser", $object->login),
"confirm_enable",
'', 0, 1);
1447 if ($action ==
'delete') {
1448 print
$form->formconfirm($_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser", $object->login),
"confirm_delete",
'', 0, 1);
1454 if ($action !=
'edit') {
1457 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
1458 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
1459 $morehtmlref .=
'</a>';
1461 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
1463 print
'<div class="fichecenter">';
1464 print
'<div class="fichehalfleft">';
1466 print
'<div class="underbanner clearboth"></div>';
1467 print
'<table class="border tableforfield centpercent">';
1470 print
'<tr><td class="titlefieldmiddle">'.$langs->trans(
"Login").
'</td>';
1471 if (!empty($object->ldap_sid) && $object->statut == 0) {
1472 print
'<td class="error">';
1473 print $langs->trans(
"LoginAccountDisableInDolibarr");
1478 if (property_exists($object,
'admin')) {
1479 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
1480 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
1481 } elseif (!empty($object->admin)) {
1482 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
1492 $text = $langs->trans(
"Type");
1493 print
$form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1495 $type = $langs->trans(
"Internal");
1496 if ($object->socid > 0) {
1497 $type = $langs->trans(
"External");
1499 print
'<span class="badgeneutral">';
1501 if ($object->ldap_sid) {
1502 print
' ('.$langs->trans(
"DomainUser").
')';
1505 print
'</td></tr>'.
"\n";
1508 if ($object->ldap_sid) {
1509 print
'<tr><td>'.$langs->trans(
"Type").
'</td><td>';
1510 print $langs->trans(
"DomainUser", $ldap->domainFQDN);
1511 print
'</td></tr>'.
"\n";
1515 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td>';
1516 print
'<input type="checkbox" disabled name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
1518 print
'</td></tr>'.
"\n";
1523 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1525 if (empty($object->fk_user)) {
1526 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1528 $huser =
new User($db);
1529 if ($object->fk_user > 0) {
1530 $huser->fetch($object->fk_user);
1531 print $huser->getNomUrl(1);
1533 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1542 $text = $langs->trans(
"ForceUserExpenseValidator");
1543 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1546 if (!empty($object->fk_user_expense_validator)) {
1547 $evuser =
new User($db);
1548 $evuser->fetch($object->fk_user_expense_validator);
1549 print $evuser->getNomUrl(1);
1558 $text = $langs->trans(
"ForceUserHolidayValidator");
1559 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1562 if (!empty($object->fk_user_holiday_validator)) {
1563 $hvuser =
new User($db);
1564 $hvuser->fetch($object->fk_user_holiday_validator);
1565 print $hvuser->getNomUrl(1);
1572 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1573 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
1577 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1584 if ((empty($user->socid) && in_array($id, $childids))
1585 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
1586 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
1587 $langs->load(
"salaries");
1590 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1592 print ($object->salary !=
'' ?
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<span class="amount">'.
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'').
'</span>';
1598 $text = $langs->trans(
"THM");
1599 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1602 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1608 $text = $langs->trans(
"TJM");
1609 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1612 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1618 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1620 if ($object->dateemployment) {
1621 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1624 if ($object->dateemploymentend) {
1625 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1632 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1639 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
1640 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1641 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1642 if ($object->fk_warehouse > 0) {
1643 $warehousestatic =
new Entrepot($db);
1644 $warehousestatic->fetch($object->fk_warehouse);
1645 print $warehousestatic->getNomUrl(1);
1653 print
'<div class="fichehalfright">';
1655 print
'<div class="underbanner clearboth"></div>';
1657 print
'<table class="border tableforfield centpercent">';
1661 print
'<tr><td class="titlefield">'.$langs->trans(
"ColorUser").
'</td>';
1663 print $formother->showColor($object->color,
'');
1669 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
1670 print
'<tr><td class="titlefield">'.$langs->trans(
"Categories").
'</td>';
1671 print
'<td colspan="3">';
1672 print
$form->showCategories($object->id, Categorie::TYPE_USER, 1);
1678 $langs->load(
"languages");
1679 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1680 print
'<tr><td class="titlefield">';
1681 print
$form->textwithpicto($langs->trans(
"DefaultLang"), $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1685 $labellang = ($object->lang ? $langs->trans(
'Language_'.$object->lang) :
'');
1686 print
picto_from_langcode($object->lang,
'class="paddingrightonly saturatemedium opacitylow"');
1691 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) {
1692 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1693 print
'<td>'.$object->openid.
'</td>';
1700 if (!method_exists($mc,
'formObjectOptions')) {
1701 if (
isModEnabled(
'multicompany') && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) {
1702 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1703 if (empty($object->entity)) {
1704 print $langs->trans(
"AllEntities");
1706 $mc->getInfo($object->entity);
1709 print
"</td></tr>\n";
1715 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1719 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1722 if (isset($object->socid) && $object->socid > 0) {
1724 $societe->fetch($object->socid);
1725 if ($societe->id > 0) {
1726 $s .= $societe->getNomUrl(1,
'');
1729 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1731 if (!empty($object->contact_id)) {
1733 $contact->fetch($object->contact_id);
1734 if ($contact->id > 0) {
1735 if ($object->socid > 0 && $s) {
1740 $s .= $contact->getNomUrl(1,
'');
1750 $langs->load(
"members");
1751 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1753 if ($object->fk_member) {
1755 $adh->fetch($object->fk_member);
1756 $adh->ref = $adh->getFullname($langs);
1757 print $adh->getNomUrl(-1);
1759 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1766 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td class="wordbreak">';
1768 print
"</td></tr>\n";
1775 print
'<div class="div-table-responsive-no-min">';
1776 print
'<table class="border tableforfield centpercent">';
1777 print
'<tr class="liste_titre"><td class="liste_titre">';
1778 print
img_picto(
'',
'security',
'class="paddingleft pictofixedwidth"').$langs->trans(
"Credentials");
1780 print
'<td class="liste_titre"></td>';
1784 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1786 if ($object->datestartvalidity) {
1787 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1790 if ($object->dateendvalidity) {
1791 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1799 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
1800 if (!empty($object->ldap_sid)) {
1801 if ($passDoNotExpire) {
1802 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1803 } elseif ($userChangePassNextLogon) {
1804 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1805 } elseif ($userDisabled) {
1806 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1808 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1811 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1814 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
1815 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1836 $parameters = array(
'valuetoshow' => $valuetoshow);
1837 $reshook = $hookmanager->executeHooks(
'printUserPasswordField',
$parameters, $object, $action);
1839 $valuetoshow = $hookmanager->resPrint;
1841 $valuetoshow .= $hookmanager->resPrint;
1845 print
'<tr class="nooddeven"><td class="titlefield">'.$langs->trans(
"Password").
'</td>';
1846 print
'<td class="wordbreak">';
1853 if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->hasRight(
"api",
"apikey",
"generate"))) {
1854 print
'<tr class="nooddeven"><td>'.$langs->trans(
"ApiKey").
'</td>';
1856 if (!empty($object->api_key)) {
1857 print
'<span class="opacitymedium">';
1864 print
'<tr class="nooddeven"><td>'.$langs->trans(
"LastConnexion").
'</td>';
1866 if ($object->datepreviouslogin) {
1867 print
dol_print_date($object->datepreviouslogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Previous").
')</span>, ';
1869 if ($object->datelastlogin) {
1870 print
dol_print_date($object->datelastlogin,
"dayhour",
"tzuserrel").
' <span class="opacitymedium">('.$langs->trans(
"Currently").
')</span>';
1881 print
'<div style="clear:both"></div>';
1890 print
'<div class="tabsAction">';
1893 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons',
$parameters, $object, $action);
1894 if (empty($reshook)) {
1895 if (empty($user->socid)) {
1896 $canSendMail =
false;
1900 'class' =>
'classfortooltip'
1903 if (!empty($object->email)) {
1904 $langs->load(
"mails");
1905 $canSendMail =
true;
1907 $langs->load(
"mails");
1908 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
1910 print
dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'default', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=presend&mode=init#formmailbeforetitle',
'', $canSendMail, $params);
1913 if ($caneditfield && (!
isModEnabled(
'multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1917 'class' =>
'classfortooltip'
1920 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
1921 $params[
'attr'][
'title'] = $langs->trans(
'DisabledInMonoUserMode');
1922 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1924 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit&token='.
newToken(),
'',
true, $params);
1926 } elseif ($caneditpassword && !$object->ldap_sid &&
1927 (!
isModEnabled(
'multicompany') || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1931 'class' =>
'classfortooltip'
1934 print
dolGetButtonAction($langs->trans(
'Modify'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit',
'',
true, $params);
1941 'class' =>
'classfortooltip'
1944 if ($conf->global->USER_PASSWORD_GENERATED !=
'none') {
1945 if ($object->statut == 0) {
1946 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
1947 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1948 } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
1949 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1950 print
dolGetButtonAction($langs->trans(
'ReinitPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=password&token='.
newToken(),
'',
true, $params);
1953 if ($object->statut == 0) {
1954 $params[
'attr'][
'title'] = $langs->trans(
'UserDisabled');
1955 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1956 } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
1957 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1958 if ($object->email) {
1959 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=passwordsend&token='.
newToken(),
'',
true, $params);
1961 $params[
'attr'][
'title'] = $langs->trans(
'NoEMail');
1962 print
dolGetButtonAction($langs->trans(
'SendNewPassword'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1971 'class' =>
'classfortooltip'
1974 if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
1975 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1976 print
dolGetButtonAction($langs->trans(
'Reactivate'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=enable&token='.newToken(),
'',
true, $params);
1979 if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
1980 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1981 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'] .
'?id=' . $object->id .
'&action=disable&token='.newToken(),
'',
true, $params);
1983 if ($user->id == $id) {
1984 $params[
'attr'][
'title'] = $langs->trans(
'CantDisableYourself');
1985 print
dolGetButtonAction($langs->trans(
'DisableUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'#',
'',
false, $params);
1989 if ($user->id <> $id && $candisableuser &&
1990 ((!
isModEnabled(
'multicompany') && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1))) {
1991 if ($user->admin || !$object->admin) {
1992 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'',
true, $params);
1994 $params[
'attr'][
'title'] = $langs->trans(
'MustBeAdminToDeleteOtherAdmin');
1995 print
dolGetButtonAction($langs->trans(
'DeleteUser'),
'',
'default', $_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$object->id,
'',
false, $params);
2005 if (
GETPOST(
'modelselected')) {
2006 $action =
'presend';
2010 $modelmail =
'user';
2011 $defaulttopic =
'Information';
2012 $diroutput = $conf->user->dir_output;
2013 $trackid =
'use'.$object->id;
2015 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
2017 if ($action !=
'presend' && $action !=
'send') {
2022 if ($canreadgroup) {
2023 print
'<!-- Group section -->'.
"\n";
2031 $groupslist = $usergroup->listGroupsForUser($object->id,
false);
2033 if (!empty($groupslist)) {
2034 foreach ($groupslist as $groupforuser) {
2035 $exclude[] = $groupforuser->id;
2040 $parameters = array(
'caneditgroup' => $caneditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
2041 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup',
$parameters, $object, $action);
2042 print $hookmanager->resPrint;
2044 if (empty($reshook)) {
2045 if ($caneditgroup) {
2046 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">'.
"\n";
2047 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
2048 print
'<input type="hidden" name="action" value="addgroup" />';
2049 print
'<input type="hidden" name="page_y" value="" />';
2052 print
'<table class="noborder centpercent">'.
"\n";
2053 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
2054 print
'<th class="liste_titre right">';
2055 if ($caneditgroup) {
2056 print
$form->select_dolgroups(
'',
'group', 1, $exclude, 0,
'',
'', $object->entity);
2058 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2059 print
'<input type="submit" class="button buttongen button-add reposition" value="'.$langs->trans(
"Add").
'" />';
2061 print
'</th></tr>'.
"\n";
2064 if (!empty($groupslist)) {
2065 foreach ($groupslist as $group) {
2066 print
'<tr class="oddeven">';
2068 if ($caneditgroup) {
2069 print $group->getNomUrl(1);
2071 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
2074 print
'<td class="right">';
2075 if ($caneditgroup) {
2076 print
'<a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=removegroup&token='.
newToken().
'&group='.((int) $group->id).
'">';
2077 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2082 print
"</td></tr>\n";
2085 print
'<tr class="oddeven"><td colspan="3"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
2090 if ($caneditgroup) {
2102 if ($action ==
'edit' && ($canedituser || $caneditpassword)) {
2103 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2104 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2105 print
'<input type="hidden" name="action" value="update">';
2106 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2110 print
'<table class="border centpercent">';
2113 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
2114 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Ref").
'</td>';
2122 print
'<tr><td class="titlefieldcreate"><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td>';
2123 if ($caneditfield && !$object->ldap_sid) {
2124 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') : $object->civility_code,
'civility_code');
2125 } elseif ($object->civility_code) {
2126 print $langs->trans(
"Civility".$object->civility_code);
2132 print
'<td class="titlefieldcreate fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2134 if ($caneditfield && !$object->ldap_sid) {
2135 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2137 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2138 print $object->lastname;
2144 print
'<tr><td>'.$langs->trans(
"Firstname").
'</td>';
2146 if ($caneditfield && !$object->ldap_sid) {
2147 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2149 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2150 print $object->firstname;
2155 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2157 if ($user->admin && !$object->ldap_sid) {
2158 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2160 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2161 print $object->login;
2167 print
'<tr><td>'.$langs->trans(
"Administrator").
'</td>';
2168 if ($object->socid > 0) {
2169 $langs->load(
"admin");
2171 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn($object->admin);
2172 print
' ('.$langs->trans(
"ExternalUser").
')';
2176 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2177 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2181 && ($user->id != $object->id)
2184 || (
isModEnabled(
'multicompany') && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1))
2187 print
$form->selectyesno(
'admin', $object->admin, 1);
2190 if ($conf->use_javascript_ajax) {
2191 print
'<script type="text/javascript">
2193 var admin = $("select[name=admin]").val();
2195 $("input[name=superadmin]")
2196 .prop("disabled", true)
2197 .prop("checked", false);
2199 if ($("input[name=superadmin]").is(":checked")) {
2200 $("select[name=entity]")
2201 .prop("disabled", true);
2203 $("select[name=admin]").change(function() {
2204 if ( $(this).val() == 0 ) {
2205 $("input[name=superadmin]")
2206 .prop("disabled", true)
2207 .prop("checked", false);
2208 $("select[name=entity]")
2209 .prop("disabled", false);
2211 $("input[name=superadmin]")
2212 .prop("disabled", false);
2215 $("input[name=superadmin]").change(function() {
2216 if ( $(this).is(":checked")) {
2217 $("select[name=entity]")
2218 .prop("disabled", true);
2220 $("select[name=entity]")
2221 .prop("disabled", false);
2228 $checked = (($object->admin && !$object->entity) ?
' checked' :
'');
2229 print
'<input type="checkbox" name="superadmin" id="superadmin" value="1"'.$checked.
' /> <label for="superadmin">'.$langs->trans(
"SuperAdministrator").
'</span>';
2232 $yn =
yn($object->admin);
2233 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2234 print
'<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).
'">';
2235 if (
isModEnabled(
'multicompany') && empty($object->entity)) {
2236 print
$form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2245 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2247 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
2248 if ($caneditfield) {
2251 print $arraygender[$object->gender];
2257 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2258 if ($caneditfield) {
2259 print
'<input type="checkbox" name="employee" value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2262 print
'<input type="checkbox" name="employee" disabled value="1"'.($object->employee ?
' checked="checked"' :
'').
'>';
2272 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2274 if ($caneditfield) {
2275 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');
2277 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2278 $huser =
new User($db);
2279 $huser->fetch($object->fk_user);
2280 print $huser->getNomUrl(1);
2287 print
'<tr><td class="titlefieldcreate">';
2288 $text = $langs->trans(
"ForceUserExpenseValidator");
2289 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2292 if ($caneditfield) {
2293 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');
2295 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2296 $evuser =
new User($db);
2297 $evuser->fetch($object->fk_user_expense_validator);
2298 print $evuser->getNomUrl(1);
2306 print
'<tr><td class="titlefieldcreate">';
2307 $text = $langs->trans(
"ForceUserHolidayValidator");
2308 print
$form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2311 if ($caneditfield) {
2312 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');
2314 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2315 $hvuser =
new User($db);
2316 $hvuser->fetch($object->fk_user_holiday_validator);
2317 print $hvuser->getNomUrl(1);
2324 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2326 if ($user->id == $object->id || !$user->admin) {
2328 $type = $langs->trans(
"Internal");
2329 if ($object->socid) {
2330 $type = $langs->trans(
"External");
2332 print
$form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2333 if ($object->ldap_sid) {
2334 print
' ('.$langs->trans(
"DomainUser").
')';
2339 if ($object->contact_id) {
2340 $type = $object->contact_id;
2343 if ($object->socid > 0 && !($object->contact_id > 0)) {
2344 print
img_picto(
'',
'company').$form->select_company($object->socid,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2345 print
img_picto(
'',
'contact').$form->selectcontacts(0, 0,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2346 if ($object->ldap_sid) {
2347 print
' ('.$langs->trans(
"DomainUser").
')';
2349 } elseif ($object->socid > 0 && $object->contact_id > 0) {
2350 print
img_picto(
'',
'company').$form->select_company($object->socid,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2351 print
img_picto(
'',
'contact').$form->selectcontacts(0, $object->contact_id,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2352 if ($object->ldap_sid) {
2353 print
' ('.$langs->trans(
"DomainUser").
')';
2355 } elseif (!($object->socid > 0) && $object->contact_id > 0) {
2356 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2357 print
img_picto(
'',
'contact').$form->selectcontacts(0, $object->contact_id,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2358 if ($object->ldap_sid) {
2359 print
' ('.$langs->trans(
"DomainUser").
')';
2362 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ', 0, 0,
null, 0,
'maxwidth300');
2363 print
img_picto(
'',
'contact').$form->selectcontacts(0, 0,
'contactid', 1,
'',
'', 1,
'maxwidth300',
false, 1);
2373 print
'<table class="border centpercent">';
2376 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2378 if ($caneditfield) {
2379 print
$form->selectDate($datestartvalidity ? $datestartvalidity : $object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 1, 0,
'',
'',
'',
'', 1,
'',
'');
2389 if ($caneditfield) {
2390 print
$form->selectDate($dateendvalidity ? $datendevalidity : $object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'');
2398 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"Password").
'</td>';
2401 if (preg_match(
'/ldap/', $dolibarr_main_authentication)) {
2402 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2404 if (preg_match(
'/http/', $dolibarr_main_authentication)) {
2405 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2407 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication)) {
2408 if ($caneditpassword) {
2409 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="128" type="password" class="flat" id="password" name="password" value="'.
dol_escape_htmltag($object->pass).
'" autocomplete="new-password">';
2411 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*', $object->pass);
2416 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpassword' => $caneditpassword);
2417 $reshook = $hookmanager->executeHooks(
'printUserPasswordField',
$parameters, $object, $action);
2419 $valuetoshow = $hookmanager->resPrint;
2421 $valuetoshow .= $hookmanager->resPrint;
2425 print
"</td></tr>\n";
2429 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2431 if ($caneditpassword || $user->hasRight(
"api",
"apikey",
"generate")) {
2432 print
'<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2433 if (!empty($conf->use_javascript_ajax)) {
2434 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject"');
2441 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER)) {
2442 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2444 if ($caneditfield) {
2445 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2447 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2448 print $object->openid;
2453 print
'</table><hr><table class="border centpercent">';
2457 print
'<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2459 if ($caneditfield) {
2460 print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2462 print $object->address;
2463 if ($caneditfield) {
2464 print
'</textarea>';
2469 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2470 if ($caneditfield) {
2471 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2478 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2479 if ($caneditfield) {
2480 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2482 print $object->town;
2487 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td>';
2488 if ($caneditfield) {
2489 print
$form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id),
'country_id');
2491 print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2494 $countrylabel =
getCountry($object->country_id,
'0');
2495 print $countrylabel;
2500 if (empty($conf->global->USER_DISABLE_STATE)) {
2501 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2502 if ($caneditfield) {
2503 print
img_picto(
'',
'state',
'class="pictofixedwidth"');
2504 print $formcompany->select_state($object->state_id, $object->country_code,
'state_id');
2506 print $object->state_label;
2512 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2514 print
img_picto(
'',
'phoning',
'class="pictofixedwidth"');
2515 if ($caneditfield && empty($object->ldap_sid)) {
2516 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2518 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2519 print $object->office_phone;
2524 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2526 print
img_picto(
'',
'phoning_mobile',
'class="pictofixedwidth"');
2527 if ($caneditfield && empty($object->ldap_sid)) {
2528 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2530 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2531 print $object->user_mobile;
2536 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2538 print
img_picto(
'',
'phoning_fax',
'class="pictofixedwidth"');
2539 if ($caneditfield && empty($object->ldap_sid)) {
2540 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2542 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2543 print $object->office_fax;
2548 print
"<tr>".
'<td'.(!empty($conf->global->USER_MAIL_REQUIRED) ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2550 print
img_picto(
'',
'object_email',
'class="pictofixedwidth"');
2551 if ($caneditfield && empty($object->ldap_sid)) {
2552 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2554 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2555 print $object->email;
2560 foreach ($socialnetworks as $key => $value) {
2561 if ($value[
'active']) {
2562 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2564 if (!empty($value[
'icon'])) {
2565 print
'<span class="fa '.$value[
'icon'].
' pictofixedwidth"></span>';
2567 if ($caneditfield && empty($object->ldap_sid)) {
2568 print
'<input type="text" name="'.$key.
'" class="flat maxwidth200" value="'.(isset($object->socialnetworks[$key])?$object->socialnetworks[$key]:
'').
'">';
2570 print
'<input type="hidden" name="'.$key.
'" value="'.$object->socialnetworks[$key].
'">';
2571 print $object->socialnetworks[$key];
2576 print
'<input type="hidden" name="'.$key.
'" value="'.(isset($object->socialnetworks[$key])?$object->socialnetworks[$key]:
'').
'">';
2581 print
'</table><hr><table class="border centpercent">';
2584 if (
isModEnabled(
'stock') && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER)) {
2585 print
'<tr><td class="titlefield">'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2586 print $formproduct->selectWarehouses($object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2587 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>';
2594 print
'<td class="titlefieldcreate">'.$langs->trans(
"AccountancyCode").
'</td>';
2596 if ($caneditfield) {
2597 print
'<input type="text" class="flat maxwidth300" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2599 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2600 print $object->accountancy_code;
2608 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"ColorUser").
'</td>';
2610 if ($caneditfield) {
2611 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') : $object->color,
'color',
null, 1,
'',
'hideifnotset');
2613 print $formother->showColor($object->color,
'');
2620 print
'<td class="titlefieldcreate">'.$langs->trans(
"Photo").
'</td>';
2622 print
$form->showphoto(
'userphoto', $object, 60, 0, $caneditfield,
'photowithmargin',
'small', 1, 0,
'user', 1);
2627 if (
isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"read")) {
2628 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
2630 print
img_picto(
'',
'category',
'class="pictofixedwidth"');
2631 $cate_arbo =
$form->select_all_categories(Categorie::TYPE_USER,
null,
null,
null,
null, 1);
2633 $cats = $c->containing($object->id, Categorie::TYPE_USER);
2634 $arrayselected = array();
2635 foreach ($cats as $cat) {
2636 $arrayselected[] = $cat->id;
2638 if ($caneditfield) {
2639 print
$form->multiselectarray(
'usercats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
2641 print
$form->showCategories($object->id, Categorie::TYPE_USER, 1);
2648 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";
2649 print
img_picto(
'',
'language',
'class="pictofixedwidth"').$formadmin->select_language($object->lang,
'default_lang', 0,
null,
'1', 0, 0,
'widthcentpercentminusx maxwidth300');
2655 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2657 print $object->getLibStatut(4);
2662 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2664 if ($object->socid > 0) {
2666 $societe->fetch($object->socid);
2667 print $societe->getNomUrl(1,
'');
2668 if ($object->contact_id) {
2670 $contact->fetch($object->contact_id);
2671 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>';
2674 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2676 print
' <span class="opacitymedium hideonsmartphone">('.$langs->trans(
"UseTypeFieldToChange").
')</span>';
2683 $langs->load(
"members");
2684 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2686 if ($object->fk_member) {
2688 $adh->fetch($object->fk_member);
2689 $adh->ref = $adh->login;
2690 print $adh->getNomUrl(1);
2692 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2702 if (!method_exists($mc,
'formObjectOptions')) {
2703 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity) {
2704 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2705 print
"<td>".$mc->select_entities($object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2706 print
"</td></tr>\n";
2708 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2716 $reshook = $hookmanager->executeHooks(
'formObjectOptions',
$parameters, $object, $action);
2717 print $hookmanager->resPrint;
2718 if (empty($reshook)) {
2719 if ($caneditfield) {
2720 print $object->showOptionals($extrafields,
'edit');
2722 print $object->showOptionals($extrafields,
'view');
2727 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2729 if ($caneditfield) {
2730 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2732 $doleditor =
new DolEditor(
'signature', $object->signature,
'', 138,
'dolibarr_notes',
'In',
false, $acceptlocallinktomedia, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4,
'90%');
2733 print $doleditor->Create(1);
2745 print
'<table class="border centpercent">';
2751 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
2753 if ($caneditfield) {
2754 print
'<input type="text" class="minwidth300 maxwidth500" name="job" value="'.dol_escape_htmltag($object->job).
'">';
2756 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag($object->job).
'">';
2762 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2764 if ($caneditfield) {
2765 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') : $object->weeklyhours).
'">';
2773 if ((empty($user->socid) && in_array($id, $childids))
2774 || (!empty($conf->salaries->enabled) && $user->hasRight(
"salaries",
"readall"))
2775 || (
isModEnabled(
'hrm') && $user->hasRight(
"hrm",
"employee",
"read"))) {
2776 $langs->load(
"salaries");
2779 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2781 print
img_picto(
'',
'salary',
'class="pictofixedwidth paddingright"').
'<input size="8" type="text" name="salary" value="'.
price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') : $object->salary).
'">';
2787 $text = $langs->trans(
"THM");
2788 print
$form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2791 if ($caneditfield) {
2792 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') : $object->thm).
'">';
2794 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
2801 $text = $langs->trans(
"TJM");
2802 print
$form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2805 if ($caneditfield) {
2806 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') : $object->tjm).
'">';
2808 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
2815 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2817 if ($caneditfield) {
2818 print
$form->selectDate($dateemployment ? $dateemployment : $object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1);
2823 if ($dateemployment && $dateemploymentend) {
2827 if ($caneditfield) {
2828 print
$form->selectDate($dateemploymentend ? $dateemploymentend : $object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0);
2836 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2838 if ($caneditfield) {
2839 echo
$form->selectDate($dateofbirth ? $dateofbirth : $object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0, 0,
'',
'',
'',
'', 1,
'',
'',
'tzserver');
2850 print
'<div class="center">';
2851 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2852 print
' ';
2853 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2859 if ($action !=
'edit' && $action !=
'presend') {
2860 print
'<div class="fichecenter"><div class="fichehalfleft">';
2865 $urlsource = $_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2866 $genallowed = $user->hasRight(
"user",
"user",
"read");
2867 $delallowed = $user->hasRight(
"user",
"user",
"write");
2869 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);
2870 $somethingshown = $formfile->numoffiles;
2873 $linktoelem =
$form->showLinkToObjectBlock($object,
null,
null);
2874 $somethingshown =
$form->showLinkedObjectBlock($object, $linktoelem);
2876 print
'</div><div class="fichehalfright">';
2879 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2881 $somethingshown =
$formactions->showactions($object,
'user', $socid, 1,
'listactions', 0,
'',
'', $object->id);
2883 print
'</div></div>';
2886 if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) {
2893 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', $generic=1)
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.