dolibarr 25.0.0-alpha
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2016-2020 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2016-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
4 * Copyright (C) 2019-2026 Frédéric France <frederic.france@free.fr>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27// Load Dolibarr environment
28require '../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "banks", "admin", "dict"));
43
44// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
45$hookmanager->initHooks(array('accountancyindex'));
46
47// Security check
48if ($user->socid > 0) {
50}
51if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
53}
54if (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounting', 'comptarapport', 'lire') && !$user->hasRight('accounting', 'mouvements', 'lire') && !$user->hasRight('asset', 'read') && !$user->hasRight('intracommreport', 'read')) {
56}
57
58$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
59
60
61/*
62 * Actions
63 */
64
65// Add box (when submit is done from a form when ajax disabled)
66include DOL_DOCUMENT_ROOT.'/core/actions_addbox.inc.php';
67
68
69/*
70 * View
71 */
72
73$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
74
75llxHeader('', $langs->trans("AccountancyArea"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-index');
76
77$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
78
79$boxlist = '';
80$boxlist .= '<div class="twocolumns">';
81$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
82$boxlist .= $resultboxes['boxlista'];
83$boxlist .= '</div>';
84$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
85$boxlist .= $resultboxes['boxlistb'];
86$boxlist .= '</div>';
87$boxlist .= "\n";
88$boxlist .= '</div>';
89
90if (isModEnabled('accounting')) {
91 $step = 0;
92
93 $helpisexpanded = GETPOSTINT('showtuto');
94 $showtutorial = '';
95
96 if (!$helpisexpanded) {
97 $showtutorial = '<div class="right"><a href="#" id="show_hide">';
98 $showtutorial .= img_picto('', 'chevron-down', 'class="show_hide_picto pictofixedwidth"');
99 $showtutorial .= $langs->trans("ShowTutorial");
100 $showtutorial .= '</a></div>';
101
102 $showtutorial .= '<script type="text/javascript">
103 jQuery(document).ready(function() {
104 jQuery("#show_hide").click(function () {
105 console.log("We click on show-hide");
106 if ($(".idfaq2").is(":hidden")) {
107 jQuery( ".idfaq2" ).show();
108 jQuery( ".show_hide_picto" ).removeClass("fa-chevron-up").addClass("fa-chevron-down");
109 } else {
110 jQuery( ".idfaq2" ).hide();
111 jQuery( ".show_hide_picto" ).removeClass("fa-chevron-down").addClass("fa-chevron-up");
112 }
113 jQuery( ".idfaq" ).toggle({
114 duration: 400,
115 });
116 });
117 });
118 </script>';
119 }
120
121 print load_fiche_titre($langs->trans("AccountancyArea"), empty($resultboxes['selectboxlist']) ? '' : $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
122
123 /*
124 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
125 $messagewarning = $langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices");
126 $messagewarning .= ' '.$langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org');
127 print info_admin($messagewarning);
128 print "<br>";
129 }
130 */
131
132 if (!$helpisexpanded && empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])) {
133 print '<div class="opacitymedium idfaq2"><br>'.$langs->trans("ClickOnUseTutorialForHelp", $langs->transnoentities("ShowTutorial"))."</div>\n";
134 }
135
136 print '<div class="'.($helpisexpanded ? '' : 'hideobject').' idfaq">'; // hideobject is to start hidden
137 print "<br>\n";
138 //print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
139 if ($user->hasRight('accounting', 'chartofaccount')) {
140 //print '<br>';
141 //print '<br>';
142 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '', 0, '', 'nomarginbottom')."\n";
143
144 print '<div class="info">';
145
146 // STEPS
147 $step++;
148 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
149 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35&&leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
150 print $s;
151 print "<br>\n";
152 $step++;
153 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
154 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php?search_country_id='.$mysoc->country_id.'&leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
155 print $s;
156 print "<br>\n";
157 $step++;
158 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
159 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php?leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
160 print $s;
161 if ($pcgver > 0) {
162 $pcgversion = '';
163 $pcglabel = '';
164
165 $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
166 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
167 $sql .= " WHERE a.rowid = ".((int) $pcgver);
168
169 $resqlchart = $db->query($sql);
170 if ($resqlchart) {
171 $obj = $db->fetch_object($resqlchart);
172 if ($obj) {
173 $pcgversion = $obj->pcg_version;
174 $pcglabel = $obj->label;
175 }
176 } else {
177 dol_print_error($db);
178 }
179 print ' <span class="opacitymedium">('.$langs->trans("CurrentChartOfAccount").': '.$pcgversion.')</span>';
180 }
181 print "<br>\n";
182
183 // Fiscal period
184 if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
185 $step++;
186 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
187 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/fiscalyear.php?leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'</strong></a>', $s);
188 print $s;
189 print "<br>\n";
190 }
191 print '</div>';
192
193
194 print "<br>\n";
195 print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescActionOnceBis").'</span>';
196 print "<br>\n";
197
198 print '<div class="info">';
199
200 $step++;
201 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
202 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php?leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
203 print $s;
204 print "<br>\n";
205
206 $step++;
207 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
208 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php?leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
209 print $s;
210 print "<br>\n";
211
212 $step++;
213 $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy&leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
214 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
215 $s = str_replace('{s}', $textlink, $s);
216 print $s;
217 print "<br>\n";
218
219 if (isModEnabled('tax')) {
220 $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy&leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
221 $step++;
222 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
223 $s = str_replace('{s}', $textlink, $s);
224 print $s;
225 print "<br>\n";
226 }
227 if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
228 $step++;
229 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
230 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy&leftmenu=accountancy_admin"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
231 print $s;
232 print "<br>\n";
233 }
234
235 $step++;
236 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
237 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php?leftmenu=accountancy_admin" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
238 print $s;
239 print "<br>\n";
240
241 print '</div>';
242
243 print '<br>';
244 }
245
246 // Step A - E
247
248 print "<br>\n";
249 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '', 0, '', 'nomarginbottom')."\n";
250
251 $step = 0;
252
253 $langs->loadLangs(array('bills', 'trips'));
254
255 print '<div class="neutral">';
256
257 $step++;
258 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
259 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
260 print $s;
261 print "<br>\n";
262
263 $step++;
264 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
265 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
266 print $s;
267 print "<br>\n";
268
269 if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
270 $step++;
271 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
272 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
273 print $s;
274 print "<br>\n";
275 }
276
277 $step++;
278 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
279 print $s;
280 print "<br>\n";
281
282 $step++;
283 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
284 print $s;
285
286 $step++;
287 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescClosePeriod", chr(64 + $step))."<br>\n";
288 print $s;
289
290 print '</div>';
291
292
293 if (!empty($resultboxes['boxlista']) || !empty($resultboxes['boxlistb'])) {
294 print "<br>\n";
295 print '<br>';
296 }
297
298 print '</div>';
299
300 print '<div class="clearboth"></div>';
301} elseif (isModEnabled('comptabilite')) {
302 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
303
304 print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
305 print "<br>";
306} else {
307 // This case can happen when no accounting module is on but module "intracommreport" is on
308 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
309}
310
311/*
312 * Show boxes
313 */
314print $boxlist;
315
316// End of page
317llxFooter();
318$db->close();
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
static getBoxesArea($user, $areacode)
Get array with HTML tabs with widgets/boxes of a particular area including personalized choices of us...
global $mysoc
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.