dolibarr 23.0.3
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-2025 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';
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$wikihelp = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
55llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-index');
56
57
58print load_fiche_titre($langs->trans("SetupArea"), '', 'tools');
59
60// Show
61if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
62 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
63 if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
64 $i = 0;
65 $reg = array();
66 while (preg_match('/__\‍(([a-zA-Z|@]+)\‍)__/i', getDolGlobalString('MAIN_MOTD_SETUPPAGE'), $reg) && $i < 100) {
67 $tmp = explode('|', $reg[1]);
68 if (!empty($tmp[1])) {
69 $langs->load($tmp[1]);
70 }
71 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/__\‍('.preg_quote($reg[1], '/').'\‍)__/i', $langs->trans($tmp[0]), getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
72 $i++;
73 }
74
75 print "\n<!-- Start of welcome text for setup page -->\n";
76 print '<table class="centpercent notopnoleftnoright"><tr><td>';
77 print dol_htmlentitiesbr(getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
78 print '</td></tr></table><br>';
79 print "\n<!-- End of welcome text for setup page -->\n";
80 }
81}
82
83print '<span class="opacitymedium hideonsmartphone">';
84print $langs->trans("SetupDescription1").'<br>';
85
86if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
87 $setupcompanynotcomplete = 1;
88} else {
89 $setupcompanynotcomplete = 0;
90}
91
92if ($setupcompanynotcomplete) {
93 print $langs->trans("SetupDescription2", $langs->transnoentities("MenuCompanySetup"), $langs->transnoentities("Modules"));
94}
95
96print "<br><br>";
97print '</span>';
98
99
100
101// Show info depending on country if defined
102$constkey = 'MAIN_INFO_SETUP_FOR_COUNTRY_'.$mysoc->country_code;
103//$conf->global->$constkey = 'rrr';
104if (getDolGlobalString($constkey)) {
105 $langs->load("errors");
106 $warnpicto = img_warning('', 'style="padding-right: 6px;"');
107 print '<div class="warning">'.$warnpicto.$langs->trans(getDolGlobalString($constkey)).'</div>';
108}
109
110
111print '<br>';
112
113
114// Show info setup company
115
116print '<section class="setupsection setupcompany cursorpointer">';
117
118print img_picto('', 'company', 'class="paddingright valignmiddle double"');
119print ' ';
120print '<a class="nounderlineimp fontsize-1-1" href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()).'">'.$langs->transnoentities("Setup").' - '.$langs->transnoentities("MenuCompanySetup").'</a>';
121print '<br><br>';
122print $langs->trans("SetupDescription3b");
123if (!empty($setupcompanynotcomplete)) {
124 $langs->load("errors");
125 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
126 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home&action=edit&token='.newToken().'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
127}
128
129print '</a>';
130print '</section>';
131
132print '<br>';
133print '<br>';
134
135
136// Show info setup modules
137
138print '<section class="setupsection setupmodules cursorpointer">';
139
140// Define $nbmodulesnotautoenabled - TODO This code is at different places
141$nbmodulesnotautoenabled = count($conf->modules);
142$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import'); // All modules with ->enabled_bydefault to true (so enabled during install)
143foreach ($listofmodulesautoenabled as $moduleautoenable) {
144 if (in_array($moduleautoenable, $conf->modules)) {
145 $nbmodulesnotautoenabled--;
146 }
147}
148
149// Show info setup module
150print img_picto('', 'cog', 'class="paddingright valignmiddle double"');
151print ' ';
152print '<a class="nounderlineimp fontsize-1-1" href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules").'</a>';
153print '<br><br>'.$langs->trans("SetupDescription4b");
154if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
155 $langs->load("errors");
156 $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
157 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
158}
159
160print '</section>';
161
162print '<br>';
163print '<br>';
164print '<br>';
165
166
167print '<script>
168 $(document).ready(function(){
169 $(".setupcompany").click(function() {
170 event.preventDefault();
171 console.log("we click on setupcompany");
172 window.location.href = "'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'";
173 });
174 $(".setupmodules").click(function() {
175 event.preventDefault();
176 console.log("we click on setupmodules");
177 window.location.href = "'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home";
178 });
179 });
180</script>';
181
182// Add hook to add information
183$parameters = array();
184$object = new stdClass();
185$reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
186print $hookmanager->resPrint;
187if (empty($reshook)) {
188 // Show into other
189 //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
190 print '<br class="hideonsmartphone">';
191
192 // Show logo
193 print '<div class="center"><div class="logo_setup"></div></div>';
194}
195
196// End of page
197llxFooter();
198$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
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:73
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.