dolibarr 21.0.0-beta
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
5 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
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
26// Load Dolibarr environment
27require '../main.inc.php';
28
37// Load translation files required by the page
38$langs->loadLangs(array('admin', 'companies'));
39
40$action = '';
41
42if (!$user->admin) {
44}
45
46// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
47$hookmanager->initHooks(array('homesetup'));
48
49
50/*
51 * View
52 */
53
54$form = new Form($db);
55
56$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
57llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-index');
58
59
60print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
61
62
63if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
64 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $conf->global->MAIN_MOTD_SETUPPAGE);
65 if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
66 $i = 0;
67 $reg = array();
68 while (preg_match('/__\‍(([a-zA-Z|@]+)\‍)__/i', $conf->global->MAIN_MOTD_SETUPPAGE, $reg) && $i < 100) {
69 $tmp = explode('|', $reg[1]);
70 if (!empty($tmp[1])) {
71 $langs->load($tmp[1]);
72 }
73 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\‍('.preg_quote($reg[1]).'\‍)__/i', $langs->trans($tmp[0]), $conf->global->MAIN_MOTD_SETUPPAGE);
74 $i++;
75 }
76
77 print "\n<!-- Start of welcome text for setup page -->\n";
78 print '<table width="100%" class="notopnoleftnoright"><tr><td>';
79 print dol_htmlentitiesbr($conf->global->MAIN_MOTD_SETUPPAGE);
80 print '</td></tr></table><br>';
81 print "\n<!-- End of welcome text for setup page -->\n";
82 }
83}
84
85print '<span class="opacitymedium hideonsmartphone">';
86print $langs->trans("SetupDescription1").' ';
87print $langs->trans("AreaForAdminOnly").' ';
88print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
89print "<br><br>";
90print '</span>';
91
92print '<br>';
93
94// Show info setup company
95if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
96 $setupcompanynotcomplete = 1;
97}
98
99print '<section class="setupsection">';
100
101print img_picto('', 'company', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()), $langs->transnoentities("Setup"), $langs->transnoentities("MenuCompanySetup"));
102print '<br><br>';
103print $langs->trans("SetupDescription3b");
104if (!empty($setupcompanynotcomplete)) {
105 $langs->load("errors");
106 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
107 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'">'.$warnpicto.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
108}
109
110print '</section>';
111
112print '<br>';
113print '<br>';
114
115print '<section class="setupsection">';
116
117// Define $nbmodulesnotautoenabled - TODO This code is at different places
118$nbmodulesnotautoenabled = count($conf->modules);
119$listofmodulesautoenabled = array('agenda', 'fckeditor', 'export', 'import');
120foreach ($listofmodulesautoenabled as $moduleautoenable) {
121 if (in_array($moduleautoenable, $conf->modules)) {
122 $nbmodulesnotautoenabled--;
123 }
124}
125
126// Show info setup module
127print img_picto('', 'cog', 'class="paddingright valignmiddle double"').' '.$langs->trans("SetupDescriptionLink", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules"));
128print '<br><br>'.$langs->trans("SetupDescription4b");
129if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
130 $langs->load("errors");
131 $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
132 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
133}
134
135print '</section>';
136
137print '<br>';
138print '<br>';
139print '<br>';
140
141// Add hook to add information
142$parameters = array();
143$object = new stdClass();
144$reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
145print $hookmanager->resPrint;
146if (empty($reshook)) {
147 // Show into other
148 //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
149 print '<br class="hideonsmartphone">';
150
151 // Show logo
152 print '<div class="center"><div class="logo_setup"></div></div>';
153}
154
155// End of page
156llxFooter();
157$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:66
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:71
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.