26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
32 $langs->loadLangs(array(
'companies',
'products',
'admin',
'users',
'languages',
'projects',
'members'));
35 $canreaduser = ($user->admin || $user->rights->user->user->lire);
38 $action =
GETPOST(
'action',
'aZ09');
39 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userihm';
43 $caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
44 || (($user->id != $id) && $user->rights->user->user->creer));
49 if ($user->socid > 0) {
50 $socid = $user->socid;
52 $feature2 = (($socid && $user->rights->user->self->creer) ?
'' :
'user');
54 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
55 if ($user->id <> $id && !$canreaduser) {
59 $dirtop =
"../core/menus/standard";
60 $dirleft =
"../core/menus/standard";
63 $object =
new User($db);
64 $object->fetch($id,
'',
'', 1);
78 $hookmanager->initHooks(array(
'usercard',
'userihm',
'globalcard'));
85 $parameters = array(
'id'=>$socid);
86 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
91 if (empty($reshook)) {
92 if ($action ==
'update' && ($caneditfield || !empty($user->admin))) {
96 if (
GETPOST(
"check_MAIN_LANDING_PAGE") ==
"on") {
97 $tabparam[
"MAIN_LANDING_PAGE"] =
GETPOST(
"MAIN_LANDING_PAGE",
'alphanohtml');
99 $tabparam[
"MAIN_LANDING_PAGE"] =
'';
102 if (
GETPOST(
"check_MAIN_LANG_DEFAULT") ==
"on") {
103 $tabparam[
"MAIN_LANG_DEFAULT"] =
GETPOST(
"main_lang_default",
'aZ09');
105 $tabparam[
"MAIN_LANG_DEFAULT"] =
'';
108 if (
GETPOST(
"check_SIZE_LISTE_LIMIT") ==
"on") {
109 $tabparam[
"MAIN_SIZE_LISTE_LIMIT"] =
GETPOST(
"main_size_liste_limit",
'int');
111 $tabparam[
"MAIN_SIZE_LISTE_LIMIT"] =
'';
114 if (
GETPOST(
"check_AGENDA_DEFAULT_VIEW") ==
"on") {
115 $tabparam[
"AGENDA_DEFAULT_VIEW"] =
GETPOST(
"AGENDA_DEFAULT_VIEW",
'aZ09');
117 $tabparam[
"AGENDA_DEFAULT_VIEW"] =
'';
120 if (
GETPOST(
"check_MAIN_THEME") ==
"on") {
121 $tabparam[
"MAIN_THEME"] =
GETPOST(
'main_theme',
'aZ09');
123 $tabparam[
"MAIN_THEME"] =
'';
128 $tabparam[
'THEME_ELDY_TOPMENU_BACK1'] =
'';
130 $tabparam[
'THEME_ELDY_TOPMENU_BACK1'] = join(
138 $tabparam[
'THEME_ELDY_BACKTITLE1'] =
'';
140 $tabparam[
'THEME_ELDY_BACKTITLE1'] = join(
146 if (
GETPOST(
'check_THEME_ELDY_USE_HOVER') ==
'on') {
147 $tabparam[
"THEME_ELDY_USE_HOVER"] = 1;
149 $tabparam[
"THEME_ELDY_USE_HOVER"] = 0;
152 if (
GETPOST(
'check_THEME_ELDY_USE_CHECKED') ==
'on') {
153 $tabparam[
"THEME_ELDY_USE_CHECKED"] = 1;
155 $tabparam[
"THEME_ELDY_USE_CHECKED"] = 0;
158 if (
GETPOST(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
159 $tabparam[
"MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
161 $tabparam[
"MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
164 if (
GETPOST(
'MAIN_OPTIMIZEFORCOLORBLIND')) {
165 $tabparam[
"MAIN_OPTIMIZEFORCOLORBLIND"] =
GETPOST(
'MAIN_OPTIMIZEFORCOLORBLIND',
'aZ09');
167 $tabparam[
"MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
172 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
185 $tmparray = array(
'index.php'=>
'Dashboard');
186 if (!empty($conf->societe->enabled)) {
187 $tmparray[
'societe/index.php?mainmenu=companies&leftmenu='] =
'ThirdPartiesArea';
189 if (!empty($conf->project->enabled)) {
190 $tmparray[
'projet/index.php?mainmenu=project&leftmenu='] =
'ProjectsArea';
192 if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) {
193 $tmparray[
'hrm/index.php?mainmenu=hrm&leftmenu='] =
'HRMArea';
195 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
196 $tmparray[
'product/index.php?mainmenu=products&leftmenu='] =
'ProductsAndServicesArea';
198 if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) {
199 $tmparray[
'comm/index.php?mainmenu=commercial&leftmenu='] =
'CommercialArea';
201 if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) {
202 $tmparray[
'compta/index.php?mainmenu=compta&leftmenu='] =
'AccountancyTreasuryArea';
204 if (!empty($conf->adherent->enabled)) {
205 $tmparray[
'adherents/index.php?mainmenu=members&leftmenu='] =
'MembersArea';
208 $tmparray[
'comm/action/index.php?mainmenu=agenda&leftmenu='] =
'Agenda';
210 if (!empty($conf->ticket->enabled)) {
211 $tmparray[
'ticket/list.php?mainmenu=ticket&leftmenu='] =
'Tickets';
216 $title = $langs->trans(
"User");
218 if ($action ==
'edit') {
219 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
220 print
'<input type="hidden" name="token" value="'.newToken().
'">';
221 print
'<input type="hidden" name="action" value="update">';
222 print
'<input type="hidden" name="id" value="'.$id.
'">';
226 if ($action ==
'edit') {
231 if ($user->rights->user->user->lire || $user->admin) {
232 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
235 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin);
237 print
'<div class="underbanner clearboth"></div>';
242 if (!empty($conf->use_javascript_ajax)) {
243 print
'<script type="text/javascript">
244 jQuery(document).ready(function() {
245 function init_myfunc()
247 if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
248 else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
250 if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
251 else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
253 if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
254 else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
256 if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
257 else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
259 if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
260 else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
262 if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
263 else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
266 jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
267 jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
268 jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
269 jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
270 jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
271 jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
272 jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
280 print
'<table class="noborder centpercent">';
281 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"DefaultValue").
'</td><td> </td><td>'.$langs->trans(
"PersonalValue").
'</td></tr>';
284 print
'<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Language").
'</td>';
287 print $s ? $s.
' ' :
'';
288 print ($conf->global->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : $langs->trans(
"Language_".$conf->global->MAIN_LANG_DEFAULT));
290 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANG_DEFAULT" id="check_MAIN_LANG_DEFAULT" type="checkbox" '.(!empty($object->conf->MAIN_LANG_DEFAULT) ?
" checked" :
"");
291 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
292 print
'> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
294 print $formadmin->select_language((!empty($object->conf->MAIN_LANG_DEFAULT) ? $object->conf->MAIN_LANG_DEFAULT :
''),
'main_lang_default', 1,
null, 0, 0, (!empty($dolibarr_main_demo)));
298 print
'<tr class="oddeven"><td>'.$langs->trans(
"LandingPage").
'</td>';
300 print (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE);
302 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_MAIN_LANDING_PAGE" id="check_MAIN_LANDING_PAGE" type="checkbox" '.(!empty($object->conf->MAIN_LANDING_PAGE) ?
" checked" :
"");
303 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
304 print
'> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
306 print
$form->selectarray(
'MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE :
''), 0, 0, 0,
'', 1);
311 print
'<tr class="oddeven">'.
"\n";
312 print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_VIEW").
'</td>'.
"\n";
313 print
'<td class="center"> </td>'.
"\n";
314 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_AGENDA_DEFAULT_VIEW" id="check_AGENDA_DEFAULT_VIEW" type="checkbox" '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ?
" checked" :
"");
315 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
316 print
'> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
318 $tmplist = array(
''=>
' ',
'show_list'=>$langs->trans(
"ViewList"),
'show_month'=>$langs->trans(
"ViewCal"),
'show_week'=>$langs->trans(
"ViewWeek"),
'show_day'=>$langs->trans(
"ViewDay"),
'show_peruser'=>$langs->trans(
"ViewPerUser"));
319 print
$form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0,
'');
320 print
'</td></tr>'.
"\n";
323 print
'<tr class="oddeven"><td>'.$langs->trans(
"MaxSizeList").
'</td>';
324 print
'<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.
'</td>';
325 print
'<td class="nowrap" width="20%"><input class="oddeven" name="check_SIZE_LISTE_LIMIT" id="check_SIZE_LISTE_LIMIT" type="checkbox" '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ?
" checked" :
"");
326 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
327 print
'> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
328 print
'<td><input class="flat" name="main_size_liste_limit" id="main_size_liste_limit" size="4" value="'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT :
'').
'"></td></tr>';
330 print
'</table><br>';
333 showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0),
true);
336 print
$form->buttonsSaveCancel();
340 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
342 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
343 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
344 $morehtmlref .=
'</a>';
346 dol_banner_tab($object,
'id', $linkback, $user->rights->user->user->lire || $user->admin,
'rowid',
'ref', $morehtmlref);
348 print
'<div class="fichecenter">';
350 print
'<div class="underbanner clearboth"></div>';
351 print
'<table class="border centpercent tableforfield">';
354 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
355 if (!empty($object->ldap_sid) && $object->statut == 0) {
356 print
'<td class="error">';
357 print $langs->trans(
"LoginAccountDisableInDolibarr");
362 if (property_exists($object,
'admin')) {
363 if (!empty($conf->multicompany->enabled) && !empty($object->admin) && empty($object->entity)) {
364 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
365 } elseif (!empty($object->admin)) {
366 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
381 print
'<div class="div-table-responsive">';
382 print
'<table class="noborder centpercent">';
383 print
'<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"DefaultValue").
'</td><td> </td><td>'.$langs->trans(
"PersonalValue").
'</td></tr>';
386 print
'<tr class="oddeven"><td>'.$langs->trans(
"Language").
'</td>';
389 print ($s ? $s.
' ' :
'');
390 print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : $langs->trans(
"Language_".$conf->global->MAIN_LANG_DEFAULT));
392 print
'<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
394 $s = (isset($object->conf->MAIN_LANG_DEFAULT) ?
picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) :
'');
395 print ($s ? $s.
' ' :
'');
396 print (isset($object->conf->MAIN_LANG_DEFAULT) && $object->conf->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : (!empty($object->conf->MAIN_LANG_DEFAULT) ? $langs->trans(
"Language_".$object->conf->MAIN_LANG_DEFAULT) :
''));
400 print
'<tr class="oddeven"><td>'.$langs->trans(
"LandingPage").
'</td>';
402 print (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE);
404 print
'<td class="nowrap"><input class="oddeven" name="check_MAIN_LANDING_PAGE" disabled id="check_MAIN_LANDING_PAGE" type="checkbox" '.(!empty($object->conf->MAIN_LANDING_PAGE) ?
" checked" :
"");
405 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
406 print
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
408 if (!empty($object->conf->MAIN_LANDING_PAGE)) {
409 if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
410 print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
412 print $object->conf->MAIN_LANDING_PAGE;
419 print
'<tr class="oddeven">'.
"\n";
420 print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_VIEW").
'</td>'.
"\n";
421 print
'<td class="center"> </td>'.
"\n";
422 print
'<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
424 $tmplist = array(
''=>
' ',
'show_list'=>$langs->trans(
"ViewList"),
'show_month'=>$langs->trans(
"ViewCal"),
'show_week'=>$langs->trans(
"ViewWeek"),
'show_day'=>$langs->trans(
"ViewDay"),
'show_peruser'=>$langs->trans(
"ViewPerUser"));
425 if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
426 print
$form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0,
'', 0, 0, 1);
428 print
'</td></tr>'.
"\n";
431 print
'<tr class="oddeven"><td>'.$langs->trans(
"MaxSizeList").
'</td>';
432 print
'<td>'.(!empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? $conf->global->MAIN_SIZE_LISTE_LIMIT :
' ').
'</td>';
433 print
'<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
434 print
'<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT :
' ').
'</td></tr>';
445 print
'<div class="tabsAction">';
446 if (empty($user->admin) && !empty($dolibarr_main_demo)) {
447 print
'<a class="butActionRefused classfortooltip" title="'.$langs->trans(
"FeatureDisabledInDemo").
'" href="#">'.$langs->trans(
"Modify").
'</a>';
449 if ($caneditfield || !empty($user->admin)) {
450 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
452 print
'<a class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotEnoughPermissions").
'" href="#">'.$langs->trans(
"Modify").
'</a>';
459 if ($action ==
'edit') {