dolibarr 19.0.4
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-2023 Alexandre Spangaro <aspangaro@easya.solutions>
4 * Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.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';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
32
33// Load translation files required by the page
34$langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "banks", "admin", "dict"));
35
36// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
37$hookmanager->initHooks(array('accountancyindex'));
38
39// Security check
40if ($user->socid > 0) {
42}
43if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
45}
46if (!$user->hasRight('compta', 'resultat', 'lire') && !$user->hasRight('accounting', 'comptarapport', 'lire') && !$user->hasRight('accounting', 'mouvements', 'lire') && !$user->hasRight('asset', 'read') && !$user->hasRight('intracommreport', 'read')) {
48}
49
50$pcgver = getDolGlobalInt('CHARTOFACCOUNTS');
51
52
53/*
54 * Actions
55 */
56
57if (GETPOST('addbox')) {
58 // Add box (when submit is done from a form when ajax disabled)
59 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
60 $zone = GETPOST('areacode', 'int');
61 $userid = GETPOST('userid', 'int');
62 $boxorder = GETPOST('boxorder', 'aZ09');
63 $boxorder .= GETPOST('boxcombo', 'aZ09');
64
65 $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
66 if ($result > 0) {
67 setEventMessages($langs->trans("BoxAdded"), null);
68 }
69}
70
71
72/*
73 * View
74 */
75
76$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilit&eacute;_en_Partie_Double#Configuration';
77
78llxHeader('', $langs->trans("AccountancyArea"), $help_url);
79
80if (isModEnabled('accounting')) {
81 $step = 0;
82
83 $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
84
85 $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
86 $showtutorial = '';
87
88 if (!$helpisexpanded) {
89 $showtutorial = '<div class="right"><a href="#" id="show_hide">';
90 $showtutorial .= img_picto('', 'chevron-down');
91 $showtutorial .= ' '.$langs->trans("ShowTutorial");
92 $showtutorial .= '</a></div>';
93
94 $showtutorial .= '<script type="text/javascript">
95 jQuery(document).ready(function() {
96 jQuery("#show_hide").click(function () {
97 jQuery( "#idfaq" ).toggle({
98 duration: 400,
99 });
100 });
101 });
102 </script>';
103 }
104
105 print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
106
107 if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
108 print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
109 print "<br>";
110 }
111
112 print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
113 print "<br>\n";
114 print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
115 if ($user->hasRight('accounting', 'chartofaccount')) {
116 print '<br>';
117 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
118 print '<hr>';
119 print "<br>\n";
120
121 // STEPS
122 $step++;
123 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
124 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
125 print $s;
126 print "<br>\n";
127 $step++;
128 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
129 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php?search_country_id='.$mysoc->country_id.'" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
130 print $s;
131 print "<br>\n";
132 $step++;
133 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
134 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
135 print $s;
136 if ($pcgver > 0) {
137 $pcgversion = '';
138 $pcglabel = '';
139
140 $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
141 $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
142 $sql .= " WHERE a.rowid = ".((int) $pcgver);
143
144 $resqlchart = $db->query($sql);
145 if ($resqlchart) {
146 $obj = $db->fetch_object($resqlchart);
147 if ($obj) {
148 $pcgversion = $obj->pcg_version;
149 $pcglabel = $obj->label;
150 }
151 } else {
152 dol_print_error($db);
153 }
154 print ' <span class="opacitymedium">('.$langs->trans("CurrentChartOfAccount").': '.$pcgversion.')</span>';
155 }
156 print "<br>\n";
157
158 print "<br>\n";
159 print $langs->trans("AccountancyAreaDescActionOnceBis");
160 print "<br>\n";
161 print "<br>\n";
162
163 if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
164 $step++;
165 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
166 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/fiscalyear.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("FiscalPeriod").'</strong></a>', $s);
167 print $s;
168 print "<br>\n";
169 }
170
171 $step++;
172 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
173 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
174 print $s;
175 print "<br>\n";
176
177 $step++;
178 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
179 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
180 print $s;
181 print "<br>\n";
182
183 $step++;
184 $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
185 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
186 $s = str_replace('{s}', $textlink, $s);
187 print $s;
188 print "<br>\n";
189
190 if (isModEnabled('tax')) {
191 $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
192 $step++;
193 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
194 $s = str_replace('{s}', $textlink, $s);
195 print $s;
196 print "<br>\n";
197 }
198 if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
199 $step++;
200 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
201 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>', $s);
202 print $s;
203 print "<br>\n";
204 }
205
206 $step++;
207 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
208 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
209 print $s;
210 print "<br>\n";
211
212 print '<br>';
213 }
214
215 // Step A - E
216
217 print "<br>\n";
218 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
219 print '<hr>';
220 print "<br>\n";
221 $step = 0;
222
223 $langs->loadLangs(array('bills', 'trips'));
224
225 $step++;
226 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
227 $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);
228 print $s;
229 print "<br>\n";
230
231 $step++;
232 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
233 $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);
234 print $s;
235 print "<br>\n";
236
237 if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
238 $step++;
239 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
240 $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);
241 print $s;
242 print "<br>\n";
243 }
244
245 $step++;
246 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
247 print $s;
248 print "<br>\n";
249
250 $step++;
251 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
252 print $s;
253
254 $step++;
255 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescClosePeriod", chr(64 + $step))."<br>\n";
256 print $s;
257
258 print "<br>\n";
259
260
261 print '<br>';
262
263 print '</div>';
264
265 print '<div class="clearboth"></div>';
266
267 print '<div class="fichecenter fichecenterbis">';
268
269 /*
270 * Show boxes
271 */
272 $boxlist = '<div class="twocolumns">';
273
274 $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
275
276 $boxlist .= $resultboxes['boxlista'];
277
278 $boxlist .= '</div>';
279
280 $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
281
282 $boxlist .= $resultboxes['boxlistb'];
283
284 $boxlist .= '</div>';
285 $boxlist .= "\n";
286
287 $boxlist .= '</div>';
288
289
290 print $boxlist;
291
292 print '</div>';
293} elseif (isModEnabled('comptabilite')) {
294 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
295
296 print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
297 print "<br>";
298} else {
299 // This case can happen mode no accounting module is on but module "intracommreport" is on
300 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
301}
302
303// End of page
304llxFooter();
305$db->close();
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
static getBoxesArea($user, $areacode)
Get array with HTML tabs with boxes of a particular area including personalized choices of user.
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return 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.