38 require
'../main.inc.php';
39 require_once DOL_DOCUMENT_ROOT.
'/user/class/user.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/user/class/usergroup.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
44 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
45 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
48 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
49 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
50 require_once DOL_DOCUMENT_ROOT.
'/core/lib/security2.lib.php';
51 if (!empty($conf->ldap->enabled)) require_once DOL_DOCUMENT_ROOT.
'/core/class/ldap.class.php';
52 if (!empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
53 if (!empty($conf->categorie->enabled)) require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
54 if (!empty($conf->stock->enabled)) require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
57 $action =
GETPOST(
'action',
'aZ09');
58 $mode =
GETPOST(
'mode',
'alpha');
59 $confirm =
GETPOST(
'confirm',
'alpha');
60 $group =
GETPOST(
"group",
"int", 3);
61 $cancel =
GETPOST(
'cancel',
'alpha');
62 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'useracard';
64 $dateemployment =
dol_mktime(0, 0, 0,
GETPOST(
'dateemploymentmonth',
'int'),
GETPOST(
'dateemploymentday',
'int'),
GETPOST(
'dateemploymentyear',
'int'));
65 $dateemploymentend =
dol_mktime(0, 0, 0,
GETPOST(
'dateemploymentendmonth',
'int'),
GETPOST(
'dateemploymentendday',
'int'),
GETPOST(
'dateemploymentendyear',
'int'));
66 $datestartvalidity =
dol_mktime(0, 0, 0,
GETPOST(
'datestartvaliditymonth',
'int'),
GETPOST(
'datestartvalidityday',
'int'),
GETPOST(
'datestartvalidityyear',
'int'));
67 $dateendvalidity =
dol_mktime(0, 0, 0,
GETPOST(
'dateendvaliditymonth',
'int'),
GETPOST(
'dateendvalidityday',
'int'),
GETPOST(
'dateendvalidityyear',
'int'));
71 $canadduser = (!empty($user->admin) || $user->rights->user->user->creer);
72 $canreaduser = (!empty($user->admin) || $user->rights->user->user->lire);
73 $canedituser = (!empty($user->admin) || $user->rights->user->user->creer);
74 $candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer);
75 $canreadgroup = $canreaduser;
76 $caneditgroup = $canedituser;
77 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS))
79 $canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read);
80 $caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write);
87 $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
88 || (($user->id != $id) && $user->rights->user->user->creer));
89 $caneditpassword = ((($user->id == $id) && $user->rights->user->self->password)
90 || (($user->id != $id) && $user->rights->user->user->password));
95 if ($user->socid > 0) $socid = $user->socid;
102 $langs->loadLangs(array(
'users',
'companies',
'ldap',
'admin',
'hrm',
'stocks'));
104 $object =
new User($db);
108 $extrafields->fetch_name_optionals_label($object->table_element);
113 $hookmanager->initHooks(array(
'usercard',
'globalcard'));
121 $parameters = array(
'id' => $id,
'socid' => $socid,
'group' => $group,
'caneditgroup' => $caneditgroup);
122 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
123 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
125 if (empty($reshook)) {
126 if ($action ==
'confirm_disable' && $confirm ==
"yes" && $candisableuser) {
127 if ($id <> $user->id) {
129 $object->setstatus(0);
130 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$id);
134 if ($action ==
'confirm_enable' && $confirm ==
"yes" && $candisableuser) {
137 if ($id <> $user->id) {
140 if (!empty($conf->file->main_limit_users)) {
141 $nb = $object->getNbOfUsers(
"active");
142 if ($nb >= $conf->file->main_limit_users) {
144 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"), null,
'errors');
149 $object->setstatus(1);
150 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$id);
156 if ($action ==
'confirm_delete' && $confirm ==
"yes" && $candisableuser)
158 if ($id <> $user->id)
162 print 'Error, token required for this critical operation';
166 $object =
new User($db);
168 $object->oldcopy = clone $object;
170 $result = $object->delete($user);
172 $langs->load(
"errors");
176 header(
"Location: ".DOL_URL_ROOT.
"/user/list.php?restore_lastsearch_values=1");
183 if ($action ==
'add' && $canadduser) {
186 if (!$_POST[
"lastname"]) {
191 if (!$_POST[
"login"]) {
197 if (!empty($conf->file->main_limit_users)) {
198 $nb = $object->getNbOfUsers(
"active");
199 if ($nb >= $conf->file->main_limit_users) {
201 setEventMessages($langs->trans(
"YourQuotaOfUsersIsReached"), null,
'errors');
207 $object->civility_code =
GETPOST(
"civility_code",
'aZ09');
208 $object->lastname =
GETPOST(
"lastname",
'alphanohtml');
209 $object->firstname =
GETPOST(
"firstname",
'alphanohtml');
210 $object->login =
GETPOST(
"login",
'alphanohtml');
211 $object->api_key =
GETPOST(
"api_key",
'alphanohtml');
212 $object->gender =
GETPOST(
"gender",
'aZ09');
213 $object->admin =
GETPOST(
"admin",
'int');
214 $object->address =
GETPOST(
'address',
'alphanohtml');
215 $object->zip =
GETPOST(
'zipcode',
'alphanohtml');
216 $object->town =
GETPOST(
'town',
'alphanohtml');
217 $object->country_id =
GETPOST(
'country_id',
'int');
218 $object->state_id =
GETPOST(
'state_id',
'int');
219 $object->office_phone =
GETPOST(
"office_phone",
'alphanohtml');
220 $object->office_fax =
GETPOST(
"office_fax",
'alphanohtml');
221 $object->user_mobile =
GETPOST(
"user_mobile",
'alphanohtml');
227 $object->socialnetworks = array();
228 if (!empty($conf->socialnetworks->enabled)) {
229 foreach ($socialnetworks as $key => $value) {
230 $object->socialnetworks[$key] =
GETPOST($key,
'alphanohtml');
234 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
235 $object->job =
GETPOST(
"job",
'alphanohtml');
236 $object->signature =
GETPOST(
"signature",
'restricthtml');
237 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
238 $object->note =
GETPOST(
"note",
'restricthtml');
239 $object->note_private =
GETPOST(
"note",
'restricthtml');
240 $object->ldap_sid =
GETPOST(
"ldap_sid",
'alphanohtml');
241 $object->fk_user =
GETPOST(
"fk_user",
'int') > 0 ?
GETPOST(
"fk_user",
'int') : 0;
242 $object->fk_user_expense_validator =
GETPOST(
"fk_user_expense_validator",
'int') > 0 ?
GETPOST(
"fk_user_expense_validator",
'int') : 0;
243 $object->fk_user_holiday_validator =
GETPOST(
"fk_user_holiday_validator",
'int') > 0 ?
GETPOST(
"fk_user_holiday_validator",
'int') : 0;
244 $object->employee =
GETPOST(
'employee',
'alphanohtml');
246 $object->thm =
GETPOST(
"thm",
'alphanohtml') !=
'' ?
GETPOST(
"thm",
'alphanohtml') :
'';
248 $object->tjm =
GETPOST(
"tjm",
'alphanohtml') !=
'' ?
GETPOST(
"tjm",
'alphanohtml') :
'';
250 $object->salary =
GETPOST(
"salary",
'alphanohtml') !=
'' ?
GETPOST(
"salary",
'alphanohtml') :
'';
251 $object->salary =
price2num($object->salary);
252 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
253 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
255 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ?
GETPOST(
"color",
'alphanohtml') :
'';
257 $object->dateemployment = $dateemployment;
258 $object->dateemploymentend = $dateemploymentend;
259 $object->datestartvalidity = $datestartvalidity;
260 $object->dateendvalidity = $dateendvalidity;
261 $object->birth = $dateofbirth;
263 $object->fk_warehouse =
GETPOST(
'fk_warehouse',
'int');
265 $object->lang =
GETPOST(
'default_lang',
'aZ09');
268 $ret = $extrafields->setOptionalsFromPost(null, $object);
274 $entity =
GETPOST(
'entity',
'int');
275 if (!empty($conf->multicompany->enabled)) {
276 if (
GETPOST(
'superadmin',
'int')) {
279 if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
282 $object->entity = ($entity ==
'' ? 1 : $entity);
286 $object->entity = ($entity ==
'' ? 1 : $entity);
294 $id = $object->create($user);
297 $object->setPassword($user,
GETPOST(
'password'));
299 if (!empty($conf->categorie->enabled)) {
301 $usercats =
GETPOST(
'usercats',
'array');
302 $object->setCategories($usercats);
306 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$id);
309 $langs->load(
"errors");
318 if (($action ==
'addgroup' || $action ==
'removegroup') && $caneditgroup)
323 $editgroup->fetch($group);
324 $editgroup->oldcopy = clone $editgroup;
327 if ($action ==
'addgroup') {
328 $result = $object->SetInGroup($group, $editgroup->entity);
330 if ($action ==
'removegroup') {
331 $result = $object->RemoveFromGroup($group, $editgroup->entity);
335 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
'?id='.$id);
343 if ($action ==
'update' && !$cancel)
345 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
351 if (!
GETPOST(
"lastname",
'alpha')) {
356 if (!
GETPOST(
"login",
'alpha')) {
366 $object->oldcopy = clone $object;
370 $object->civility_code =
GETPOST(
"civility_code",
'aZ09');
371 $object->lastname =
GETPOST(
"lastname",
'alphanohtml');
372 $object->firstname =
GETPOST(
"firstname",
'alphanohtml');
373 $object->login =
GETPOST(
"login",
'alphanohtml');
374 $object->gender =
GETPOST(
"gender",
'aZ09');
375 $object->pass =
GETPOST(
"password",
'none');
376 $object->api_key = (
GETPOST(
"api_key",
'alphanohtml')) ?
GETPOST(
"api_key",
'alphanohtml') : $object->api_key;
377 if (!empty($user->admin)) $object->admin =
GETPOST(
"admin",
"int");
378 $object->address =
GETPOST(
'address',
'alphanohtml');
379 $object->zip =
GETPOST(
'zipcode',
'alphanohtml');
380 $object->town =
GETPOST(
'town',
'alphanohtml');
381 $object->country_id =
GETPOST(
'country_id',
'int');
382 $object->state_id =
GETPOST(
'state_id',
'int');
383 $object->office_phone =
GETPOST(
"office_phone",
'alphanohtml');
384 $object->office_fax =
GETPOST(
"office_fax",
'alphanohtml');
385 $object->user_mobile =
GETPOST(
"user_mobile",
'alphanohtml');
390 $object->socialnetworks = array();
391 if (!empty($conf->socialnetworks->enabled)) {
392 foreach ($socialnetworks as $key => $value) {
393 $object->socialnetworks[$key] =
GETPOST($key,
'alphanohtml');
396 $object->email = preg_replace(
'/\s+/',
'',
GETPOST(
"email",
'alphanohtml'));
397 $object->job =
GETPOST(
"job",
'alphanohtml');
398 $object->signature =
GETPOST(
"signature",
'restricthtml');
399 $object->accountancy_code =
GETPOST(
"accountancy_code",
'alphanohtml');
400 $object->openid =
GETPOST(
"openid",
'alphanohtml');
401 $object->fk_user =
GETPOST(
"fk_user",
'int') > 0 ?
GETPOST(
"fk_user",
'int') : 0;
402 $object->fk_user_expense_validator =
GETPOST(
"fk_user_expense_validator",
'int') > 0 ?
GETPOST(
"fk_user_expense_validator",
'int') : 0;
403 $object->fk_user_holiday_validator =
GETPOST(
"fk_user_holiday_validator",
'int') > 0 ?
GETPOST(
"fk_user_holiday_validator",
'int') : 0;
404 $object->employee =
GETPOST(
'employee',
'int');
406 $object->thm =
GETPOST(
"thm",
'alphanohtml') !=
'' ?
GETPOST(
"thm",
'alphanohtml') :
'';
408 $object->tjm =
GETPOST(
"tjm",
'alphanohtml') !=
'' ?
GETPOST(
"tjm",
'alphanohtml') :
'';
410 $object->salary =
GETPOST(
"salary",
'alphanohtml') !=
'' ?
GETPOST(
"salary",
'alphanohtml') :
'';
411 $object->salary =
price2num($object->salary);
412 $object->salaryextra =
GETPOST(
"salaryextra",
'alphanohtml') !=
'' ?
GETPOST(
"salaryextra",
'alphanohtml') :
'';
413 $object->salaryextra =
price2num($object->salaryextra);
414 $object->weeklyhours =
GETPOST(
"weeklyhours",
'alphanohtml') !=
'' ?
GETPOST(
"weeklyhours",
'alphanohtml') :
'';
415 $object->weeklyhours =
price2num($object->weeklyhours);
417 $object->color =
GETPOST(
"color",
'alphanohtml') !=
'' ?
GETPOST(
"color",
'alphanohtml') :
'';
418 $object->dateemployment = $dateemployment;
419 $object->dateemploymentend = $dateemploymentend;
420 $object->datestartvalidity = $datestartvalidity;
421 $object->dateendvalidity = $dateendvalidity;
422 $object->birth = $dateofbirth;
424 if (!empty($conf->stock->enabled))
426 $object->fk_warehouse =
GETPOST(
'fk_warehouse',
'int');
429 $object->lang =
GETPOST(
'default_lang',
'aZ09');
431 if (!empty($conf->multicompany->enabled))
433 if (!empty($_POST[
"superadmin"]))
436 } elseif (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
440 $object->entity = (!
GETPOST(
'entity',
'int') ? 0 :
GETPOST(
'entity',
'int'));
443 $object->entity = (!
GETPOST(
'entity',
'int') ? 0 :
GETPOST(
'entity',
'int'));
447 $ret = $extrafields->setOptionalsFromPost(null, $object);
455 if (!empty($_FILES[
'photo'][
'name']))
463 $langs->load(
"errors");
465 dol_syslog($langs->transnoentities(
"ErrorBadImageFormat"), LOG_INFO);
470 $ret = $object->update($user);
473 if ($db->errno() ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
474 $langs->load(
"errors");
475 setEventMessages($langs->trans(
"ErrorLoginAlreadyExists", $object->login), null,
'errors');
483 $contactid =
GETPOST(
'contactid',
'int');
484 $socid =
GETPOST(
'socid',
'int');
486 if ($contactid > 0) {
488 $contact->fetch($contactid);
490 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
491 $sql .=
" SET fk_socpeople=".((int) $contactid);
492 if (!empty($contact->socid)) {
493 $sql .=
", fk_soc=".((int) $contact->socid);
495 $sql .=
" WHERE rowid=".$object->id;
496 } elseif ($socid > 0) {
497 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
498 $sql .=
" SET fk_socpeople=NULL, fk_soc=".((int) $socid);
499 $sql .=
" WHERE rowid=".$object->id;
501 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"user";
502 $sql .=
" SET fk_socpeople=NULL, fk_soc=NULL";
503 $sql .=
" WHERE rowid=".$object->id;
506 $resql = $db->query($sql);
513 if (!$error && !count($object->errors)) {
514 if (
GETPOST(
'deletephoto') && $object->oldcopy->photo) {
515 $fileimg = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').$object->oldcopy->photo;
516 $dirthumbs = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 0, $object,
'user').
'/thumbs';
521 if (isset($_FILES[
'photo'][
'tmp_name']) && trim($_FILES[
'photo'][
'tmp_name'])) {
522 $dir = $conf->user->dir_output.
'/'.
get_exdir(0, 0, 0, 1, $object,
'user');
528 $result =
dol_move_uploaded_file($_FILES[
'photo'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'photo'][
'error']);
534 $object->addThumbs($newfile);
538 $langs->load(
"errors");
539 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $dir), $mesgs,
'errors');
544 if (!$error && !count($object->errors))
547 $categories =
GETPOST(
'usercats',
'array');
548 $object->setCategories($categories);
551 if (!$error && !count($object->errors)) {
555 $login = $_SESSION[
"dol_login"];
556 if ($login && $login == $object->oldcopy->login && $object->oldcopy->login != $object->login)
559 $langs->load(
"errors");
560 setEventMessages($langs->transnoentitiesnoconv(
"WarningYourLoginWasModifiedPleaseLogin"), null,
'warnings');
567 if ($caneditpassword)
569 dol_syslog(
"Not allowed to change fields, only password");
573 if (
GETPOST(
"password",
"none")) {
574 $object->oldcopy = clone $object;
576 $ret = $object->setPassword($user,
GETPOST(
"password",
"none"));
587 if ((($action ==
'confirm_password' && $confirm ==
'yes')
588 || ($action ==
'confirm_passwordsend' && $confirm ==
'yes')) && $caneditpassword
592 $newpassword = $object->setPassword($user,
'');
593 if ($newpassword < 0) {
595 setEventMessages($langs->trans(
"ErrorFailedToSetNewPassword"), null,
'errors');
598 if ($action ==
'confirm_passwordsend' && $confirm ==
'yes') {
599 if ($object->send_password($user, $newpassword) > 0)
601 setEventMessages($langs->trans(
"PasswordChangedAndSentTo", $object->email), null,
'mesgs');
606 setEventMessages($langs->trans(
"PasswordChangedTo", $newpassword), null,
'warnings');
612 if ($action ==
'adduserldap') {
613 $selecteduser = $_POST[
'users'];
615 $required_fields = array(
616 $conf->global->LDAP_KEY_USERS,
617 $conf->global->LDAP_FIELD_NAME,
618 $conf->global->LDAP_FIELD_FIRSTNAME,
619 $conf->global->LDAP_FIELD_LOGIN,
620 $conf->global->LDAP_FIELD_LOGIN_SAMBA,
621 $conf->global->LDAP_FIELD_PASSWORD,
622 $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
623 $conf->global->LDAP_FIELD_PHONE,
624 $conf->global->LDAP_FIELD_FAX,
625 $conf->global->LDAP_FIELD_MOBILE,
626 $conf->global->LDAP_FIELD_SKYPE,
627 $conf->global->LDAP_FIELD_MAIL,
628 $conf->global->LDAP_FIELD_TITLE,
629 $conf->global->LDAP_FIELD_DESCRIPTION,
630 $conf->global->LDAP_FIELD_SID
634 $result = $ldap->connect_bind();
637 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
639 $ldapusers = $ldap->getRecords($selecteduser, $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields);
642 if (is_array($ldapusers)) {
643 foreach ($ldapusers as $key => $attribute) {
644 $ldap_lastname = $attribute[$conf->global->LDAP_FIELD_NAME];
645 $ldap_firstname = $attribute[$conf->global->LDAP_FIELD_FIRSTNAME];
646 $ldap_login = $attribute[$conf->global->LDAP_FIELD_LOGIN];
647 $ldap_loginsmb = $attribute[$conf->global->LDAP_FIELD_LOGIN_SAMBA];
648 $ldap_pass = $attribute[$conf->global->LDAP_FIELD_PASSWORD];
649 $ldap_pass_crypted = $attribute[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED];
650 $ldap_phone = $attribute[$conf->global->LDAP_FIELD_PHONE];
651 $ldap_fax = $attribute[$conf->global->LDAP_FIELD_FAX];
652 $ldap_mobile = $attribute[$conf->global->LDAP_FIELD_MOBILE];
653 $ldap_social[
'skype'] = $attribute[$conf->global->LDAP_FIELD_SKYPE];
654 $ldap_social[
'twitter'] = $attribute[$conf->global->LDAP_FIELD_TWITTER];
655 $ldap_social[
'facebook'] = $attribute[$conf->global->LDAP_FIELD_FACEBOOK];
656 $ldap_social[
'linkedin'] = $attribute[$conf->global->LDAP_FIELD_LINKEDIN];
657 $ldap_mail = $attribute[$conf->global->LDAP_FIELD_MAIL];
658 $ldap_sid = $attribute[$conf->global->LDAP_FIELD_SID];
667 $triggersendname =
'USER_SENTBYMAIL';
669 $mode =
'emailfromuser';
670 $trackid =
'use'.$id;
671 include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
674 $upload_dir = $conf->user->dir_output;
675 $permissiontoadd = $user->rights->user->user->creer;
676 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
684 $form =
new Form($db);
689 if (!empty($conf->stock->enabled)) $formproduct =
new FormProduct($db);
691 llxHeader(
'', $langs->trans(
"UserCard"));
693 if ($action ==
'create' || $action ==
'adduserldap')
697 print '<span class="opacitymedium">'.$langs->trans(
"CreateInternalUserDesc").
"</span><br>\n";
701 if (!empty($conf->ldap->enabled) && (isset($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE ==
'ldap2dolibarr'))
705 $result = $ldap->connect_bind();
708 $required_fields = array(
709 $conf->global->LDAP_KEY_USERS,
710 $conf->global->LDAP_FIELD_FULLNAME,
711 $conf->global->LDAP_FIELD_NAME,
712 $conf->global->LDAP_FIELD_FIRSTNAME,
713 $conf->global->LDAP_FIELD_LOGIN,
714 $conf->global->LDAP_FIELD_LOGIN_SAMBA,
715 $conf->global->LDAP_FIELD_PASSWORD,
716 $conf->global->LDAP_FIELD_PASSWORD_CRYPTED,
717 $conf->global->LDAP_FIELD_PHONE,
718 $conf->global->LDAP_FIELD_FAX,
719 $conf->global->LDAP_FIELD_MOBILE,
720 $conf->global->LDAP_FIELD_SKYPE,
721 $conf->global->LDAP_FIELD_MAIL,
722 $conf->global->LDAP_FIELD_TITLE,
723 $conf->global->LDAP_FIELD_DESCRIPTION,
724 $conf->global->LDAP_FIELD_SID
728 $required_fields = array_unique(array_values(array_filter($required_fields,
"dol_validElement")));
731 $ldapusers = $ldap->getRecords(
'*', $conf->global->LDAP_USER_DN, $conf->global->LDAP_KEY_USERS, $required_fields, 1);
733 if (is_array($ldapusers))
736 foreach ($ldapusers as $key => $ldapuser)
740 foreach ($required_fields as $value)
742 if ($value === $conf->global->LDAP_FIELD_PASSWORD || $value === $conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
744 $label .= $value.
"=******* ";
746 $label .= $value.
"=".$ldapuser[$value].
" ";
749 $liste[$key] = $label;
759 print "\n\n<!-- Form liste LDAP debut -->\n";
761 print '<form name="add_user_ldap" action="'.$_SERVER[
"PHP_SELF"].
'" method="post">';
762 print '<input type="hidden" name="token" value="'.newToken().
'">';
763 print '<table class="border centpercent"><tr>';
764 print '<td width="160">';
765 print $langs->trans(
"LDAPUsers");
768 print '<input type="hidden" name="action" value="adduserldap">';
769 if (is_array($liste) && count($liste))
771 print $form->selectarray(
'users', $liste,
'', 1, 0, 0,
'', 0, 0, 0,
'',
'maxwidth500');
774 print '</td><td class="center">';
775 print '<input type="submit" class="button" value="'.dol_escape_htmltag($langs->trans(
'Get')).
'"'.(count($liste) ?
'' :
' disabled').
'>';
776 print '</td></tr></table>';
779 print "\n<!-- Form liste LDAP fin -->\n\n";
784 print '<form action="'.$_SERVER[
'PHP_SELF'].
'" method="POST" name="createuser">';
785 print '<input type="hidden" name="token" value="'.newToken().
'">';
786 print '<input type="hidden" name="action" value="add">';
787 if (!empty($ldap_sid))
print '<input type="hidden" name="ldap_sid" value="'.dol_escape_htmltag($ldap_sid).
'">';
788 print '<input type="hidden" name="entity" value="'.$conf->entity.
'">';
794 print '<table class="border centpercent">';
797 print '<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td colspan="3">';
798 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') : $object->civility_code,
'civility_code');
803 print '<td class="titlefieldcreate"><span class="fieldrequired">'.$langs->trans(
"Lastname").
'</span></td>';
805 if (!empty($ldap_lastname))
807 print '<input type="hidden" id="lastname" name="lastname" value="'.dol_escape_htmltag($ldap_lastname).
'">';
808 print $ldap_lastname;
810 print '<input class="minwidth100" type="text" id="lastname" name="lastname" value="'.dol_escape_htmltag(
GETPOST(
'lastname',
'alphanohtml')).
'">';
815 print '<tr><td>'.$langs->trans(
"Firstname").
'</td>';
817 if (!empty($ldap_firstname))
819 print '<input type="hidden" name="firstname" value="'.dol_escape_htmltag($ldap_firstname).
'">';
820 print $ldap_firstname;
822 print '<input class="minwidth100" type="text" name="firstname" value="'.dol_escape_htmltag(
GETPOST(
'firstname',
'alphanohtml')).
'">';
827 print '<tr><td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
829 if (!empty($ldap_login))
831 print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_login).
'">';
833 } elseif (!empty($ldap_loginsmb))
835 print '<input type="hidden" name="login" value="'.dol_escape_htmltag($ldap_loginsmb).
'">';
836 print $ldap_loginsmb;
838 print '<input class="maxwidth200" maxsize="24" type="text" name="login" value="'.dol_escape_htmltag(
GETPOST(
'login',
'alphanohtml')).
'">';
842 $generated_password =
'';
843 if (empty($ldap_sid))
850 print '<tr><td class="fieldrequired">'.$langs->trans(
"Password").
'</td>';
853 if (preg_match(
'/ldap/', $dolibarr_main_authentication))
855 $valuetoshow .= ($valuetoshow ?
', ' :
'').$langs->trans(
"PasswordOfUserInLDAP");
857 if (preg_match(
'/http/', $dolibarr_main_authentication))
859 $valuetoshow .= ($valuetoshow ?
', ' :
'').$langs->trans(
"HTTPBasicPassword");
861 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication))
863 if (!empty($ldap_pass))
865 $valuetoshow .= ($valuetoshow ?
', ' :
'').
'<input type="hidden" name="password" value="'.$ldap_pass.
'">';
866 $valuetoshow .= preg_replace(
'/./i',
'*', $ldap_pass);
869 $valuetoshow .= ($valuetoshow ?
', ' :
'').
'<input size="30" maxsize="32" type="text" name="password" value="'.$password.
'" autocomplete="new-password">';
874 $parameters = array(
'valuetoshow' => $valuetoshow,
'password' => $password);
875 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
876 if ($reshook > 0) $valuetoshow = $hookmanager->resPrint;
877 else $valuetoshow .= $hookmanager->resPrint;
882 if (!empty($conf->api->enabled))
886 print '<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
888 print '<input size="30" maxsize="32" type="text" id="api_key" name="api_key" value="'.GETPOST(
'api_key',
'alphanohtml').
'" autocomplete="off">';
889 if (!empty($conf->use_javascript_ajax))
890 print ' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject"');
895 print '<input type="hidden" name="api_key" value="'.$generated_fake_api_key.
'">';
899 if (!empty($user->admin))
901 print '<tr><td>'.$langs->trans(
"Administrator").
'</td>';
905 if (!empty($conf->multicompany->enabled) && !$user->entity)
907 if (!empty($conf->use_javascript_ajax))
909 print '<script type="text/javascript">
911 $("select[name=admin]").change(function() {
912 if ( $(this).val() == 0 ) {
913 $("input[name=superadmin]")
914 .prop("disabled", true)
915 .prop("checked", false);
916 $("select[name=entity]")
917 .prop("disabled", false);
919 $("input[name=superadmin]")
920 .prop("disabled", false);
923 $("input[name=superadmin]").change(function() {
924 if ( $(this).is(":checked") ) {
925 $("select[name=entity]")
926 .prop("disabled", true);
928 $("select[name=entity]")
929 .prop("disabled", false);
935 $checked = (
GETPOST(
'superadmin',
'int') ?
' checked' :
'');
936 $disabled = (
GETPOST(
'superadmin',
'int') ?
'' :
' disabled');
937 print '<input type="checkbox" name="superadmin" value="1"'.$checked.$disabled.
' /> '.$langs->trans(
"SuperAdministrator");
939 print "</td></tr>\n";
943 print '<tr><td>'.$langs->trans(
"Gender").
'</td>';
945 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
946 print $form->selectarray(
'gender', $arraygender,
GETPOST(
'gender'), 1);
950 $defaultemployee = 1;
952 print '<td>'.$langs->trans(
'Employee').
'</td><td>';
953 print $form->selectyesno(
"employee", (
GETPOST(
'employee') !=
'' ?
GETPOST(
'employee') : $defaultemployee), 1);
957 print '<tr><td class="titlefieldcreate">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
959 print img_picto(
'',
'user').$form->select_dolusers($object->fk_user,
'fk_user', 1, array($object->id), 0,
'', 0, $conf->entity, 0, 0,
'', 0,
'',
'maxwidth300');
964 if (!empty($conf->expensereport->enabled))
966 print '<tr><td class="titlefieldcreate">';
967 $text = $langs->trans(
"ForceUserExpenseValidator");
968 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
971 print img_picto(
'',
'user').$form->select_dolusers($object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array($object->id), 0,
'', 0, $conf->entity, 0, 0,
'', 0,
'',
'maxwidth300');
977 if (!empty($conf->holiday->enabled))
979 print '<tr><td class="titlefieldcreate">';
980 $text = $langs->trans(
"ForceUserHolidayValidator");
981 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
984 print img_picto(
'',
'user').$form->select_dolusers($object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array($object->id), 0,
'', 0, $conf->entity, 0, 0,
'', 0,
'',
'maxwidth300');
990 print '<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
992 print $form->textwithpicto($langs->trans(
"Internal"), $langs->trans(
"InternalExternalDesc"), 1,
'help',
'', 0, 2);
995 print '</table><hr><table class="border centpercent">';
999 print '<tr><td class="tdtop titlefieldcreate">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
1000 print '<td><textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
1001 print $object->address;
1002 print '</textarea></td></tr>';
1005 print '<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
1006 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
1010 print '<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
1011 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
1015 print '<tr><td>'.$form->editfieldkey(
'Country',
'selectcountry_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1016 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id));
1017 if ($user->admin)
print info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
1021 if (empty($conf->global->USER_DISABLE_STATE))
1023 print
'<tr><td>'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td class="maxwidthonsmartphone">';
1024 print $formcompany->select_state($object->state_id, $object->country_code,
'state_id');
1029 print
'<tr><td>'.$langs->trans(
"PhonePro").
'</td>';
1032 if (!empty($ldap_phone))
1034 print
'<input type="hidden" name="office_phone" value="'.dol_escape_htmltag($ldap_phone).
'">';
1037 print
'<input type="text" name="office_phone" value="'.dol_escape_htmltag(
GETPOST(
'office_phone',
'alphanohtml')).
'">';
1042 print
'<tr><td>'.$langs->trans(
"PhoneMobile").
'</td>';
1044 print
img_picto(
'',
'object_phoning_mobile');
1045 if (!empty($ldap_mobile))
1047 print
'<input type="hidden" name="user_mobile" value="'.dol_escape_htmltag($ldap_mobile).
'">';
1050 print
'<input type="text" name="user_mobile" value="'.dol_escape_htmltag(
GETPOST(
'user_mobile',
'alphanohtml')).
'">';
1055 print
'<tr><td>'.$langs->trans(
"Fax").
'</td>';
1057 print
img_picto(
'',
'object_phoning_fax');
1058 if (!empty($ldap_fax))
1060 print
'<input type="hidden" name="office_fax" value="'.dol_escape_htmltag($ldap_fax).
'">';
1063 print
'<input type="text" name="office_fax" value="'.dol_escape_htmltag(
GETPOST(
'office_fax',
'alphanohtml')).
'">';
1068 print
'<tr><td'.(!empty($conf->global->USER_MAIL_REQUIRED) ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
1071 if (!empty($ldap_mail))
1073 print
'<input type="hidden" name="email" value="'.dol_escape_htmltag($ldap_mail).
'">';
1076 print
'<input type="text" name="email" class="maxwidth500 widthcentpercentminusx" value="'.dol_escape_htmltag(
GETPOST(
'email',
'alphanohtml')).
'">';
1080 if (!empty($conf->socialnetworks->enabled)) {
1081 foreach ($socialnetworks as $key => $value) {
1082 if ($value[
'active']) {
1083 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
1085 if (!empty($ldap_social[$key])) {
1086 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1087 print $ldap_social[$key];
1089 print
'<input class="maxwidth200" type="text" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1094 if (!empty($ldap_social[$key])) {
1095 print
'<input type="hidden" name="'.$key.
'" value="'.$ldap_social[$key].
'">';
1097 print
'<input type="hidden" name="'.$key.
'" value="'.
GETPOST($key,
'alphanohtml').
'">';
1104 if ($conf->accounting->enabled)
1106 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1108 print
'<input type="text" name="accountancy_code" value="'.dol_escape_htmltag(
GETPOST(
'accountancy_code',
'alphanohtml')).
'">';
1113 if (!empty($conf->agenda->enabled))
1115 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1117 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') : $object->color,
'color', null, 1,
'',
'hideifnotset');
1122 if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire))
1124 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td><td colspan="3">';
1125 $cate_arbo = $form->select_all_categories(
'user', null,
'parent', null, null, 1);
1126 print $form->multiselectarray(
'usercats', $cate_arbo,
GETPOST(
'usercats',
'array'), null, null, null, null,
'90%');
1130 if (!empty($conf->global->MAIN_MULTILANGS))
1132 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3" class="maxwidthonsmartphone">'.
"\n";
1133 print $formadmin->select_language(
GETPOST(
'default_lang',
'alpha') ?
GETPOST(
'default_lang',
'alpha') : ($object->lang ? $object->lang :
''),
'default_lang', 0, 0, 1, 0, 0,
'maxwidth200onsmartphone');
1139 if (!empty($conf->multicompany->enabled) && is_object($mc))
1142 if (!method_exists($mc,
'formObjectOptions'))
1144 if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
1146 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
1147 print
"<td>".$mc->select_entities($conf->entity);
1148 print
"</td></tr>\n";
1150 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1156 $parameters = array(
'colspan' =>
' colspan="3"');
1157 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_add.tpl.php';
1160 print
'<tr><td class="tdtop">';
1161 print $langs->trans(
"Note");
1163 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1164 $doleditor =
new DolEditor(
'note',
GETPOSTISSET(
'note') ?
GETPOST(
'note',
'restricthtml') :
'',
'', 120,
'dolibarr_notes',
'',
false,
true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_3,
'90%');
1165 $doleditor->Create();
1166 print
"</td></tr>\n";
1169 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
1171 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
1172 $doleditor =
new DolEditor(
'signature',
GETPOST(
'signature',
'restricthtml'),
'', 138,
'dolibarr_notes',
'In',
true,
true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4,
'90%');
1173 print $doleditor->Create(1);
1177 print
'</table><hr><table class="border centpercent">';
1183 if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER))
1185 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1186 print $formproduct->selectWarehouses($object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
1191 print
'<tr><td class="titlefieldcreate">'.$langs->trans(
"PostOrFunction").
'</td>';
1193 print
'<input class="maxwidth200" type="text" name="job" value="'.dol_escape_htmltag(
GETPOST(
'job',
'alphanohtml')).
'">';
1196 if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
1197 || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)))
1199 $langs->load(
"salaries");
1203 $text = $langs->trans(
"THM");
1204 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1207 print
'<input size="8" type="text" name="thm" value="'.dol_escape_htmltag(
GETPOST(
'thm')).
'">';
1213 $text = $langs->trans(
"TJM");
1214 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1217 print
'<input size="8" type="text" name="tjm" value="'.dol_escape_htmltag(
GETPOST(
'tjm')).
'">';
1222 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1224 print
'<input size="8" type="text" name="salary" value="'.dol_escape_htmltag(
GETPOST(
'salary')).
'">';
1230 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1232 print
'<input size="8" type="text" name="weeklyhours" value="'.dol_escape_htmltag(
GETPOST(
'weeklyhours')).
'">';
1237 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
1239 print $form->selectDate($dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1);
1243 print $form->selectDate($dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0);
1248 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1250 print $form->selectDate($datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 1);
1254 print $form->selectDate($dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0);
1259 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1261 print $form->selectDate($dateofbirth,
'dateofbirth', 0, 0, 1,
'createuser', 1, 0);
1269 print
'<div class="center">';
1270 print
'<input class="button" value="'.$langs->trans(
"CreateUser").
'" name="create" type="submit">';
1280 $object->fetch($id,
'',
'', 1);
1282 $res = $object->fetch_optionals();
1285 if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
1287 $object->getrights();
1288 if (empty($object->nb_rights) && $object->statut != 0 && empty($object->admin))
setEventMessages($langs->trans(
'UserHasNoPermissions'), null,
'warnings');
1293 if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid))
1296 $result = $ldap->connect_bind();
1299 $userSearchFilter =
'('.$conf->global->LDAP_FILTER_CONNECTION.
'('.$ldap->getUserIdentifier().
'='.$object->login.
'))';
1300 $entries = $ldap->fetch($object->login, $userSearchFilter);
1306 $passDoNotExpire = 0;
1307 $userChangePassNextLogon = 0;
1312 if (count($ldap->uacf) > 0)
1314 foreach ($ldap->uacf as $key => $statut)
1318 $passDoNotExpire = 1;
1319 $statutUACF = $statut;
1324 $statutUACF =
"ACCOUNTDISABLE";
1327 if ($ldap->pwdlastset == 0)
1329 $userChangePassNextLogon = 1;
1335 if ($mode ==
'employee')
1337 $title = $langs->trans(
"Employee");
1338 $linkback =
'<a href="'.DOL_URL_ROOT.
'/hrm/employee/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1340 $title = $langs->trans(
"User");
1343 if ($user->rights->user->user->lire || $user->admin) {
1344 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
1353 if ($action ==
'password')
1355 print $form->formconfirm(
$_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"ReinitPassword"), $langs->trans(
"ConfirmReinitPassword", $object->login),
"confirm_password",
'', 0, 1);
1361 if ($action ==
'passwordsend')
1363 print $form->formconfirm(
$_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"SendNewPassword"), $langs->trans(
"ConfirmSendNewPassword", $object->login),
"confirm_passwordsend",
'', 0, 1);
1369 if ($action ==
'disable')
1371 print $form->formconfirm(
$_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DisableAUser"), $langs->trans(
"ConfirmDisableUser", $object->login),
"confirm_disable",
'', 0, 1);
1377 if ($action ==
'enable')
1379 print $form->formconfirm(
$_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"EnableAUser"), $langs->trans(
"ConfirmEnableUser", $object->login),
"confirm_enable",
'', 0, 1);
1385 if ($action ==
'delete')
1387 print $form->formconfirm(
$_SERVER[
'PHP_SELF'].
"?id=$object->id", $langs->trans(
"DeleteAUser"), $langs->trans(
"ConfirmDeleteUser", $object->login),
"confirm_delete",
'', 0, 1);
1393 if ($action !=
'edit')
1397 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
1399 print
'<div class="fichecenter">';
1400 print
'<div class="fichehalfleft">';
1402 print
'<div class="underbanner clearboth"></div>';
1403 print
'<table class="border tableforfield" width="100%">';
1406 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
1407 if (!empty($object->ldap_sid) && $object->statut == 0)
1409 print
'<td class="error">'.$langs->trans(
"LoginAccountDisableInDolibarr").
'</td>';
1411 print
'<td>'.$object->login.
'</td>';
1416 print
'<tr><td>'.$langs->trans(
"Password").
'</td>';
1418 print
'<td class="wordbreak">';
1420 if (preg_match(
'/ldap/', $dolibarr_main_authentication))
1422 if (!empty($object->ldap_sid))
1424 if ($passDoNotExpire)
1426 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"LdapUacf_".$statutUACF);
1427 } elseif ($userChangePassNextLogon)
1429 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"UserMustChangePassNextLogon", $ldap->domainFQDN).
'</span>';
1430 } elseif ($userDisabled)
1432 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="warning">'.$langs->trans(
"LdapUacf_".$statutUACF, $ldap->domainFQDN).
'</span>';
1434 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1437 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
1440 if (preg_match(
'/http/', $dolibarr_main_authentication))
1442 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"HTTPBasicPassword");
1444 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication))
1446 if ($object->pass) {
1447 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'');
1448 $valuetoshow .=
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1450 if ($user->admin && $user->id == $object->id) {
1451 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'');
1453 $valuetoshow .=
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1455 $valuetoshow .=
'<!-- Crypted into '.$object->pass_indatabase_crypted.
' -->';
1457 else $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<span class="opacitymedium">'.$langs->trans(
"Hidden").
'</span>';
1462 $parameters = array(
'valuetoshow' => $valuetoshow);
1463 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
1464 if ($reshook > 0) $valuetoshow = $hookmanager->resPrint;
1465 else $valuetoshow .= $hookmanager->resPrint;
1472 if (!empty($conf->api->enabled) && $user->admin) {
1473 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
1475 if (!empty($object->api_key)) print
'<span class="opacitymedium">'.preg_replace(
'/./',
'*', $object->api_key).
'</span>';
1476 if ($user->admin || $user->id == $object->id) {
1483 print
'<tr><td>'.$langs->trans(
"Administrator").
'</td><td>';
1484 if (!empty($conf->multicompany->enabled) && $object->admin && !$object->entity)
1486 print $form->textwithpicto(
yn($object->admin), $langs->trans(
"SuperAdministratorDesc"), 1,
"superadmin");
1487 } elseif ($object->admin)
1489 print $form->textwithpicto(
yn($object->admin), $langs->trans(
"AdministratorDesc"), 1,
"admin");
1491 print
yn($object->admin);
1493 print
'</td></tr>'.
"\n";
1497 $text = $langs->trans(
"Type");
1498 print $form->textwithpicto($text, $langs->trans(
"InternalExternalDesc"));
1500 $type = $langs->trans(
"Internal");
1501 if ($object->socid > 0) $type = $langs->trans(
"External");
1503 if ($object->ldap_sid) print
' ('.$langs->trans(
"DomainUser").
')';
1504 print
'</td></tr>'.
"\n";
1507 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(
"Gender").
'</td>';
1517 if ($object->gender) print $langs->trans(
"Gender".$object->gender);
1521 print
'<tr><td>'.$langs->trans(
"Employee").
'</td><td colspan="2">';
1522 print
yn($object->employee);
1523 print
'</td></tr>'.
"\n";
1528 print
'<tr><td>'.$langs->trans(
"HierarchicalResponsible").
'</td>';
1530 if (empty($object->fk_user)) {
1531 print
'<span class="opacitymedium">'.$langs->trans(
"None").
'</span>';
1533 $huser =
new User($db);
1534 $huser->fetch($object->fk_user);
1535 print $huser->getNomUrl(1);
1541 if (!empty($conf->expensereport->enabled)) {
1543 $text = $langs->trans(
"ForceUserExpenseValidator");
1544 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1547 if (!empty($object->fk_user_expense_validator)) {
1548 $evuser =
new User($db);
1549 $evuser->fetch($object->fk_user_expense_validator);
1550 print $evuser->getNomUrl(1);
1557 if (!empty($conf->holiday->enabled)) {
1559 $text = $langs->trans(
"ForceUserHolidayValidator");
1560 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
1563 if (!empty($object->fk_user_holiday_validator)) {
1564 $hvuser =
new User($db);
1565 $hvuser->fetch($object->fk_user_holiday_validator);
1566 print $hvuser->getNomUrl(1);
1573 if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER))
1575 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
1576 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
1577 if ($object->fk_warehouse > 0) {
1578 $warehousestatic =
new Entrepot($db);
1579 $warehousestatic->fetch($object->fk_warehouse);
1580 print $warehousestatic->getNomUrl(1);
1586 print
'<tr><td>'.$langs->trans(
"PostOrFunction").
'</td>';
1587 print
'<td>'.dol_escape_htmltag($object->job).
'</td>';
1592 if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
1593 || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)))
1597 $langs->load(
"salaries");
1601 $text = $langs->trans(
"THM");
1602 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
1605 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1611 $text = $langs->trans(
"TJM");
1612 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classtjm');
1615 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1620 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
1622 print ($object->salary !=
'' ?
price($object->salary,
'', $langs, 1, -1, -1, $conf->currency) :
'');
1628 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
1635 print
'<tr><td>'.$langs->trans(
"DateOfEmployment").
'</td>';
1637 if ($object->dateemployment) {
1638 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1641 if ($object->dateemploymentend) {
1642 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1649 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
1651 if ($object->datestartvalidity) {
1652 print
'<span class="opacitymedium">'.$langs->trans(
"FromDate").
'</span> ';
1655 if ($object->dateendvalidity) {
1656 print
'<span class="opacitymedium"> - '.$langs->trans(
"To").
'</span> ';
1663 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
1670 if ($conf->accounting->enabled)
1672 print
'<tr><td>'.$langs->trans(
"AccountancyCode").
'</td>';
1673 print
'<td>'.$object->accountancy_code.
'</td></tr>';
1679 print
'<div class="fichehalfright"><div class="ficheaddleft">';
1681 print
'<div class="underbanner clearboth"></div>';
1682 print
'<table class="border tableforfield centpercent">';
1685 if (!empty($conf->agenda->enabled))
1687 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
1689 print $formother->showColor($object->color,
'');
1695 if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire))
1697 print
'<tr><td>'.$langs->trans(
"Categories").
'</td>';
1698 print
'<td colspan="3">';
1699 print $form->showCategories($object->id, Categorie::TYPE_USER, 1);
1704 if (!empty($conf->global->MAIN_MULTILANGS))
1706 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
1707 print
'<tr><td>'.$langs->trans(
"DefaultLang").
'</td><td>';
1710 $langs->load(
"languages");
1711 $labellang = ($object->lang ? $langs->trans(
'Language_'.$object->lang) :
'');
1712 print $form->textwithpicto($labellang, $langs->trans(
"WarningNotLangOfInterface", $langs->transnoentitiesnoconv(
"UserGUISetup")));
1716 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER))
1718 print
'<tr><td>'.$langs->trans(
"OpenIDURL").
'</td>';
1719 print
'<td>'.$object->openid.
'</td>';
1723 print
'<tr><td class="titlefield">'.$langs->trans(
"LastConnexion").
'</td>';
1724 print
'<td>'.dol_print_date($object->datelastlogin,
"dayhour").
'</td>';
1727 print
'<tr><td>'.$langs->trans(
"PreviousConnexion").
'</td>';
1728 print
'<td>'.dol_print_date($object->datepreviouslogin,
"dayhour").
'</td>';
1732 if (!empty($conf->multicompany->enabled) && is_object($mc))
1735 if (!method_exists($mc,
'formObjectOptions'))
1737 if (!empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity)
1739 print
'<tr><td>'.$langs->trans(
"Entity").
'</td><td>';
1740 if (empty($object->entity)) {
1741 print $langs->trans(
"AllEntities");
1743 $mc->getInfo($object->entity);
1746 print
"</td></tr>\n";
1752 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_view.tpl.php';
1755 if (!empty($conf->societe->enabled))
1757 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
1760 if (isset($object->socid) && $object->socid > 0)
1763 $societe->fetch($object->socid);
1764 if ($societe->id > 0) {
1765 $s .= $societe->getNomUrl(1,
'');
1768 $s .=
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
1770 if (!empty($object->contact_id))
1773 $contact->fetch($object->contact_id);
1774 if ($contact->id > 0) {
1775 if ($object->socid > 0 && $s) $s .=
' / ';
1777 $s .= $contact->getNomUrl(1,
'');
1786 if (!empty($conf->adherent->enabled))
1788 $langs->load(
"members");
1789 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
1791 if ($object->fk_member)
1794 $adh->fetch($object->fk_member);
1795 $adh->ref = $adh->getFullname($langs);
1796 print $adh->getNomUrl(-1);
1798 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
1805 print
'<tr><td class="tdtop">'.$langs->trans(
'Signature').
'</td><td>';
1807 print
"</td></tr>\n";
1810 print
'<tr><td class="tdtop">'.$langs->trans(
"VCard").
'</td>';
1812 print
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'">';
1813 print
img_picto($langs->trans(
"Download"),
'vcard.png',
'class="paddingrightonly"');
1814 print $langs->trans(
"Download");
1816 print
"</td></tr>\n";
1821 print
'</div></div>';
1822 print
'<div style="clear:both"></div>';
1832 print
'<div class="tabsAction">';
1834 $parameters = array();
1835 $reshook = $hookmanager->executeHooks(
'addMoreActionsButtons', $parameters, $object, $action);
1836 if (empty($reshook))
1838 if (empty($user->socid)) {
1839 if (!empty($object->email))
1841 $langs->load(
"mails");
1842 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans(
'SendMail').
'</a></div>';
1844 $langs->load(
"mails");
1845 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoEMail")).
'">'.$langs->trans(
'SendMail').
'</a></div>';
1849 if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1851 if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
1852 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"DisabledInMonoUserMode")).
'">'.$langs->trans(
"Modify").
'</a></div>';
1854 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit">'.$langs->trans(
"Modify").
'</a></div>';
1856 } elseif ($caneditpassword && !$object->ldap_sid &&
1857 (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1859 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit">'.$langs->trans(
"EditPassword").
'</a></div>';
1863 if ($conf->global->USER_PASSWORD_GENERATED !=
'none')
1865 if ($object->statut == 0)
1867 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"UserDisabled")).
'">'.$langs->trans(
"ReinitPassword").
'</a></div>';
1868 } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
1869 ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1871 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=password">'.$langs->trans(
"ReinitPassword").
'</a></div>';
1874 if ($object->statut == 0)
1876 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"UserDisabled")).
'">'.$langs->trans(
"SendNewPassword").
'</a></div>';
1877 } elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
1878 ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1880 if ($object->email) print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=passwordsend">'.$langs->trans(
"SendNewPassword").
'</a></div>';
1881 else print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"NoEMail")).
'">'.$langs->trans(
"SendNewPassword").
'</a></div>';
1886 if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
1887 ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1889 print
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=enable">'.$langs->trans(
"Reactivate").
'</a></div>';
1892 if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
1893 ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1895 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
'PHP_SELF'].
'?action=disable&id='.$object->id.
'">'.$langs->trans(
"DisableUser").
'</a></div>';
1897 if ($user->id == $id)
1899 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans(
"CantDisableYourself").
'">'.$langs->trans(
"DisableUser").
'</a></div>';
1903 if ($user->id <> $id && $candisableuser &&
1904 ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
1906 if ($user->admin || !$object->admin)
1908 print
'<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER[
'PHP_SELF'].
'?action=delete&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"DeleteUser").
'</a></div>';
1910 print
'<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans(
"MustBeAdminToDeleteOtherAdmin")).
'">'.$langs->trans(
"DeleteUser").
'</a></div>';
1920 if (
GETPOST(
'modelselected')) $action =
'presend';
1923 $modelmail =
'user';
1924 $defaulttopic =
'Information';
1925 $diroutput = $conf->user->dir_output;
1926 $trackid =
'use'.$object->id;
1928 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
1930 if ($action !=
'presend' && $action !=
'send')
1938 print
'<!-- Group section -->'.
"\n";
1946 $groupslist = $usergroup->listGroupsForUser($object->id);
1948 if (!empty($groupslist))
1950 foreach ($groupslist as $groupforuser)
1952 $exclude[] = $groupforuser->id;
1957 $parameters = array(
'caneditgroup' => $caneditgroup,
'groupslist' => $groupslist,
'exclude' => $exclude);
1958 $reshook = $hookmanager->executeHooks(
'formAddUserToGroup', $parameters, $object, $action);
1959 print $hookmanager->resPrint;
1961 if (empty($reshook))
1965 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$id.
'" method="POST">'.
"\n";
1966 print
'<input type="hidden" name="token" value="'.newToken().
'" />';
1967 print
'<input type="hidden" name="action" value="addgroup" />';
1970 print
'<table class="noborder centpercent">'.
"\n";
1971 print
'<tr class="liste_titre"><th class="liste_titre">'.$langs->trans(
"Groups").
'</th>'.
"\n";
1972 print
'<th class="liste_titre right">';
1975 print $form->select_dolgroups(
'',
'group', 1, $exclude, 0,
'',
'', $object->entity);
1977 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
1978 print
'<input type="submit" class="button buttongen" value="'.$langs->trans(
"Add").
'" />';
1980 print
'</th></tr>'.
"\n";
1983 if (!empty($groupslist))
1985 foreach ($groupslist as $group)
1987 print
'<tr class="oddeven">';
1991 print $group->getNomUrl(1);
1993 print
img_object($langs->trans(
"ShowGroup"),
"group").
' '.$group->name;
1996 print
'<td class="right">';
1999 print
'<a href="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=removegroup&group='.$group->id.
'">';
2000 print
img_picto($langs->trans(
"RemoveFromGroup"),
'unlink');
2005 print
"</td></tr>\n";
2008 print
'<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans(
"None").
'</td></tr>';
2026 if ($action ==
'edit' && ($canedituser || $caneditfield || $caneditpassword || ($user->id == $object->id)))
2028 print
'<form action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'" method="POST" name="updateuser" enctype="multipart/form-data">';
2029 print
'<input type="hidden" name="token" value="'.newToken().
'">';
2030 print
'<input type="hidden" name="action" value="update">';
2031 print
'<input type="hidden" name="entity" value="'.$object->entity.
'">';
2035 print
'<table class="border centpercent">';
2038 if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))
2040 print
'<tr><td class="titlefield">'.$langs->trans(
"Ref").
'</td>';
2048 print
'<tr><td><label for="civility_code">'.$langs->trans(
"UserTitle").
'</label></td><td colspan="3">';
2049 print $formcompany->select_civility(
GETPOSTISSET(
"civility_code") ?
GETPOST(
"civility_code",
'aZ09') : $object->civility_code,
'civility_code');
2054 print
'<td class="titlefield fieldrequired">'.$langs->trans(
"Lastname").
'</td>';
2056 if ($caneditfield && !$object->ldap_sid)
2058 print
'<input class="minwidth100" type="text" class="flat" name="lastname" value="'.$object->lastname.
'">';
2060 print
'<input type="hidden" name="lastname" value="'.$object->lastname.
'">';
2061 print $object->lastname;
2067 print
"<tr>".
'<td>'.$langs->trans(
"Firstname").
'</td>';
2069 if ($caneditfield && !$object->ldap_sid)
2071 print
'<input class="minwidth100" type="text" class="flat" name="firstname" value="'.$object->firstname.
'">';
2073 print
'<input type="hidden" name="firstname" value="'.$object->firstname.
'">';
2074 print $object->firstname;
2079 print
"<tr>".
'<td><span class="fieldrequired">'.$langs->trans(
"Login").
'</span></td>';
2081 if ($user->admin && !$object->ldap_sid)
2083 print
'<input maxlength="50" type="text" class="flat" name="login" value="'.$object->login.
'">';
2085 print
'<input type="hidden" name="login" value="'.$object->login.
'">';
2086 print $object->login;
2092 print
'<tr><td>'.$langs->trans(
"Password").
'</td>';
2095 if (preg_match(
'/ldap/', $dolibarr_main_authentication))
2097 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$langs->trans(
"PasswordOfUserInLDAP");
2099 if (preg_match(
'/http/', $dolibarr_main_authentication))
2101 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').$form->textwithpicto($text, $langs->trans(
"DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1,
'warning');
2103 if (preg_match(
'/dolibarr/', $dolibarr_main_authentication))
2105 if ($caneditpassword)
2107 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').
'<input maxlength="32" type="password" class="flat" name="password" value="'.$object->pass.
'" autocomplete="new-password">';
2109 $valuetoshow .= ($valuetoshow ? (
' '.$langs->trans(
"or").
' ') :
'').preg_replace(
'/./i',
'*', $object->pass);
2114 $parameters = array(
'valuetoshow' => $valuetoshow,
'caneditpassword' => $caneditpassword);
2115 $reshook = $hookmanager->executeHooks(
'printUserPasswordField', $parameters, $object, $action);
2116 if ($reshook > 0) $valuetoshow = $hookmanager->resPrint;
2117 else $valuetoshow .= $hookmanager->resPrint;
2120 print
"</td></tr>\n";
2123 if (!empty($conf->api->enabled) && $user->admin)
2125 print
'<tr><td>'.$langs->trans(
"ApiKey").
'</td>';
2127 print
'<input class="minwidth300" maxsize="32" type="text" id="api_key" name="api_key" value="'.$object->api_key.
'" autocomplete="off">';
2128 if (!empty($conf->use_javascript_ajax))
2129 print
' '.img_picto($langs->trans(
'Generate'),
'refresh',
'id="generate_api_key" class="linkobject"');
2134 print
'<tr><td>'.$langs->trans(
"Administrator").
'</td>';
2135 if ($object->socid > 0)
2137 $langs->load(
"admin");
2139 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">'.
yn($object->admin);
2140 print
' ('.$langs->trans(
"ExternalUser").
')';
2144 $nbAdmin = $user->getNbOfUsers(
'active',
'', 1);
2145 $nbSuperAdmin = $user->getNbOfUsers(
'active',
'superadmin', 1);
2149 && ($user->id != $object->id)
2151 (empty($conf->multicompany->enabled) && $nbAdmin >= 1)
2152 || (!empty($conf->multicompany->enabled) && (($object->entity > 0 || ($user->entity == 0 && $object->entity == 0)) || $nbSuperAdmin > 1))
2156 print $form->selectyesno(
'admin', $object->admin, 1);
2158 if (!empty($conf->multicompany->enabled) && !$user->entity)
2160 if ($conf->use_javascript_ajax)
2162 print
'<script type="text/javascript">
2164 var admin = $("select[name=admin]").val();
2166 $("input[name=superadmin]")
2167 .prop("disabled", true)
2168 .prop("checked", false);
2170 if ($("input[name=superadmin]").is(":checked")) {
2171 $("select[name=entity]")
2172 .prop("disabled", true);
2174 $("select[name=admin]").change(function() {
2175 if ( $(this).val() == 0 ) {
2176 $("input[name=superadmin]")
2177 .prop("disabled", true)
2178 .prop("checked", false);
2179 $("select[name=entity]")
2180 .prop("disabled", false);
2182 $("input[name=superadmin]")
2183 .prop("disabled", false);
2186 $("input[name=superadmin]").change(function() {
2187 if ( $(this).is(":checked")) {
2188 $("select[name=entity]")
2189 .prop("disabled", true);
2191 $("select[name=entity]")
2192 .prop("disabled", false);
2199 $checked = (($object->admin && !$object->entity) ?
' checked' :
'');
2200 print
'<input type="checkbox" name="superadmin" value="1"'.$checked.
' /> '.$langs->trans(
"SuperAdministrator");
2203 $yn =
yn($object->admin);
2204 print
'<input type="hidden" name="admin" value="'.$object->admin.
'">';
2205 print
'<input type="hidden" name="superadmin" value="'.(empty($object->entity) ? 1 : 0).
'">';
2206 if (!empty($conf->multicompany->enabled) && empty($object->entity)) print $form->textwithpicto($yn, $langs->trans(
"DontDowngradeSuperAdmin"), 1,
'warning');
2213 print
'<tr><td>'.$langs->trans(
"Gender").
'</td>';
2215 $arraygender = array(
'man'=>$langs->trans(
"Genderman"),
'woman'=>$langs->trans(
"Genderwoman"),
'other'=>$langs->trans(
"Genderother"));
2216 if ($caneditfield) {
2217 print $form->selectarray(
'gender', $arraygender,
GETPOSTISSET(
'gender') ?
GETPOST(
'gender') : $object->gender, 1);
2219 print $arraygender[$object->gender];
2225 print
'<td>'.$form->editfieldkey(
'Employee',
'employee',
'', $object, 0).
'</td><td>';
2226 if ($caneditfield) {
2227 print $form->selectyesno(
"employee", $object->employee, 1);
2229 if ($object->employee) {
2230 print $langs->trans(
"Yes");
2232 print $langs->trans(
"No");
2238 print
'<tr><td class="titlefield">'.$langs->trans(
"HierarchicalResponsible").
'</td>';
2242 print $form->select_dolusers($object->fk_user,
'fk_user', 1, array($object->id), 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'maxwidth300');
2244 print
'<input type="hidden" name="fk_user" value="'.$object->fk_user.
'">';
2245 $huser =
new User($db);
2246 $huser->fetch($object->fk_user);
2247 print $huser->getNomUrl(1);
2253 if (!empty($conf->expensereport->enabled)) {
2254 print
'<tr><td class="titlefield">';
2255 $text = $langs->trans(
"ForceUserExpenseValidator");
2256 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2261 print $form->select_dolusers($object->fk_user_expense_validator,
'fk_user_expense_validator', 1, array($object->id), 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'maxwidth300');
2263 print
'<input type="hidden" name="fk_user_expense_validator" value="'.$object->fk_user_expense_validator.
'">';
2264 $evuser =
new User($db);
2265 $evuser->fetch($object->fk_user_expense_validator);
2266 print $evuser->getNomUrl(1);
2273 if (!empty($conf->holiday->enabled)) {
2274 print
'<tr><td class="titlefield">';
2275 $text = $langs->trans(
"ForceUserHolidayValidator");
2276 print $form->textwithpicto($text, $langs->trans(
"ValidatorIsSupervisorByDefault"), 1,
'help');
2281 print $form->select_dolusers($object->fk_user_holiday_validator,
'fk_user_holiday_validator', 1, array($object->id), 0,
'', 0, $object->entity, 0, 0,
'', 0,
'',
'maxwidth300');
2283 print
'<input type="hidden" name="fk_user_holiday_validator" value="'.$object->fk_user_holiday_validator.
'">';
2284 $hvuser =
new User($db);
2285 $hvuser->fetch($object->fk_user_holiday_validator);
2286 print $hvuser->getNomUrl(1);
2293 print
'<tr><td>'.$langs->trans(
"ExternalUser").
' ?</td>';
2295 if ($user->id == $object->id || !$user->admin)
2298 $type = $langs->trans(
"Internal");
2299 if ($object->socid) $type = $langs->trans(
"External");
2300 print $form->textwithpicto($type, $langs->trans(
"InternalExternalDesc"));
2301 if ($object->ldap_sid) print
' ('.$langs->trans(
"DomainUser").
')';
2305 if ($object->contact_id) $type = $object->contact_id;
2307 if ($object->socid > 0 && !($object->contact_id > 0)) {
2308 print
img_picto(
'',
'company').$form->select_company($object->socid,
'socid',
'',
' ');
2309 print
img_picto(
'',
'contact').$form->selectcontacts(0, 0,
'contactid', 1,
'',
'', 1,
'',
false, 1);
2310 if ($object->ldap_sid) print
' ('.$langs->trans(
"DomainUser").
')';
2311 } elseif ($object->socid > 0 && $object->contact_id > 0) {
2312 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ');
2313 print
img_picto(
'',
'contact').$form->selectcontacts(0, $object->contact_id,
'contactid', 1,
'',
'', 1,
'',
false, 1);
2314 if ($object->ldap_sid) print
' ('.$langs->trans(
"DomainUser").
')';
2316 print
img_picto(
'',
'company').$form->select_company(0,
'socid',
'',
' ');
2317 print
img_picto(
'',
'contact').$form->selectcontacts(0, 0,
'contactid', 1,
'',
'', 1,
'',
false, 1);
2322 print
'</table><hr><table class="border centpercent">';
2326 print
'<tr><td class="tdtop titlefield">'.$form->editfieldkey(
'Address',
'address',
'', $object, 0).
'</td>';
2328 if ($caneditfield) print
'<textarea name="address" id="address" class="quatrevingtpercent" rows="3" wrap="soft">';
2329 print $object->address;
2330 if ($caneditfield) print
'</textarea>';
2334 print
'<tr><td>'.$form->editfieldkey(
'Zip',
'zipcode',
'', $object, 0).
'</td><td>';
2335 if ($caneditfield) {
2336 print $formcompany->select_ziptown($object->zip,
'zipcode', array(
'town',
'selectcountry_id',
'state_id'), 6);
2343 print
'<tr><td>'.$form->editfieldkey(
'Town',
'town',
'', $object, 0).
'</td><td>';
2344 if ($caneditfield) {
2345 print $formcompany->select_ziptown($object->town,
'town', array(
'zipcode',
'selectcountry_id',
'state_id'));
2347 print $object->town;
2352 print
'<tr><td>'.$form->editfieldkey(
'Country',
'selectcounty_id',
'', $object, 0).
'</td><td>';
2353 if ($caneditfield) {
2354 print $form->select_country((
GETPOST(
'country_id') !=
'' ?
GETPOST(
'country_id') : $object->country_id),
'country_id');
2355 if ($user->admin) print
info_admin($langs->trans(
"YouCanChangeValuesForThisListFromDictionarySetup"), 1);
2357 $countrylabel =
getCountry($object->country_id,
'0');
2358 print $countrylabel;
2363 if (empty($conf->global->USER_DISABLE_STATE))
2365 print
'<tr><td class="tdoverflow">'.$form->editfieldkey(
'State',
'state_id',
'', $object, 0).
'</td><td>';
2366 if ($caneditfield) {
2367 print $formcompany->select_state($object->state_id, $object->country_code,
'state_id');
2369 print $object->state_label;
2375 print
"<tr>".
'<td>'.$langs->trans(
"PhonePro").
'</td>';
2378 if ($caneditfield && empty($object->ldap_sid))
2380 print
'<input type="text" name="office_phone" class="flat maxwidth200" value="'.$object->office_phone.
'">';
2382 print
'<input type="hidden" name="office_phone" value="'.$object->office_phone.
'">';
2383 print $object->office_phone;
2388 print
"<tr>".
'<td>'.$langs->trans(
"PhoneMobile").
'</td>';
2390 print
img_picto(
'',
'object_phoning_mobile');
2391 if ($caneditfield && empty($object->ldap_sid))
2393 print
'<input type="text" name="user_mobile" class="flat maxwidth200" value="'.$object->user_mobile.
'">';
2395 print
'<input type="hidden" name="user_mobile" value="'.$object->user_mobile.
'">';
2396 print $object->user_mobile;
2401 print
"<tr>".
'<td>'.$langs->trans(
"Fax").
'</td>';
2403 print
img_picto(
'',
'object_phoning_fax');
2404 if ($caneditfield && empty($object->ldap_sid))
2406 print
'<input type="text" name="office_fax" class="flat maxwidth200" value="'.$object->office_fax.
'">';
2408 print
'<input type="hidden" name="office_fax" value="'.$object->office_fax.
'">';
2409 print $object->office_fax;
2414 print
"<tr>".
'<td'.(!empty($conf->global->USER_MAIL_REQUIRED) ?
' class="fieldrequired"' :
'').
'>'.$langs->trans(
"EMail").
'</td>';
2417 if ($caneditfield && empty($object->ldap_sid))
2419 print
'<input class="minwidth100 maxwidth500 widthcentpercentminusx" type="text" name="email" class="flat" value="'.$object->email.
'">';
2421 print
'<input type="hidden" name="email" value="'.$object->email.
'">';
2422 print $object->email;
2426 if (!empty($conf->socialnetworks->enabled)) {
2427 foreach ($socialnetworks as $key => $value) {
2428 if ($value[
'active']) {
2429 print
'<tr><td>'.$langs->trans($value[
'label']).
'</td>';
2431 if ($caneditfield && empty($object->ldap_sid)) {
2432 print
'<input size="40" type="text" name="'.$key.
'" class="flat" value="'.$object->socialnetworks[$key].
'">';
2434 print
'<input type="hidden" name="'.$key.
'" value="'.$object->socialnetworks[$key].
'">';
2435 print $object->socialnetworks[$key];
2440 print
'<input type="hidden" name="'.$key.
'" value="'.$object->socialnetworks[$key].
'">';
2446 if (isset($conf->file->main_authentication) && preg_match(
'/openid/', $conf->file->main_authentication) && !empty($conf->global->MAIN_OPENIDURL_PERUSER))
2448 print
"<tr>".
'<td>'.$langs->trans(
"OpenIDURL").
'</td>';
2452 print
'<input class="minwidth100" type="url" name="openid" class="flat" value="'.$object->openid.
'">';
2454 print
'<input type="hidden" name="openid" value="'.$object->openid.
'">';
2455 print $object->openid;
2460 print
'</table><hr><table class="border centpercent">';
2463 if ($conf->accounting->enabled)
2466 print
'<td class="titlefield">'.$langs->trans(
"AccountancyCode").
'</td>';
2470 print
'<input size="30" type="text" class="flat" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2472 print
'<input type="hidden" name="accountancy_code" value="'.$object->accountancy_code.
'">';
2473 print $object->accountancy_code;
2480 if (!empty($conf->agenda->enabled))
2482 print
'<tr><td>'.$langs->trans(
"ColorUser").
'</td>';
2486 print $formother->selectColor(
GETPOSTISSET(
'color') ?
GETPOST(
'color',
'alphanohtml') : $object->color,
'color', null, 1,
'',
'hideifnotset');
2488 print $formother->showColor($object->color,
'');
2495 print
'<td>'.$langs->trans(
"Photo").
'</td>';
2497 print $form->showphoto(
'userphoto', $object, 60, 0, $caneditfield,
'photowithmargin',
'small', 1, 0,
'user', 1);
2502 if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire))
2504 print
'<tr><td>'.$form->editfieldkey(
'Categories',
'usercats',
'', $object, 0).
'</td>';
2506 $cate_arbo = $form->select_all_categories(Categorie::TYPE_USER, null, null, null, null, 1);
2508 $cats = $c->containing($object->id, Categorie::TYPE_USER);
2509 foreach ($cats as $cat) {
2510 $arrayselected[] = $cat->id;
2514 print $form->multiselectarray(
'usercats', $cate_arbo, $arrayselected,
'', 0,
'', 0,
'90%');
2516 print $form->showCategories($object->id, Categorie::TYPE_USER, 1);
2522 if (!empty($conf->global->MAIN_MULTILANGS))
2524 print
'<tr><td>'.$form->editfieldkey(
'DefaultLang',
'default_lang',
'', $object, 0).
'</td><td colspan="3">'.
"\n";
2525 print $formadmin->select_language($object->lang,
'default_lang', 0, 0, 1);
2531 print
'<tr><td>'.$langs->trans(
"Status").
'</td>';
2533 print $object->getLibStatut(4);
2537 if (!empty($conf->societe->enabled))
2539 print
'<tr><td>'.$langs->trans(
"LinkToCompanyContact").
'</td>';
2541 if ($object->socid > 0)
2544 $societe->fetch($object->socid);
2545 print $societe->getNomUrl(1,
'');
2546 if ($object->contact_id)
2549 $contact->fetch($object->contact_id);
2550 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>';
2553 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"ThisUserIsNot").
'</span>';
2555 print
' <span class="opacitymedium hideonsmartphone">('.$langs->trans(
"UseTypeFieldToChange").
')</span>';
2561 if (!empty($conf->adherent->enabled))
2563 $langs->load(
"members");
2564 print
'<tr><td>'.$langs->trans(
"LinkedToDolibarrMember").
'</td>';
2566 if ($object->fk_member)
2569 $adh->fetch($object->fk_member);
2570 $adh->ref = $adh->login;
2571 print $adh->getNomUrl(1);
2573 print
'<span class="opacitymedium hideonsmartphone">'.$langs->trans(
"UserNotLinkedToMember").
'</span>';
2581 if (!empty($conf->multicompany->enabled) && is_object($mc))
2584 if (!method_exists($mc,
'formObjectOptions'))
2586 if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && !$user->entity)
2588 print
"<tr>".
'<td>'.$langs->trans(
"Entity").
'</td>';
2589 print
"<td>".$mc->select_entities($object->entity,
'entity',
'', 0, 1,
false,
false, 1);
2590 print
"</td></tr>\n";
2592 print
'<input type="hidden" name="entity" value="'.$conf->entity.
'" />';
2598 $parameters = array(
'colspan' =>
' colspan="2"');
2600 $reshook = $hookmanager->executeHooks(
'formObjectOptions', $parameters, $object, $action);
2601 print $hookmanager->resPrint;
2602 if (empty($reshook))
2604 if ($caneditfield) {
2605 print $object->showOptionals($extrafields,
'edit');
2607 print $object->showOptionals($extrafields,
'view');
2612 print
'<tr><td class="tdtop">'.$langs->trans(
"Signature").
'</td>';
2616 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
2617 $doleditor =
new DolEditor(
'signature', $object->signature,
'', 138,
'dolibarr_notes',
'In',
false,
true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4,
'90%');
2618 print $doleditor->Create(1);
2625 print
'</table><hr><table class="border centpercent">';
2631 if (!empty($conf->stock->enabled) && !empty($conf->global->MAIN_DEFAULT_WAREHOUSE_USER))
2633 print
'<tr><td>'.$langs->trans(
"DefaultWarehouse").
'</td><td>';
2634 print $formproduct->selectWarehouses($object->fk_warehouse,
'fk_warehouse',
'warehouseopen', 1);
2635 print
' <a href="'.DOL_URL_ROOT.
'/product/stock/card.php?action=create&backtopage='.urlencode(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'&action=edit').
'"><span class="fa fa-plus-circle valignmiddle paddingleft" title="'.$langs->trans(
"AddWarehouse").
'"></span></a>';
2640 print
'<tr><td class="titlefield">'.$langs->trans(
"PostOrFunction").
'</td>';
2644 print
'<input size="30" type="text" name="job" value="'.dol_escape_htmltag($object->job).
'">';
2646 print
'<input type="hidden" name="job" value="'.dol_escape_htmltag($object->job).
'">';
2651 if ((!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read))
2652 || (!empty($conf->hrm->enabled) && !empty($user->rights->hrm->employee->read)))
2654 $langs->load(
"salaries");
2658 $text = $langs->trans(
"THM");
2659 print $form->textwithpicto($text, $langs->trans(
"THMDescription"), 1,
'help',
'classthm');
2662 if ($caneditfield) {
2663 print
'<input size="8" type="text" name="thm" value="'.price2num(
GETPOST(
'thm') ?
GETPOST(
'thm') : $object->thm).
'">';
2665 print ($object->thm !=
'' ?
price($object->thm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
2672 $text = $langs->trans(
"TJM");
2673 print $form->textwithpicto($text, $langs->trans(
"TJMDescription"), 1,
'help',
'classthm');
2678 print
'<input size="8" type="text" name="tjm" value="'.price2num(
GETPOST(
'tjm') ?
GETPOST(
'tjm') : $object->tjm).
'">';
2680 print ($object->tjm !=
'' ?
price($object->tjm,
'', $langs, 1, -1, -1, $conf->currency) :
'');
2686 print
'<tr><td>'.$langs->trans(
"Salary").
'</td>';
2688 print
'<input size="8" type="text" name="salary" value="'.price2num(
GETPOST(
'salary') ?
GETPOST(
'salary') : $object->salary).
'">';
2694 print
'<tr><td>'.$langs->trans(
"WeeklyHours").
'</td>';
2698 print
'<input size="8" type="text" name="weeklyhours" value="'.price2num(
GETPOST(
'weeklyhours') ?
GETPOST(
'weeklyhours') : $object->weeklyhours).
'">';
2706 print
'<tr><td>'.$langs->trans(
"DateEmployment").
'</td>';
2710 print $form->selectDate($dateemployment ? $dateemployment : $object->dateemployment,
'dateemployment', 0, 0, 1,
'formdateemployment', 1, 1);
2715 if ($dateemployment && $dateemploymentend) print
' - ';
2719 print $form->selectDate($dateemploymentend ? $dateemploymentend : $object->dateemploymentend,
'dateemploymentend', 0, 0, 1,
'formdateemploymentend', 1, 0);
2728 print
'<tr><td>'.$langs->trans(
"RangeOfLoginValidity").
'</td>';
2732 print $form->selectDate($datestartvalidity ? $datestartvalidity : $object->datestartvalidity,
'datestartvalidity', 0, 0, 1,
'formdatestartvalidity', 1, 1);
2737 if ($datestartvalidity && $dateendvalidity) print
' - ';
2741 print $form->selectDate($dateendvalidity ? $datendevalidity : $object->dateendvalidity,
'dateendvalidity', 0, 0, 1,
'formdateendvalidity', 1, 0);
2750 print
'<tr><td>'.$langs->trans(
"DateOfBirth").
'</td>';
2752 if ($caneditfield) {
2753 echo $form->selectDate($dateofbirth ? $dateofbirth : $object->birth,
'dateofbirth', 0, 0, 1,
'updateuser', 1, 0);
2764 print
'<div class="center">';
2765 print
'<input value="'.$langs->trans(
"Save").
'" class="button button-save" type="submit" name="save">';
2766 print
' ';
2767 print
'<input value="'.$langs->trans(
"Cancel").
'" class="button button-cancel" type="submit" name="cancel">';
2773 if ($action !=
'edit' && $action !=
'presend')
2775 print
'<div class="fichecenter"><div class="fichehalfleft">';
2781 $urlsource =
$_SERVER[
"PHP_SELF"].
"?id=".$object->id;
2782 $genallowed = $user->rights->user->user->lire;
2783 $delallowed = $user->rights->user->user->creer;
2785 print $formfile->showdocuments(
'user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0,
'', 0,
'', $soc->default_lang);
2786 $somethingshown = $formfile->numoffiles;
2789 $linktoelem = $form->showLinkToObjectBlock($object, null, null);
2790 $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
2792 print
'</div><div class="fichehalfright"><div class="ficheaddleft">';
2795 include_once DOL_DOCUMENT_ROOT.
'/core/class/html.formactions.class.php';
2797 $somethingshown =
$formactions->showactions($object,
'user', $socid, 1);
2800 print
'</div></div></div>';
2803 if (!empty($conf->ldap->enabled) && !empty($object->ldap_sid)) $ldap->close();
2807 if (!empty($conf->api->enabled) && !empty($conf->use_javascript_ajax))
2809 print
"\n".
'<script type="text/javascript">';
2810 print
'$(document).ready(function () {
2811 $("#generate_api_key").click(function() {
2812 $.get( "'.DOL_URL_ROOT.
'/core/ajax/security.php", {
2813 action: \'getrandompassword\',
2817 $("#api_key").val(token);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
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.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
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...
user_prepare_head($object)
Prepare array with list of tabs.
getArrayOfSocialNetworks()
Get array of social network dictionary.
Class to manage Dolibarr users.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete= 'resolve')
Convert a html select field into an ajax combobox.
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...
Class to manage user groups.
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage categories.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
price2num($amount, $rounding= '', $option=0)
Function that return a number with universal decimal format (decimal separator is '...
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_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart= '')
Return a path to have a the directory according to object where files are stored. ...
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories) ...
Class to manage members of a foundation.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
getRandomPassword($generic=false, $replaceambiguouschars=null, $length=32)
Return a generated password using default module.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=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 Calling this function terminate execution ...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
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.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
Class to manage LDAP features.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
Class to manage a WYSIWYG editor.
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.
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)
Class to manage warehouses.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...