29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/usergroups.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formadmin.class.php';
39 $langs->loadLangs(array(
'admin',
'languages',
'other',
'companies',
'products',
'members',
'projects',
'hrm',
'agenda'));
45 $action =
GETPOST(
'action',
'aZ09');
46 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'adminihm';
48 $mode =
GETPOST(
'mode',
'aZ09') ?
GETPOST(
'mode',
'aZ09') :
'other';
50 if (!defined(
"MAIN_MOTD")) {
51 define(
"MAIN_MOTD",
"");
58 $parameters = array();
59 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
64 if (
GETPOST(
'cancel',
'alpha')) {
70 if (preg_match(
'/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
71 if ($regs[1] ==
'set') {
78 if ($action ==
'removebackgroundlogin' && !empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
80 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
82 $logofile = $conf->mycompany->dir_output.
'/logos/'.$conf->global->MAIN_LOGIN_BACKGROUND;
98 if ($action ==
'update') {
101 if ($mode ==
'template') {
108 $val=
GETPOST(
'THEME_TOPMENU_DISABLE_IMAGE');
112 dolibarr_set_const($db,
'THEME_TOPMENU_DISABLE_IMAGE',
GETPOST(
'THEME_TOPMENU_DISABLE_IMAGE'),
'chaine', 0,
'', $conf->entity);
127 dolibarr_set_const($db,
'THEME_ELDY_TOPMENU_BACK1', $val,
'chaine', 0,
'', $conf->entity);
134 dolibarr_set_const($db,
'THEME_ELDY_VERMENU_BACK1', $val,
'chaine', 0,
'', $conf->entity);
141 dolibarr_set_const($db,
'THEME_ELDY_TEXTTITLENOTAB', $val,
'chaine', 0,
'', $conf->entity);
148 dolibarr_set_const($db,
'THEME_ELDY_BACKTITLE1', $val,
'chaine', 0,
'', $conf->entity);
155 dolibarr_set_const($db,
'THEME_ELDY_TEXTTITLE', $val,
'chaine', 0,
'', $conf->entity);
162 dolibarr_set_const($db,
'THEME_ELDY_TEXTTITLELINK', $val,
'chaine', 0,
'', $conf->entity);
169 dolibarr_set_const($db,
'THEME_ELDY_LINEIMPAIR1', $val,
'chaine', 0,
'', $conf->entity);
175 dolibarr_set_const($db,
'THEME_ELDY_LINEIMPAIR2', $val,
'chaine', 0,
'', $conf->entity);
182 dolibarr_set_const($db,
'THEME_ELDY_LINEPAIR1', $val,
'chaine', 0,
'', $conf->entity);
188 dolibarr_set_const($db,
'THEME_ELDY_LINEPAIR2', $val,
'chaine', 0,
'', $conf->entity);
202 dolibarr_set_const($db,
"THEME_ELDY_USE_HOVER", $val,
'chaine', 0,
'', $conf->entity);
209 dolibarr_set_const($db,
"THEME_ELDY_USE_CHECKED", $val,
'chaine', 0,
'', $conf->entity);
216 dolibarr_set_const($db,
'THEME_ELDY_BTNACTION', $val,
'chaine', 0,
'', $conf->entity);
223 dolibarr_set_const($db,
'THEME_ELDY_TEXTBTNACTION', $val,
'chaine', 0,
'', $conf->entity);
227 if ($mode ==
'dashboard') {
231 if ($mode ==
'other') {
235 dolibarr_set_const($db,
"MAIN_SIZE_LISTE_LIMIT",
GETPOST(
"main_size_liste_limit",
'int'),
'chaine', 0,
'', $conf->entity);
236 dolibarr_set_const($db,
"MAIN_SIZE_SHORTLIST_LIMIT",
GETPOST(
"main_size_shortliste_limit",
'int'),
'chaine', 0,
'', $conf->entity);
243 dolibarr_set_const($db,
"MAIN_DEFAULT_WORKING_DAYS",
GETPOST(
"MAIN_DEFAULT_WORKING_DAYS",
'alphanohtml'),
'chaine', 0,
'', $conf->entity);
244 dolibarr_set_const($db,
"MAIN_DEFAULT_WORKING_HOURS",
GETPOST(
"MAIN_DEFAULT_WORKING_HOURS",
'alphanohtml'),
'chaine', 0,
'', $conf->entity);
246 dolibarr_set_const($db,
"MAIN_BUGTRACK_ENABLELINK",
GETPOST(
"MAIN_BUGTRACK_ENABLELINK",
'alpha'),
'chaine', 0,
'', $conf->entity);
248 dolibarr_set_const($db,
"MAIN_FIRSTNAME_NAME_POSITION",
GETPOST(
"MAIN_FIRSTNAME_NAME_POSITION",
'aZ09'),
'chaine', 0,
'', $conf->entity);
251 if ($mode ==
'login') {
255 $varforimage =
'imagebackground';
256 $dirforimage = $conf->mycompany->dir_output .
'/logos/';
257 if ($_FILES[$varforimage][
"tmp_name"]) {
259 if (preg_match(
'/([^\\/:]+)$/i', $_FILES[$varforimage][
"name"], $reg)) {
260 $original_file = $reg[1];
264 dol_syslog(
"Move file " . $_FILES[$varforimage][
"tmp_name"] .
" to " . $dirforimage . $original_file);
265 if (!is_dir($dirforimage)) {
268 $result =
dol_move_uploaded_file($_FILES[$varforimage][
"tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage][
'error']);
270 dolibarr_set_const($db,
"MAIN_LOGIN_BACKGROUND", $original_file,
'chaine', 0,
'', $conf->entity);
271 } elseif (preg_match(
'/^ErrorFileIsInfectedWithAVirus/', $result)) {
273 $langs->load(
"errors");
274 $tmparray = explode(
':', $result);
275 setEventMessages($langs->trans(
'ErrorFileIsInfectedWithAVirus', $tmparray[1]),
null,
'errors');
282 $langs->load(
"errors");
289 $_SESSION[
"mainmenu"] =
"";
291 if (
GETPOST(
'dol_resetcache')) {
292 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", ((
int) $conf->global->MAIN_IHM_PARAMS_REV) + 1,
'chaine', 0,
'', $conf->entity);
295 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mainmenu=home&leftmenu=setup".
'&mode='.$mode.(GETPOSTISSET(
'page_y') ?
'&page_y='.GETPOST(
'page_y',
'int') :
''));
304 $wikihelp =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
313 print
'<span class="opacitymedium">'.$langs->trans(
"DisplayDesc").
"</span><br>\n";
317 require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
319 print
'<form enctype="multipart/form-data" method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
320 print
'<input type="hidden" name="token" value="'.newToken().
'">';
321 print
'<input type="hidden" name="action" value="update">';
322 print
'<input type="hidden" name="page_y" value="">';
323 print
'<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).
'">';
324 print
'<input type="hidden" name="dol_resetcache" value="1">';
334 if ($mode ==
'other') {
335 print
'<div class="div-table-responsive-no-min">';
336 print
'<table summary="edit" class="noborder centpercent editmode tableforfield">';
338 print
'<tr class="liste_titre"><td class="titlefieldmiddle">';
339 print $langs->trans(
"Language");
340 print
'</td><td class="titlefieldmiddle">';
344 print
'<tr class="oddeven"><td>'.$langs->trans(
"DefaultLanguage").
'</td><td>';
345 print
img_picto(
'',
'language',
'class="pictofixedwidth"');
346 print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,
'MAIN_LANG_DEFAULT', 1,
null,
'', 0, 0,
'minwidth300', 2);
352 print
'<tr class="oddeven"><td>' . $langs->trans(
"EnableMultilangInterface") .
'</td><td>';
353 print
ajax_constantonoff(
"MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'',
'language');
357 print
'</table>' .
"\n";
360 print
'<div class="center">';
361 print
'<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans(
"Save") .
'">';
362 print
'<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';
369 print
'<div class="div-table-responsive-no-min">';
370 print
'<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
372 print
'<tr class="liste_titre"><td class="titlefieldmiddle">';
373 print $langs->trans(
"Miscellaneous");
375 print
'<td class="titlefieldmiddle"></td>';
379 print
'<tr class="oddeven"><td>' . $langs->trans(
"ShowQuickAddLink") .
'</td><td>';
380 print
ajax_constantonoff(
"MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'',
'other');
385 $pictohelp =
'<span class="fa fa-question-circle"></span>';
386 print
'<tr class="oddeven"><td>' . str_replace(
'{picto}', $pictohelp, $langs->trans(
"DisableLinkToHelp",
'{picto}')) .
'</td><td>';
387 print
ajax_constantonoff(
"MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'',
'other');
393 print
'<tr class="oddeven"><td>' . $langs->trans(
"DefaultMaxSizeList") .
'</td><td><input class="flat" name="main_size_liste_limit" size="4" value="' . $conf->global->MAIN_SIZE_LISTE_LIMIT .
'"></td>';
397 print
'<tr class="oddeven"><td>' . $langs->trans(
"DefaultMaxSizeShortList") .
'</td><td><input class="flat" name="main_size_shortliste_limit" size="4" value="' . $conf->global->MAIN_SIZE_SHORTLIST_LIMIT .
'"></td>';
409 print
'<tr class="oddeven"><td>' . $langs->trans(
"WeekStartOnDay") .
'</td><td>';
410 print $formother->select_dayofweek((isset($conf->global->MAIN_START_WEEK) ? $conf->global->MAIN_START_WEEK :
'1'),
'MAIN_START_WEEK', 0);
415 print
'<tr class="oddeven"><td>' . $langs->trans(
"DefaultWorkingDays") .
'</td><td>';
416 print
'<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_DAYS) ? $conf->global->MAIN_DEFAULT_WORKING_DAYS :
'1-5') .
'">';
421 print
'<tr class="oddeven"><td>' . $langs->trans(
"DefaultWorkingHours") .
'</td><td>';
422 print
'<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . (isset($conf->global->MAIN_DEFAULT_WORKING_HOURS) ? $conf->global->MAIN_DEFAULT_WORKING_HOURS :
'9-18') .
'">';
427 print
'<tr class="oddeven"><td>' . $langs->trans(
"FirstnameNamePosition") .
'</td><td>';
428 $array = array(0 => $langs->trans(
"Firstname") .
' ' . $langs->trans(
"Lastname"), 1 => $langs->trans(
"Lastname") .
' ' . $langs->trans(
"Firstname"));
429 print
$form->selectarray(
'MAIN_FIRSTNAME_NAME_POSITION', $array, (isset($conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? $conf->global->MAIN_FIRSTNAME_NAME_POSITION : 0));
434 print
'<tr class="oddeven"><td>' . $langs->trans(
"HideUnauthorizedMenu") .
'</td><td>';
436 print
ajax_constantonoff(
"MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'',
'other');
441 print
'<tr class="oddeven"><td>' . $langs->trans(
"ButtonHideUnauthorized") .
'</td><td>';
443 print
ajax_constantonoff(
"MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'',
'other');
457 print
'<tr class="oddeven"><td>';
458 print
$form->textwithpicto($langs->trans(
"ShowBugTrackLink", $langs->transnoentitiesnoconv(
"FindBug")), $langs->trans(
"ShowBugTrackLinkDesc"));
460 print
'<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . (empty($conf->global->MAIN_BUGTRACK_ENABLELINK) ?
'' : $conf->global->MAIN_BUGTRACK_ENABLELINK) .
'">';
465 print
'<tr class="oddeven"><td>' .
$form->textwithpicto($langs->trans(
"DisableJavascript"), $langs->trans(
"DisableJavascriptNote")) .
'</td><td>';
466 print
ajax_constantonoff(
"MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'',
'other');
470 print
'</table>' .
"\n";
475 if ($mode ==
'template') {
481 if ($mode ==
'dashboard') {
482 print
'<div class="div-table-responsive-no-min">';
483 print
'<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
489 print
'<tr class="oddeven width25p"><td>';
490 $texthelp = $langs->trans(
"FollowingConstantsWillBeSubstituted") .
'<br>';
491 foreach ($substitutionarray as $key => $val) {
492 $texthelp .= $key .
'<br>';
494 print
$form->textwithpicto($langs->trans(
"MessageOfDay"), $texthelp, 1,
'help',
'', 0, 2,
'tooltipmessageofday');
498 $doleditor =
new DolEditor(
'main_motd', (isset($conf->global->MAIN_MOTD) ? $conf->global->MAIN_MOTD :
''),
'', 142,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_4,
'90%');
499 $doleditor->Create();
501 print
'</td></tr>' .
"\n";
515 print
'<div class="div-table-responsive-no-min">';
516 print
'<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
518 print
'<tr class="liste_titre"><td class="titlefieldmiddle">';
519 print $langs->trans(
"DashboardDisableBlocks");
520 print
'</td><td class="titlefieldmiddle">';
523 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableGlobal') .
'</td><td>';
524 print
ajax_constantonoff(
"MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
528 if (empty($conf->global->MAIN_DISABLE_GLOBAL_WORKBOARD)) {
530 print
'<tr class="oddeven"><td>' . $langs->trans(
'MAIN_DISABLE_METEO') .
'</td><td>';
531 print
ajax_constantonoff(
"MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
536 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockAgenda') .
'</td><td>';
537 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
542 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockProject') .
'</td><td>';
543 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
548 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockCustomer') .
'</td><td>';
549 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
554 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockSupplier') .
'</td><td>';
555 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
560 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockContract') .
'</td><td>';
561 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
566 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockTicket') .
'</td><td>';
567 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
572 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockBank') .
'</td><td>';
573 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
578 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockAdherent') .
'</td><td>';
579 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
584 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockExpenseReport') .
'</td><td>';
585 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
590 print
'<tr class="oddeven"><td>' . $langs->trans(
'DashboardDisableBlockHoliday') .
'</td><td>';
591 print
ajax_constantonoff(
"MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 1, 0, 0, 0,
'_red',
'dashboard');
596 print
'</table>' .
"\n";
601 if ($mode ==
'login') {
603 print
'<div class="div-table-responsive-no-min">';
604 print
'<table summary="edit" class="noborder centpercent editmode tableforfield">';
606 print
'<tr class="liste_titre"><td class="titlefieldmax45">';
607 print $langs->trans(
"Parameter");
609 print $langs->trans(
"Value");
613 print
'<tr class="oddeven"><td>' . $langs->trans(
"DisableLinkToHelpCenter") .
'</td><td>';
614 print
ajax_constantonoff(
"MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0, 0, 0,
'',
'login');
621 print
'<tr class="oddeven"><td>';
622 $texthelp = $langs->trans(
"FollowingConstantsWillBeSubstituted") .
'<br>';
623 foreach ($substitutionarray as $key => $val) {
624 $texthelp .= $key .
'<br>';
626 print
$form->textwithpicto($langs->trans(
"MessageLogin"), $texthelp, 1,
'help',
'', 0, 2,
'tooltipmessagelogin');
628 $doleditor =
new DolEditor(
'main_home', (isset($conf->global->MAIN_HOME) ? $conf->global->MAIN_HOME :
''),
'', 142,
'dolibarr_notes',
'In',
false,
true,
true, ROWS_4,
'90%');
629 $doleditor->Create();
630 print
'</td></tr>' .
"\n";
633 print
'<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans(
"BackgroundImageLogin") .
' (png,jpg)</label></td><td>';
634 print
'<div class="centpercent inline-block">';
636 if (!empty($conf->global->ADD_UNSPLASH_LOGIN_BACKGROUND)) {
637 $disabled =
' disabled="disabled"';
640 $maxmin = $maxfilesizearray[
'maxmin'];
642 print
'<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).
'">';
644 print
'<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled .
'>';
646 print
'(' . $langs->trans(
"DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") .
') ';
648 if (!empty($conf->global->MAIN_LOGIN_BACKGROUND)) {
649 print
'<a class="reposition" href="' . $_SERVER[
"PHP_SELF"] .
'?action=removebackgroundlogin&token='.newToken().
'&mode=login">' .
img_delete($langs->trans(
"Delete")) .
'</a>';
650 if (file_exists($conf->mycompany->dir_output .
'/logos/' . $conf->global->MAIN_LOGIN_BACKGROUND)) {
652 print
'<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT .
'/viewimage.php?modulepart=mycompany&file=' . urlencode(
'logos/' . $conf->global->MAIN_LOGIN_BACKGROUND) .
'">';
655 print
'<img class="paddingleft valignmiddle" width="100" src="' . DOL_URL_ROOT .
'/public/theme/common/nophoto.png">';
660 print
'</table>' .
"\n";
664 print
'<div class="center">';
665 print
'<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans(
"Save") .
'">';
666 print
'<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans(
"Cancel") .
'">';