dolibarr 24.0.0-beta
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-2024 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
65if (GETPOST('addbox')) {
66 // Add box (when submit is done from a form when ajax disabled)
67 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
68 $zone = GETPOSTINT('areacode');
69 $userid = GETPOSTINT('userid');
70 $boxorder = GETPOST('boxorder', 'aZ09');
71 $boxorder .= GETPOST('boxcombo', 'aZ09');
72
73 $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
74 if ($result > 0) {
75 setEventMessages($langs->trans("BoxAdded"), null);
76 }
77}
78
79
80/*
81 * View
82 */
83
84$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
85
86llxHeader('', $langs->trans("AccountancyArea"), $help_url, '', 0, 0, '', '', '', 'mod-accountancy page-index');
87
88$resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
89
90$boxlist = '';
91$boxlist .= '<div class="twocolumns">';
92$boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
93$boxlist .= $resultboxes['boxlista'];
94$boxlist .= '</div>';
95$boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
96$boxlist .= $resultboxes['boxlistb'];
97$boxlist .= '</div>';
98$boxlist .= "\n";
99$boxlist .= '</div>';
100
101if (isModEnabled('accounting')) {
102 $step = 0;
103
104 $helpisexpanded = GETPOSTINT('showtuto');
105 $showtutorial = '';
106
107 if (!$helpisexpanded) {
108 $showtutorial = '<div class="right"><a href="#" id="show_hide">';
109 $showtutorial .= img_picto('', 'chevron-down', 'class="show_hide_picto pictofixedwidth"');
110 $showtutorial .= $langs->trans("ShowTutorial");
111 $showtutorial .= '</a></div>';
112
113 $showtutorial .= '<script type="text/javascript">
114 jQuery(document).ready(function() {
115 jQuery("#show_hide").click(function () {
116 console.log("We click on show-hide");
117 if ($(".idfaq2").is(":hidden")) {
118 jQuery( ".idfaq2" ).show();
119 jQuery( ".show_hide_picto" ).removeClass("fa-chevron-up").addClass("fa-chevron-down");
120 } else {
121 jQuery( ".idfaq2" ).hide();
122 jQuery( ".show_hide_picto" ).removeClass("fa-chevron-down").addClass("fa-chevron-up");
123 }
124 jQuery( ".idfaq" ).toggle({
125 duration: 400,
126 });
127 });
128 });
129 </script>';
130 }
131
132 print load_fiche_titre($langs->trans("AccountancyArea"), empty($resultboxes['selectboxlist']) ? '' : $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
133
134 /*
135 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
136 $messagewarning = $langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices");
137 $messagewarning .= ' '.$langs->trans("WarningExperimentalFeatureInvoiceSituationNeedToUpgradeToProgressiveMode", 'https://partners.dolibarr.org');
138 print info_admin($messagewarning);
139 print "<br>";
140 }
141 */
142
143 if (!$helpisexpanded && empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])) {
144 print '<div class="opacitymedium idfaq2"><br>'.$langs->trans("ClickOnUseTutorialForHelp", $langs->transnoentities("ShowTutorial"))."</div>\n";
145 }
146
147 print '<div class="'.($helpisexpanded ? '' : 'hideobject').' idfaq">'; // hideobject is to start hidden
148 print "<br>\n";
149 //print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
150 if ($user->hasRight('accounting', 'chartofaccount')) {
151 //print '<br>';
152 //print '<br>';
153 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '', 0, '', 'nomarginbottom')."\n";
154
155 print '<div class="info">';
156
157 // STEPS
158 $step++;
159 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
160 $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);
161 print $s;
162 print "<br>\n";
163 $step++;
164 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
165 $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);
166 print $s;
167 print "<br>\n";
168 $step++;
169 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
170 $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);
171 print $s;
172 if ($pcgver > 0) {
173 $pcgversion = '';
174 $pcglabel = '';
175
176 $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
177 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
178 $sql .= " WHERE a.rowid = ".((int) $pcgver);
179
180 $resqlchart = $db->query($sql);
181 if ($resqlchart) {
182 $obj = $db->fetch_object($resqlchart);
183 if ($obj) {
184 $pcgversion = $obj->pcg_version;
185 $pcglabel = $obj->label;
186 }
187 } else {
189 }
190 print ' <span class="opacitymedium">('.$langs->trans("CurrentChartOfAccount").': '.$pcgversion.')</span>';
191 }
192 print "<br>\n";
193
194 // Fiscal period
195 if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
196 $step++;
197 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
198 $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);
199 print $s;
200 print "<br>\n";
201 }
202 print '</div>';
203
204
205 print "<br>\n";
206 print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescActionOnceBis").'</span>';
207 print "<br>\n";
208
209 print '<div class="info">';
210
211 $step++;
212 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
213 $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);
214 print $s;
215 print "<br>\n";
216
217 $step++;
218 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
219 $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);
220 print $s;
221 print "<br>\n";
222
223 $step++;
224 $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>';
225 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
226 $s = str_replace('{s}', $textlink, $s);
227 print $s;
228 print "<br>\n";
229
230 if (isModEnabled('tax')) {
231 $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>';
232 $step++;
233 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
234 $s = str_replace('{s}', $textlink, $s);
235 print $s;
236 print "<br>\n";
237 }
238 if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
239 $step++;
240 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
241 $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);
242 print $s;
243 print "<br>\n";
244 }
245
246 $step++;
247 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
248 $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);
249 print $s;
250 print "<br>\n";
251
252 print '</div>';
253
254 print '<br>';
255 }
256
257 // Step A - E
258
259 print "<br>\n";
260 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '', 0, '', 'nomarginbottom')."\n";
261
262 $step = 0;
263
264 $langs->loadLangs(array('bills', 'trips'));
265
266 print '<div class="info">';
267
268 $step++;
269 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
270 $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);
271 print $s;
272 print "<br>\n";
273
274 $step++;
275 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
276 $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);
277 print $s;
278 print "<br>\n";
279
280 if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
281 $step++;
282 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
283 $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);
284 print $s;
285 print "<br>\n";
286 }
287
288 $step++;
289 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
290 print $s;
291 print "<br>\n";
292
293 $step++;
294 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
295 print $s;
296
297 $step++;
298 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescClosePeriod", chr(64 + $step))."<br>\n";
299 print $s;
300
301 print '</div>';
302
303
304 if (!empty($resultboxes['boxlista']) || !empty($resultboxes['boxlistb'])) {
305 print "<br>\n";
306 print '<br>';
307 }
308
309 print '</div>';
310
311 print '<div class="clearboth"></div>';
312} elseif (isModEnabled('comptabilite')) {
313 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
314
315 print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
316 print "<br>";
317} else {
318 // This case can happen when no accounting module is on but module "intracommreport" is on
319 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
320}
321
322/*
323 * Show boxes
324 */
325print $boxlist;
326
327// End of page
328llxFooter();
329$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...
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
global $mysoc
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.