1<?php
2/* Copyright (C) 2005-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
3 * Copyright (C) 2010-2015 Regis Houssin        <regis.houssin@inodbox.com>
4 * Copyright (C) 2013	   Florian Henry        <florian.henry@open-concept.pro.com>
5 * Copyright (C) 2018      Ferran Marcet        <fmarcet@2byte.es>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21/**
22 *       \file       htdocs/user/param_ihm.php
23 *       \brief      Page to show user setup for display
24 */
25
26require '../main.inc.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
30
31// Load translation files required by page
32$langs->loadLangs(array('companies', 'products', 'admin', 'users', 'languages', 'projects', 'members'));
33
34// Defini si peux lire/modifier permisssions
35$canreaduser = ($user->admin || $user->rights->user->user->lire);
36
37$id = GETPOST('id', 'int');
38$action = GETPOST('action', 'aZ09');
39$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userihm'; // To manage different context of search
40
41if ($id)
42{
43	// $user est le user qui edite, $id est l'id de l'utilisateur edite
44	$caneditfield = ((($user->id == $id) && $user->rights->user->self->creer)
45	|| (($user->id != $id) && $user->rights->user->user->creer));
46}
47
48// Security check
49$socid = 0;
50if ($user->socid > 0) $socid = $user->socid;
51$feature2 = (($socid && $user->rights->user->self->creer) ? '' : 'user');
52
53$result = restrictedArea($user, 'user', $id, 'user&user', $feature2);
54if ($user->id <> $id && !$canreaduser) accessforbidden();
55
56$dirtop = "../core/menus/standard";
57$dirleft = "../core/menus/standard";
58
59// Charge utilisateur edite
60$object = new User($db);
61$object->fetch($id, '', '', 1);
62$object->getrights();
63
64// Liste des zone de recherche permanentes supportees
65/* deprecated
66$searchform=array("main_searchform_societe","main_searchform_contact","main_searchform_produitservice");
67$searchformconst=array($conf->global->MAIN_SEARCHFORM_SOCIETE,$conf->global->MAIN_SEARCHFORM_CONTACT,$conf->global->MAIN_SEARCHFORM_PRODUITSERVICE);
68$searchformtitle=array($langs->trans("Companies"),$langs->trans("Contacts"),$langs->trans("ProductsAndServices"));
69*/
70
71$form = new Form($db);
72$formadmin = new FormAdmin($db);
73
74// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
75$hookmanager->initHooks(array('usercard', 'userihm', 'globalcard'));
76
77
78/*
79 * Actions
80 */
81
82$parameters = array('id'=>$socid);
83$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
84if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
85
86if (empty($reshook)) {
87	if ($action == 'update' && ($caneditfield || !empty($user->admin))) {
88		if (!$_POST["cancel"]) {
89			$tabparam = array();
90
91			if (GETPOST("check_MAIN_LANDING_PAGE") == "on") {
92				$tabparam["MAIN_LANDING_PAGE"] = GETPOST("MAIN_LANDING_PAGE", 'alphanohtml');
93			} else {
94				$tabparam["MAIN_LANDING_PAGE"] = '';
95			}
96
97			if (GETPOST("check_MAIN_LANG_DEFAULT") == "on") {
98				$tabparam["MAIN_LANG_DEFAULT"] = GETPOST("main_lang_default", 'aZ09');
99			} else {
100				$tabparam["MAIN_LANG_DEFAULT"] = '';
101			}
102
103			if (GETPOST("check_SIZE_LISTE_LIMIT") == "on") {
104				$tabparam["MAIN_SIZE_LISTE_LIMIT"] = GETPOST("main_size_liste_limit", 'int');
105			} else {
106				$tabparam["MAIN_SIZE_LISTE_LIMIT"] = '';
107			}
108
109			if (GETPOST("check_AGENDA_DEFAULT_VIEW") == "on") {
110				$tabparam["AGENDA_DEFAULT_VIEW"] = GETPOST("AGENDA_DEFAULT_VIEW", 'aZ09');
111			} else {
112				$tabparam["AGENDA_DEFAULT_VIEW"] = '';
113			}
114
115			if (GETPOST("check_MAIN_THEME") == "on") {
116				$tabparam["MAIN_THEME"] = GETPOST('main_theme', 'aZ09');
117			} else {
118				$tabparam["MAIN_THEME"] = '';
119			}
120
121			$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array()))));
122			if ($val == '') {
123				$tabparam['THEME_ELDY_TOPMENU_BACK1'] = '';
124			} else {
125				$tabparam['THEME_ELDY_TOPMENU_BACK1'] = join(',',
126					colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1', 'alphanohtml'), array()));
127			}
128
129			$val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array()))));
130			if ($val == '') {
131				$tabparam['THEME_ELDY_BACKTITLE1'] = '';
132			} else {
133				$tabparam['THEME_ELDY_BACKTITLE1'] = join(',',
134					colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1', 'alphanohtml'), array()));
135			}
136
137			if (GETPOST('check_THEME_ELDY_USE_HOVER') == 'on') {
138				$tabparam["THEME_ELDY_USE_HOVER"] = 1;
139			} else {
140				$tabparam["THEME_ELDY_USE_HOVER"] = 0;
141			}
142
143			if (GETPOST('check_THEME_ELDY_USE_CHECKED') == 'on') {
144				$tabparam["THEME_ELDY_USE_CHECKED"] = 1;
145			} else {
146				$tabparam["THEME_ELDY_USE_CHECKED"] = 0;
147			}
148
149			if (GETPOST('MAIN_OPTIMIZEFORTEXTBROWSER')) {
150				$tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 1;
151			} else {
152				$tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0;
153			}
154
155			if (GETPOST('MAIN_OPTIMIZEFORCOLORBLIND')) {
156				$tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = GETPOST('MAIN_OPTIMIZEFORCOLORBLIND', 'aZ09');
157			} else {
158				$tabparam["MAIN_OPTIMIZEFORCOLORBLIND"] = 0;
159			}
160
161			$result = dol_set_user_param($db, $conf, $object, $tabparam);
162
163			header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
164			exit;
165		}
166	}
167}
168
169/*
170 * View
171 */
172
173llxHeader();
174
175// List of possible landing pages
176$tmparray = array('index.php'=>'Dashboard');
177if (!empty($conf->societe->enabled)) $tmparray['societe/index.php?mainmenu=companies&leftmenu='] = 'ThirdPartiesArea';
178if (!empty($conf->projet->enabled)) $tmparray['projet/index.php?mainmenu=project&leftmenu='] = 'ProjectsArea';
179if (!empty($conf->holiday->enabled) || !empty($conf->expensereport->enabled)) $tmparray['hrm/index.php?mainmenu=hrm&leftmenu='] = 'HRMArea'; // TODO Complete list with first level of menus
180if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) $tmparray['product/index.php?mainmenu=products&leftmenu='] = 'ProductsAndServicesArea';
181if (!empty($conf->propal->enabled) || !empty($conf->commande->enabled) || !empty($conf->ficheinter->enabled) || !empty($conf->contrat->enabled)) $tmparray['comm/index.php?mainmenu=commercial&leftmenu='] = 'CommercialArea';
182if (!empty($conf->comptabilite->enabled) || !empty($conf->accounting->enabled)) $tmparray['compta/index.php?mainmenu=compta&leftmenu='] = 'AccountancyTreasuryArea';
183if (!empty($conf->adherent->enabled)) $tmparray['adherents/index.php?mainmenu=members&leftmenu='] = 'MembersArea';
184if (!empty($conf->agenda->enabled)) $tmparray['comm/action/index.php?mainmenu=agenda&leftmenu='] = 'Agenda';
185
186$head = user_prepare_head($object);
187
188$title = $langs->trans("User");
189
190if ($action == 'edit')
191{
192	print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
193	print '<input type="hidden" name="token" value="'.newToken().'">';
194	print '<input type="hidden" name="action" value="update">';
195	print '<input type="hidden" name="id" value="'.$id.'">';
196}
197
198
199if ($action == 'edit')
200{
201	print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
202
203	$linkback = '';
204
205	if ($user->rights->user->user->lire || $user->admin) {
206		$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
207	}
208
209	dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
210
211	if (!empty($conf->use_javascript_ajax))
212	{/*
213        print '<script type="text/javascript" language="javascript">
214    	jQuery(document).ready(function() {
215    		$("#main_lang_default").change(function() {
216    			$("#check_MAIN_LANG_DEFAULT").prop("checked", true);
217    		});
218    		$("#main_size_liste_limit").keyup(function() {
219    			if ($(this).val().length) $("#check_SIZE_LISTE_LIMIT").prop("checked", true);
220    			else $("#check_SIZE_LISTE_LIMIT").prop("checked", false);
221    		});
222    	});
223    	</script>';*/
224	}
225	if (!empty($conf->use_javascript_ajax))
226	{
227		print '<script type="text/javascript" language="javascript">
228        jQuery(document).ready(function() {
229        	function init_myfunc()
230        	{
231        		if (jQuery("#check_MAIN_LANDING_PAGE").prop("checked")) { jQuery("#MAIN_LANDING_PAGE").removeAttr(\'disabled\'); }
232        		else { jQuery("#MAIN_LANDING_PAGE").attr(\'disabled\',\'disabled\'); }
233
234                if (jQuery("#check_MAIN_LANG_DEFAULT").prop("checked")) { jQuery("#main_lang_default").removeAttr(\'disabled\'); }
235        		else { jQuery("#main_lang_default").attr(\'disabled\',\'disabled\'); }
236
237                if (jQuery("#check_SIZE_LISTE_LIMIT").prop("checked")) { jQuery("#main_size_liste_limit").removeAttr(\'disabled\'); }
238        		else { jQuery("#main_size_liste_limit").attr(\'disabled\',\'disabled\'); }
239
240                if (jQuery("#check_AGENDA_DEFAULT_VIEW").prop("checked")) { jQuery("#AGENDA_DEFAULT_VIEW").removeAttr(\'disabled\'); }
241        		else { jQuery("#AGENDA_DEFAULT_VIEW").attr(\'disabled\',\'disabled\'); }
242
243                if (jQuery("#check_MAIN_THEME").prop("checked")) { jQuery(".themethumbs").removeAttr(\'disabled\'); }
244        		else { jQuery(".themethumbs").attr(\'disabled\',\'disabled\'); }
245
246                if (jQuery("#check_THEME_ELDY_TOPMENU_BACK1").prop("checked")) { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").removeAttr(\'disabled\'); }
247        		else { jQuery("#colorpickerTHEME_ELDY_TOPMENU_BACK1").attr(\'disabled\',\'disabled\'); }
248            }
249        	init_myfunc();
250        	jQuery("#check_MAIN_LANDING_PAGE").click(function() { init_myfunc(); });
251            jQuery("#check_MAIN_LANG_DEFAULT").click(function() { init_myfunc(); });
252            jQuery("#check_SIZE_LISTE_LIMIT").click(function() { init_myfunc(); });
253            jQuery("#check_AGENDA_DEFAULT_VIEW").click(function() { init_myfunc(); });
254            jQuery("#check_MAIN_THEME").click(function() { init_myfunc(); });
255            jQuery("#check_THEME_ELDY_TOPMENU_BACK1").click(function() { init_myfunc(); });
256            jQuery("#check_THEME_ELDY_BACKTITLE1").click(function() { init_myfunc(); });
257        });
258        </script>';
259	}
260
261
262	clearstatcache();
263
264	print '<table class="noborder centpercent tableforfield">';
265	print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
266
267	// Language by default
268	print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
269	print '<td>';
270	$s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
271	print $s ? $s.' ' : '';
272	print ($conf->global->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
273	print '</td>';
274	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" : "");
275	print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
276	print '> <label for="check_MAIN_LANG_DEFAULT">'.$langs->trans("UsePersonalValue").'</label></td>';
277	print '<td>';
278	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)));
279	print '</td></tr>';
280
281	// Landing page
282	print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
283	print '<td>';
284	print (empty($conf->global->MAIN_LANDING_PAGE) ? '' : $conf->global->MAIN_LANDING_PAGE);
285	print '</td>';
286	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" : "");
287	print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
288	print '> <label for="check_MAIN_LANDING_PAGE">'.$langs->trans("UsePersonalValue").'</label></td>';
289	print '<td>';
290	print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (!empty($object->conf->MAIN_LANDING_PAGE) ? $object->conf->MAIN_LANDING_PAGE : ''), 0, 0, 0, '', 1);
291	//print info_admin($langs->trans("WarningYouMayLooseAccess"), 0, 0, 0);
292	print '</td></tr>';
293
294	// Landing page for Agenda - AGENDA_DEFAULT_VIEW
295	print '<tr class="oddeven">'."\n";
296	print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
297	print '<td class="center">&nbsp;</td>'."\n";
298	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" : "");
299	print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
300	print '> <label for="check_AGENDA_DEFAULT_VIEW">'.$langs->trans("UsePersonalValue").'</label></td>';
301	print '<td>'."\n";
302	$tmplist = array(''=>'&nbsp;', '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"));
303	print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '');
304	print '</td></tr>'."\n";
305
306	// Max size of lists
307	print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
308	print '<td>'.$conf->global->MAIN_SIZE_LISTE_LIMIT.'</td>';
309	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" : "");
310	print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
311	print '> <label for="check_SIZE_LISTE_LIMIT">'.$langs->trans("UsePersonalValue").'</label></td>';
312	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>';
313
314	print '</table><br>';
315
316	// Theme
317	showSkins($object, (($user->admin || empty($dolibarr_main_demo)) ? 1 : 0), true);
318
319	print dol_get_fiche_end();
320
321
322	print '<div class="center">';
323	print '<input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
324	print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
325	print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
326	print '</div>';
327} else {
328	print dol_get_fiche_head($head, 'guisetup', $title, -1, 'user');
329
330	$linkback = '<a href="'.DOL_URL_ROOT.'/user/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
331
332	dol_banner_tab($object, 'id', $linkback, $user->rights->user->user->lire || $user->admin);
333
334	print '<table class="noborder centpercent tableforfield">';
335	print '<tr class="liste_titre"><td>'.$langs->trans("Parameter").'</td><td>'.$langs->trans("DefaultValue").'</td><td>&nbsp;</td><td>'.$langs->trans("PersonalValue").'</td></tr>';
336
337	// Language
338	print '<tr class="oddeven"><td>'.$langs->trans("Language").'</td>';
339	print '<td>';
340	$s = picto_from_langcode($conf->global->MAIN_LANG_DEFAULT);
341	print ($s ? $s.' ' : '');
342	print (isset($conf->global->MAIN_LANG_DEFAULT) && $conf->global->MAIN_LANG_DEFAULT == 'auto' ? $langs->trans("AutoDetectLang") : $langs->trans("Language_".$conf->global->MAIN_LANG_DEFAULT));
343	print '</td>';
344	print '<td class="nowrap"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_LANG_DEFAULT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
345	print '<td>';
346	$s = (isset($object->conf->MAIN_LANG_DEFAULT) ? picto_from_langcode($object->conf->MAIN_LANG_DEFAULT) : '');
347	print ($s ? $s.' ' : '');
348	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) : ''));
349	print '</td></tr>';
350
351	// Landing page
352	print '<tr class="oddeven"><td>'.$langs->trans("LandingPage").'</td>';
353	print '<td>';
354	print (empty($conf->global->MAIN_LANDING_PAGE) ? '' : $conf->global->MAIN_LANDING_PAGE);
355	print '</td>';
356	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" : "");
357	print empty($dolibarr_main_demo) ? '' : ' disabled="disabled"'; // Disabled for demo
358	print '> '.$langs->trans("UsePersonalValue").'</td>';
359	print '<td>';
360	if (!empty($tmparray[$object->conf->MAIN_LANDING_PAGE]))
361	{
362		print $langs->trans($tmparray[$object->conf->MAIN_LANDING_PAGE]);
363	} else print $object->conf->MAIN_LANDING_PAGE;
364	//print $form->selectarray('MAIN_LANDING_PAGE', $tmparray, (! empty($object->conf->MAIN_LANDING_PAGE)?$object->conf->MAIN_LANDING_PAGE:''), 0, 0, 0, '', 1);
365	print '</td></tr>';
366
367	// Landing page for Agenda - AGENDA_DEFAULT_VIEW
368	print '<tr class="oddeven">'."\n";
369	print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
370	print '<td class="center">&nbsp;</td>'."\n";
371	print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->AGENDA_DEFAULT_VIEW) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
372	print '<td>'."\n";
373	$tmplist = array(''=>'&nbsp;', '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"));
374	if (!empty($object->conf->AGENDA_DEFAULT_VIEW)) print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $object->conf->AGENDA_DEFAULT_VIEW, 0, 0, 0, '', 0, 0, 1);
375	print '</td></tr>'."\n";
376
377	// Max size for lists
378	print '<tr class="oddeven"><td>'.$langs->trans("MaxSizeList").'</td>';
379	print '<td>'.(!empty($conf->global->MAIN_SIZE_LISTE_LIMIT) ? $conf->global->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td>';
380	print '<td class="nowrap" width="20%"><input class="oddeven" type="checkbox" disabled '.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? " checked" : "").'> '.$langs->trans("UsePersonalValue").'</td>';
381	print '<td>'.(!empty($object->conf->MAIN_SIZE_LISTE_LIMIT) ? $object->conf->MAIN_SIZE_LISTE_LIMIT : '&nbsp;').'</td></tr>';
382
383	print '</table><br>';
384
385
386	// Skin
387	showSkins($object, 0, true);
388
389	print dol_get_fiche_end();
390
391
392	print '<div class="tabsAction">';
393	if (empty($user->admin) && !empty($dolibarr_main_demo))
394	{
395		print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify")."</a>";
396	} else {
397		if ($caneditfield || !empty($user->admin))       // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin
398		{
399			print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&amp;id='.$object->id.'">'.$langs->trans("Modify").'</a>';
400		} else {
401			print "<a class=\"butActionRefused classfortooltip\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify")."</a>";
402		}
403	}
404
405	print '</div>';
406}
407
408if ($action == 'edit')
409{
410	print '</form>';
411}
412
413// End of page
414llxFooter();
415$db->close();
416