dolibarr  16.0.5
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 
26 require '../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array("compta", "bills", "other", "accountancy", "loans", "banks", "admin", "dict"));
33 
34 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
35 $hookmanager->initHooks(array('accountancyindex'));
36 
37 // Security check
38 if ($user->socid > 0) {
40 }
41 /*
42 if (!isModEnabled('accounting')) {
43  accessforbidden();
44 }
45 if (empty($user->rights->accounting->mouvements->lire)) {
46  accessforbidden();
47 }
48 */
49 if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
51 }
52 if (empty($user->rights->compta->resultat->lire) && empty($user->rights->accounting->comptarapport->lire) && empty($user->rights->accounting->mouvements->lire) && empty($user->rights->asset->read) && empty($user->rights->intracommreport->read)) {
54 }
55 
56 
57 /*
58  * Actions
59  */
60 
61 if (GETPOST('addbox')) {
62  // Add box (when submit is done from a form when ajax disabled)
63  require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
64  $zone = GETPOST('areacode', 'int');
65  $userid = GETPOST('userid', 'int');
66  $boxorder = GETPOST('boxorder', 'aZ09');
67  $boxorder .= GETPOST('boxcombo', 'aZ09');
68 
69  $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
70  if ($result > 0) {
71  setEventMessages($langs->trans("BoxAdded"), null);
72  }
73 }
74 
75 
76 /*
77  * View
78  */
79 
80 $help_url = '';
81 
82 llxHeader('', $langs->trans("AccountancyArea"), $help_url);
83 
84 if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
85  print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
86 
87  print '<span class="opacitymedium">'.$langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices")."</span>\n";
88  print "<br>";
89 } elseif (isModEnabled('accounting')) {
90  $step = 0;
91 
92  $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
93 
94  $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
95  $showtutorial = '';
96 
97  if (!$helpisexpanded) {
98  $showtutorial = '<div align="right"><a href="#" id="show_hide">';
99  $showtutorial .= img_picto('', 'chevron-down');
100  $showtutorial .= ' '.$langs->trans("ShowTutorial");
101  $showtutorial .= '</a></div>';
102 
103  $showtutorial .= '<script type="text/javascript">
104  jQuery(document).ready(function() {
105  jQuery("#show_hide").click(function () {
106  jQuery( "#idfaq" ).toggle({
107  duration: 400,
108  });
109  });
110  });
111  </script>';
112  }
113 
114  print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
115 
116  if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_SITUATION == 1) {
117  print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
118  print "<br>";
119  }
120 
121  print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
122  print "<br>\n";
123  print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
124  if (!empty($user->rights->accounting->chartofaccount)) {
125  print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
126  print '<hr>';
127  print "<br>\n";
128 
129  // STEPS
130  $step++;
131  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
132  $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);
133  print $s;
134  print "<br>\n";
135  $step++;
136  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
137  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
138  print $s;
139  print "<br>\n";
140  $step++;
141  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
142  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
143  print $s;
144  print "<br>\n";
145 
146  print "<br>\n";
147  print $langs->trans("AccountancyAreaDescActionOnceBis");
148  print "<br>\n";
149  print "<br>\n";
150 
151  $step++;
152  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
153  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
154  print $s;
155  print "<br>\n";
156 
157  $step++;
158  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
159  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
160  print $s;
161  print "<br>\n";
162 
163  $step++;
164  $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
165  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
166  $s = str_replace('{s}', $textlink, $s);
167  print $s;
168  print "<br>\n";
169 
170  if (isModEnabled('tax')) {
171  $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
172  $step++;
173  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
174  $s = str_replace('{s}', $textlink, $s);
175  print $s;
176  print "<br>\n";
177  }
178  if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
179  $step++;
180  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
181  $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);
182  print $s;
183  print "<br>\n";
184  }
185 
186  $step++;
187  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
188  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
189  print $s;
190  print "<br>\n";
191 
192  print '<br>';
193  }
194 
195  // Step A - E
196 
197  print "<br>\n";
198  print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
199  print '<hr>';
200  print "<br>\n";
201  $step = 0;
202 
203  $langs->loadLangs(array('bills', 'trips'));
204 
205  $step++;
206  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
207  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
208  print $s;
209  print "<br>\n";
210 
211  $step++;
212  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
213  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
214  print $s;
215  print "<br>\n";
216 
217  if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
218  $step++;
219  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
220  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
221  print $s;
222  print "<br>\n";
223  }
224 
225  $step++;
226  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
227  print $s;
228  print "<br>\n";
229 
230  $step++;
231  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
232  print $s;
233  print "<br>\n";
234 
235  print '<br>';
236 
237  print '</div>';
238 
239  print '<div class="clearboth"></div>';
240 
241  print '<div class="fichecenter fichecenterbis">';
242 
243  /*
244  * Show boxes
245  */
246  $boxlist = '<div class="twocolumns">';
247 
248  $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
249 
250  $boxlist .= $resultboxes['boxlista'];
251 
252  $boxlist .= '</div>';
253 
254  $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
255 
256  $boxlist .= $resultboxes['boxlistb'];
257 
258  $boxlist .= '</div>';
259  $boxlist .= "\n";
260 
261  $boxlist .= '</div>';
262 
263 
264  print $boxlist;
265 
266  print '</div>';
267 } else {
268  print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
269 
270  print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
271  print "<br>";
272 }
273 
274 // End of page
275 llxFooter();
276 $db->close();
load_fiche_titre
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
Definition: functions.lib.php:5204
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
InfoBox\saveboxorder
static saveboxorder($dbs, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
Definition: infobox.class.php:224
$help_url
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Definition: agenda.php:116
img_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)
Definition: functions.lib.php:3880
llxFooter
llxFooter()
Footer empty.
Definition: index.php:71
llxHeader
if(!defined('NOTOKENRENEWAL')) if(!defined('NOLOGIN')) if(!defined('NOCSRFCHECK')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) if(!defined('NOIPCHECK')) if(!defined('NOBROWSERNOTIF')) llxHeader()
Header empty.
Definition: index.php:63
info_admin
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
Definition: functions.lib.php:4800
isModEnabled
isModEnabled($module)
Is Dolibarr module enabled.
Definition: functions.lib.php:105
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
accessforbidden
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
Definition: security.lib.php:933
FormOther\getBoxesArea
static getBoxesArea($user, $areacode)
Get array with HTML tabs with boxes of a particular area including personalized choices of user.
Definition: html.formother.class.php:1173