dolibarr 18.0.6
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-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
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}
43/*
44if (!isModEnabled('accounting')) {
45 accessforbidden();
46}
47if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
48 accessforbidden();
49}
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
59/*
60 * Actions
61 */
62
63if (GETPOST('addbox')) {
64 // Add box (when submit is done from a form when ajax disabled)
65 require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
66 $zone = GETPOST('areacode', 'int');
67 $userid = GETPOST('userid', 'int');
68 $boxorder = GETPOST('boxorder', 'aZ09');
69 $boxorder .= GETPOST('boxcombo', 'aZ09');
70
71 $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
72 if ($result > 0) {
73 setEventMessages($langs->trans("BoxAdded"), null);
74 }
75}
76
77
78/*
79 * View
80 */
81
82$help_url = 'EN:Module_Double_Entry_Accounting#Setup';
83
84llxHeader('', $langs->trans("AccountancyArea"), $help_url);
85
86if (isModEnabled('accounting')) {
87 $step = 0;
88
89 $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
90
91 $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
92 $showtutorial = '';
93
94 if (!$helpisexpanded) {
95 $showtutorial = '<div align="right"><a href="#" id="show_hide">';
96 $showtutorial .= img_picto('', 'chevron-down');
97 $showtutorial .= ' '.$langs->trans("ShowTutorial");
98 $showtutorial .= '</a></div>';
99
100 $showtutorial .= '<script type="text/javascript">
101 jQuery(document).ready(function() {
102 jQuery("#show_hide").click(function () {
103 jQuery( "#idfaq" ).toggle({
104 duration: 400,
105 });
106 });
107 });
108 </script>';
109 }
110
111 print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
112
113 if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
114 print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
115 print "<br>";
116 }
117
118 print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
119 print "<br>\n";
120 print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
121 if ($user->hasRight('accounting', 'chartofaccount')) {
122 print '<br>';
123 print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
124 print '<hr>';
125 print "<br>\n";
126
127 // STEPS
128 $step++;
129 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
130 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>', $s);
131 print $s;
132 print "<br>\n";
133 $step++;
134 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
135 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
136 print $s;
137 print "<br>\n";
138 $step++;
139 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
140 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
141 print $s;
142 print "<br>\n";
143
144 print "<br>\n";
145 print $langs->trans("AccountancyAreaDescActionOnceBis");
146 print "<br>\n";
147 print "<br>\n";
148
149 $step++;
150 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
151 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
152 print $s;
153 print "<br>\n";
154
155 $step++;
156 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
157 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
158 print $s;
159 print "<br>\n";
160
161 $step++;
162 $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
163 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
164 $s = str_replace('{s}', $textlink, $s);
165 print $s;
166 print "<br>\n";
167
168 if (isModEnabled('tax')) {
169 $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
170 $step++;
171 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
172 $s = str_replace('{s}', $textlink, $s);
173 print $s;
174 print "<br>\n";
175 }
176 if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
177 $step++;
178 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
179 $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);
180 print $s;
181 print "<br>\n";
182 }
183
184 $step++;
185 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
186 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
187 print $s;
188 print "<br>\n";
189
190 print '<br>';
191 }
192
193 // Step A - E
194
195 print "<br>\n";
196 print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
197 print '<hr>';
198 print "<br>\n";
199 $step = 0;
200
201 $langs->loadLangs(array('bills', 'trips'));
202
203 $step++;
204 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
205 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
206 print $s;
207 print "<br>\n";
208
209 $step++;
210 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
211 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
212 print $s;
213 print "<br>\n";
214
215 if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
216 $step++;
217 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
218 $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
219 print $s;
220 print "<br>\n";
221 }
222
223 $step++;
224 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
225 print $s;
226 print "<br>\n";
227
228 $step++;
229 $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
230 print $s;
231 print "<br>\n";
232
233 print '<br>';
234
235 print '</div>';
236
237 print '<div class="clearboth"></div>';
238
239 print '<div class="fichecenter fichecenterbis">';
240
241 /*
242 * Show boxes
243 */
244 $boxlist = '<div class="twocolumns">';
245
246 $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
247
248 $boxlist .= $resultboxes['boxlista'];
249
250 $boxlist .= '</div>';
251
252 $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
253
254 $boxlist .= $resultboxes['boxlistb'];
255
256 $boxlist .= '</div>';
257 $boxlist .= "\n";
258
259 $boxlist .= '</div>';
260
261
262 print $boxlist;
263
264 print '</div>';
265} elseif (isModEnabled('compta')) {
266 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
267
268 print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
269 print "<br>";
270} else {
271 // This case can happen mode no accounting module is on but module "intracommreport" is on
272 print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
273}
274
275// End of page
276llxFooter();
277$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:56
llxFooter()
Empty footer.
Definition wrapper.php:70
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.
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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.