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