dolibarr 22.0.5
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';
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// Show
63if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
64 $conf->global->MAIN_MOTD_SETUPPAGE = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
65 if (getDolGlobalString('MAIN_MOTD_SETUPPAGE')) {
66 $i = 0;
67 $reg = array();
68 while (preg_match('/__\‍(([a-zA-Z|@]+)\‍)__/i', getDolGlobalString('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]), getDolGlobalString('MAIN_MOTD_SETUPPAGE'));
74 $i++;
75 }
76
77 print "\n<!-- Start of welcome text for setup page -->\n";
78 print '<table class="centpercent notopnoleftnoright"><tr><td>';
79 print dol_htmlentitiesbr(getDolGlobalString('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
92
93// Show info depending on country if defined
94$constkey = 'MAIN_INFO_SETUP_FOR_COUNTRY_'.$mysoc->country_code;
95//$conf->global->$constkey = 'rrr';
96if (getDolGlobalString($constkey)) {
97 $langs->load("errors");
98 $warnpicto = img_warning('', 'style="padding-right: 6px;"');
99 print '<div class="warning">'.$warnpicto.$langs->trans(getDolGlobalString($constkey)).'</div>';
100}
101
102
103print '<br>';
104
105
106// Show info setup company
107
108if (!getDolGlobalString('MAIN_INFO_SOCIETE_NOM') || !getDolGlobalString('MAIN_INFO_SOCIETE_COUNTRY') || getDolGlobalString('MAIN_INFO_SOCIETE_SETUP_TODO_WARNING')) {
109 $setupcompanynotcomplete = 1;
110}
111
112print '<section class="setupsection setupcompany cursorpointer">';
113
114print img_picto('', 'company', 'class="paddingright valignmiddle double"');
115print ' ';
116print '<a class="nounderlineimp" href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit&token='.newToken()).'">'.$langs->transnoentities("Setup").' - '.$langs->transnoentities("MenuCompanySetup").'</a>';
117print '<br><br>';
118print $langs->trans("SetupDescription3b");
119if (!empty($setupcompanynotcomplete)) {
120 $langs->load("errors");
121 $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete"), 'style="padding-right: 6px;"');
122 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>';
123}
124
125print '</a>';
126print '</section>';
127
128print '<br>';
129print '<br>';
130
131
132// Show info setup modules
133
134print '<section class="setupsection setupmodules cursorpointer">';
135
136// Define $nbmodulesnotautoenabled - TODO This code is at different places
137$nbmodulesnotautoenabled = count($conf->modules);
138$listofmodulesautoenabled = array('user', 'agenda', 'fckeditor', 'export', 'import'); // All modules with ->enabled_bydefault to true (so enabled during install)
139foreach ($listofmodulesautoenabled as $moduleautoenable) {
140 if (in_array($moduleautoenable, $conf->modules)) {
141 $nbmodulesnotautoenabled--;
142 }
143}
144
145// Show info setup module
146print img_picto('', 'cog', 'class="paddingright valignmiddle double"');
147print ' ';
148print '<a class="nounderlineimp" href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules").'</a>';
149print '<br><br>'.$langs->trans("SetupDescription4b");
150if ($nbmodulesnotautoenabled < getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
151 $langs->load("errors");
152 $warnpicto = img_warning($langs->trans("WarningEnableYourModulesApplications"), 'style="padding-right: 6px;"');
153 print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home">'.$warnpicto.$langs->trans("WarningEnableYourModulesApplications").'</a></div>';
154}
155
156print '</section>';
157
158print '<br>';
159print '<br>';
160print '<br>';
161
162
163print '<script>
164 $(document).ready(function(){
165 $(".setupcompany").click(function() {
166 event.preventDefault();
167 console.log("we click on setupcompany");
168 window.location.href = "'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete) ? '' : '&action=edit').'";
169 });
170 $(".setupmodules").click(function() {
171 event.preventDefault();
172 console.log("we click on setupmodules");
173 window.location.href = "'.DOL_URL_ROOT.'/admin/modules.php?mainmenu=home";
174 });
175 });
176</script>';
177
178// Add hook to add information
179$parameters = array();
180$object = new stdClass();
181$reshook = $hookmanager->executeHooks('addHomeSetup', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
182print $hookmanager->resPrint;
183if (empty($reshook)) {
184 // Show into other
185 //print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("SetupDescription5")."</span><br>";
186 print '<br class="hideonsmartphone">';
187
188 // Show logo
189 print '<div class="center"><div class="logo_setup"></div></div>';
190}
191
192// End of page
193llxFooter();
194$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
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
Class to manage generation of HTML components Only common components must be here.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
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.