27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
33 $langs->loadLangs(array(
'companies',
'products',
'admin',
'users',
'languages',
'projects',
'members'));
36 $canreaduser = ($user->admin || $user->hasRight(
"user",
"user",
"read"));
39 $action =
GETPOST(
'action',
'aZ09');
40 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'userihm';
44 $caneditfield = ((($user->id == $id) && $user->hasRight(
"user",
"self",
"write"))
45 || (($user->id != $id) && $user->hasRight(
"user",
"user",
"write")));
50 if ($user->socid > 0) {
51 $socid = $user->socid;
53 $feature2 = (($socid && $user->hasRight(
"user",
"self",
"write")) ?
'' :
'user');
55 $result =
restrictedArea($user,
'user', $id,
'user&user', $feature2);
56 if ($user->id <> $id && !$canreaduser) {
60 $dirtop =
"../core/menus/standard";
61 $dirleft =
"../core/menus/standard";
64 $object =
new User($db);
65 $object->fetch($id,
'',
'', 1);
79 $hookmanager->initHooks(array(
'usercard',
'userihm',
'globalcard'));
86 $parameters = array(
'id'=>$socid);
87 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
92 if (empty($reshook)) {
93 if ($action ==
'update' && ($caneditfield || !empty($user->admin))) {
97 if (
GETPOST(
"check_MAIN_LANDING_PAGE") ==
"on") {
98 $tabparam[
"MAIN_LANDING_PAGE"] =
GETPOST(
"MAIN_LANDING_PAGE",
'alphanohtml');
100 $tabparam[
"MAIN_LANDING_PAGE"] =
'';
103 if (
GETPOST(
"check_MAIN_LANG_DEFAULT") ==
"on") {
104 $tabparam[
"MAIN_LANG_DEFAULT"] =
GETPOST(
"main_lang_default",
'aZ09');
106 $tabparam[
"MAIN_LANG_DEFAULT"] =
'';
109 if (
GETPOST(
"check_SIZE_LISTE_LIMIT") ==
"on") {
110 $tabparam[
"MAIN_SIZE_LISTE_LIMIT"] =
GETPOST(
"main_size_liste_limit",
'int');
112 $tabparam[
"MAIN_SIZE_LISTE_LIMIT"] =
'';
115 if (
GETPOST(
"check_AGENDA_DEFAULT_VIEW") ==
"on") {
116 $tabparam[
"AGENDA_DEFAULT_VIEW"] =
GETPOST(
"AGENDA_DEFAULT_VIEW",
'aZ09');
118 $tabparam[
"AGENDA_DEFAULT_VIEW"] =
'';
121 if (
GETPOST(
"check_MAIN_THEME") ==
"on") {
122 $tabparam[
"MAIN_THEME"] =
GETPOST(
'main_theme',
'aZ09');
124 $tabparam[
"MAIN_THEME"] =
'';
129 $tabparam[
'THEME_ELDY_TOPMENU_BACK1'] =
'';
131 $tabparam[
'THEME_ELDY_TOPMENU_BACK1'] = join(
139 $tabparam[
'THEME_ELDY_BACKTITLE1'] =
'';
141 $tabparam[
'THEME_ELDY_BACKTITLE1'] = join(
147 if (
GETPOST(
'check_THEME_ELDY_USE_HOVER') ==
'on') {
148 $tabparam[
"THEME_ELDY_USE_HOVER"] = 1;
150 $tabparam[
"THEME_ELDY_USE_HOVER"] = 0;
153 if (
GETPOST(
'check_THEME_ELDY_USE_CHECKED') ==
'on') {
154 $tabparam[
"THEME_ELDY_USE_CHECKED"] = 1;
156 $tabparam[
"THEME_ELDY_USE_CHECKED"] = 0;
159 if (
GETPOST(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
160 $tabparam[
"MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
162 $tabparam[
"MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
165 if (
GETPOST(
'MAIN_OPTIMIZEFORCOLORBLIND')) {
166 $tabparam[
"MAIN_OPTIMIZEFORCOLORBLIND"] =
GETPOST(
'MAIN_OPTIMIZEFORCOLORBLIND',
'aZ09');
168 $tabparam[
"MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
173 header(
'Location: '.$_SERVER[
"PHP_SELF"].
'?id='.$id);
182 $person_name = !empty($object->firstname) ? $object->lastname.
", ".$object->firstname : $object->lastname;
183 $title = $person_name.
" - ".$langs->trans(
'Card');
189 $tmparray = array(
'index.php'=>
'Dashboard');
191 $tmparray[
'societe/index.php?mainmenu=companies&leftmenu='] =
'ThirdPartiesArea';
193 if (!empty($conf->project->enabled)) {
194 $tmparray[
'projet/index.php?mainmenu=project&leftmenu='] =
'ProjectsArea';
197 $tmparray[
'hrm/index.php?mainmenu=hrm&leftmenu='] =
'HRMArea';
200 $tmparray[
'product/index.php?mainmenu=products&leftmenu='] =
'ProductsAndServicesArea';
203 $tmparray[
'comm/index.php?mainmenu=commercial&leftmenu='] =
'CommercialArea';
206 $tmparray[
'compta/index.php?mainmenu=compta&leftmenu='] =
'AccountancyTreasuryArea';
209 $tmparray[
'adherents/index.php?mainmenu=members&leftmenu='] =
'MembersArea';
212 $tmparray[
'comm/action/index.php?mainmenu=agenda&leftmenu='] =
'Agenda';
215 $tmparray[
'ticket/list.php?mainmenu=ticket&leftmenu='] =
'Tickets';
220 $title = $langs->trans(
"User");
222 if ($action ==
'edit') {
223 print
'<form method="post" action="'.$_SERVER[
"PHP_SELF"].
'">';
224 print
'<input type="hidden" name="token" value="'.newToken().
'">';
225 print
'<input type="hidden" name="action" value="update">';
226 print
'<input type="hidden" name="id" value="'.$id.
'">';
230 if ($action ==
'edit') {
235 if ($user->hasRight(
"user",
"user",
"read") || $user->admin) {
236 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
239 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin);
241 print
'<div class="underbanner clearboth"></div>';
246 if (!empty($conf->use_javascript_ajax)) {
247 print
'<script type="text/javascript">
248 jQuery(document).ready(function() {
249 function init_myfunc()
251 if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
252 else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
254 if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
255 else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
257 if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
258 else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
260 if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
261 else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
263 if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
264 else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
266 if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
267 else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
270 jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
271 jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
272 jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
273 jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
274 jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
275 jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
276 jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
284 print
'<table class="noborder centpercent">';
285 print
'<tr class="liste_titre"><td>'.$langs->trans(
"Parameter").
'</td><td>'.$langs->trans(
"DefaultValue").
'</td><td> </td><td>'.$langs->trans(
"PersonalValue").
'</td></tr>';
288 print
'<tr class="oddeven"><td class="titlefieldmiddle">'.$langs->trans(
"Language").
'</td>';
291 print $s ? $s.
' ' :
'';
292 print ($conf->global->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : $langs->trans(
"Language_".$conf->global->MAIN_LANG_DEFAULT));
294 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" :
"");
295 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
296 print
'> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
298 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)));
302 print
'<tr class="oddeven"><td>'.$langs->trans(
"LandingPage").
'</td>';
304 print (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE);
306 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" :
"");
307 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
308 print
'> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
310 print
$form->selectarray(
'MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE :
''), 0, 0, 0,
'', 1);
315 print
'<tr class="oddeven">'.
"\n";
316 print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_VIEW").
'</td>'.
"\n";
317 print
'<td class="center"> </td>'.
"\n";
318 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" :
"");
319 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
320 print
'> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
322 $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"));
323 print
$form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, (isset($object->conf->AGENDA_DEFAULT_VIEW) ? $object->conf->AGENDA_DEFAULT_VIEW :
''), 0, 0, 0,
'');
324 print
'</td></tr>'.
"\n";
327 print
'<tr class="oddeven"><td>'.$langs->trans(
"MaxSizeList").
'</td>';
328 print
'<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.
'</td>';
329 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" :
"");
330 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
331 print
'> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans(
"UsePersonalValue").
'</label></td>';
332 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>';
334 print
'</table><br>';
337 showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0),
true);
340 print
$form->buttonsSaveCancel();
344 $linkback =
'<a href="'.DOL_URL_ROOT.
'/user/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
346 $morehtmlref =
'<a href="'.DOL_URL_ROOT.
'/user/vcard.php?id='.$object->id.
'" class="refid">';
347 $morehtmlref .=
img_picto($langs->trans(
"Download").
' '.$langs->trans(
"VCard"),
'vcard.png',
'class="valignmiddle marginleftonly paddingrightonly"');
348 $morehtmlref .=
'</a>';
350 dol_banner_tab($object,
'id', $linkback, $user->hasRight(
"user",
"user",
"read") || $user->admin,
'rowid',
'ref', $morehtmlref);
352 print
'<div class="fichecenter">';
354 print
'<div class="underbanner clearboth"></div>';
355 print
'<table class="border centpercent tableforfield">';
358 print
'<tr><td class="titlefield">'.$langs->trans(
"Login").
'</td>';
359 if (!empty($object->ldap_sid) && $object->statut == 0) {
360 print
'<td class="error">';
361 print $langs->trans(
"LoginAccountDisableInDolibarr");
366 if (property_exists($object,
'admin')) {
367 if (
isModEnabled(
'multicompany') && !empty($object->admin) && empty($object->entity)) {
368 $addadmin .=
img_picto($langs->trans(
"SuperAdministratorDesc"),
"redstar",
'class="paddingleft"');
369 } elseif (!empty($object->admin)) {
370 $addadmin .=
img_picto($langs->trans(
"AdministratorDesc"),
"star",
'class="paddingleft"');
385 print
'<div class="div-table-responsive">';
386 print
'<table class="noborder centpercent">';
387 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>';
390 print
'<tr class="oddeven"><td>'.$langs->trans(
"Language").
'</td>';
393 print ($s ? $s.
' ' :
'');
394 print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT ==
'auto' ? $langs->trans(
"AutoDetectLang") : $langs->trans(
"Language_".$conf->global->MAIN_LANG_DEFAULT));
396 print
'<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
398 $s = (isset($object->conf->MAIN_LANG_DEFAULT) ?
picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) :
'');
399 print ($s ? $s.
' ' :
'');
400 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) :
''));
404 print
'<tr class="oddeven"><td>'.$langs->trans(
"LandingPage").
'</td>';
406 print (empty($conf->global->MAIN_LANDING_PAGE) ?
'' : $conf->global->MAIN_LANDING_PAGE);
408 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" :
"");
409 print empty($dolibarr_main_demo) ?
'' :
' disabled="disabled"';
410 print
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
412 if (!empty($object->conf->MAIN_LANDING_PAGE)) {
413 if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE])) {
414 print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
416 print $object->conf->MAIN_LANDING_PAGE;
423 print
'<tr class="oddeven">'.
"\n";
424 print
'<td>'.$langs->trans(
"AGENDA_DEFAULT_VIEW").
'</td>'.
"\n";
425 print
'<td class="center"> </td>'.
"\n";
426 print
'<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
428 $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"));
429 if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) {
430 print
$form->selectarray(
'AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0,
'', 0, 0, 1);
432 print
'</td></tr>'.
"\n";
435 print
'<tr class="oddeven"><td>'.$langs->trans(
"MaxSizeList").
'</td>';
436 print
'<td>'.(!empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? $conf->global->MAIN_SIZE_LISTE_LIMIT :
' ').
'</td>';
437 print
'<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ?
" checked" :
"").
'> '.$langs->trans(
"UsePersonalValue").
'</td>';
438 print
'<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT :
' ').
'</td></tr>';
449 print
'<div class="tabsAction">';
450 if (empty($user->admin) && !empty($dolibarr_main_demo)) {
451 print
'<a class="butActionRefused classfortooltip" title="'.$langs->trans(
"FeatureDisabledInDemo").
'" href="#">'.$langs->trans(
"Modify").
'</a>';
453 if ($caneditfield || !empty($user->admin)) {
454 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'&id='.$object->id.
'">'.$langs->trans(
"Modify").
'</a>';
456 print
'<a class="butActionRefused classfortooltip" title="'.$langs->trans(
"NotEnoughPermissions").
'" href="#">'.$langs->trans(
"Modify").
'</a>';
463 if ($action ==
'edit') {
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage Dolibarr users.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
dol_set_user_param($db, $conf, &$user, $tab)
Save personnal parameter.
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.
picto_from_langcode($codelang, $moreatt='', $notitlealt=0)
Return img flag of country for a language code or country code.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
showValueWithClipboardCPButton($valuetocopy, $showonlyonhover=1, $texttoshow='')
Create a button to copy $valuetocopy in the clipboard (for copy and paste feature).
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
isModEnabled($module)
Is Dolibarr module enabled.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
user_prepare_head(User $object)
Prepare array with list of tabs.
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.