dolibarr  20.0.0-alpha
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
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 if (!isModEnabled('comptabilite') && !isModEnabled('accounting') && !isModEnabled('asset') && !isModEnabled('intracommreport')) {
45 }
46 if (!$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 
57 if (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 = GETPOSTINT('areacode');
61  $userid = GETPOSTINT('userid');
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 
78 llxHeader('', $langs->trans("AccountancyArea"), $help_url);
79 
80 $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
81 $boxlist = '<div class="twocolumns">';
82 $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
83 $boxlist .= $resultboxes['boxlista'];
84 $boxlist .= '</div>';
85 $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
86 $boxlist .= $resultboxes['boxlistb'];
87 $boxlist .= '</div>';
88 $boxlist .= "\n";
89 $boxlist .= '</div>';
90 
91 
92 if (isModEnabled('accounting')) {
93  $step = 0;
94 
95  $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
96  $showtutorial = '';
97 
98  if (!$helpisexpanded) {
99  $showtutorial = '<div class="right"><a href="#" id="show_hide">';
100  $showtutorial .= img_picto('', 'chevron-down');
101  $showtutorial .= ' '.$langs->trans("ShowTutorial");
102  $showtutorial .= '</a></div>';
103 
104  $showtutorial .= '<script type="text/javascript">
105  jQuery(document).ready(function() {
106  jQuery("#show_hide").click(function () {
107  jQuery( "#idfaq" ).toggle({
108  duration: 400,
109  });
110  });
111  });
112  </script>';
113  }
114 
115  print load_fiche_titre($langs->trans("AccountancyArea"), empty($resultboxes['selectboxlist']) ? '' : $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial);
116 
117  if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) {
118  print info_admin($langs->trans("SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices"));
119  print "<br>";
120  }
121 
122  print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
123  print "<br>\n";
124  print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
125  if ($user->hasRight('accounting', 'chartofaccount')) {
126  print '<br>';
127  print load_fiche_titre('<span class="fa fa-calendar"></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" target="setupaccountancy"><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?search_country_id='.$mysoc->country_id.'" target="setupaccountancy"><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" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
145  print $s;
146  if ($pcgver > 0) {
147  $pcgversion = '';
148  $pcglabel = '';
149 
150  $sql = "SELECT a.rowid, a.pcg_version, a.label, a.active";
151  $sql .= " FROM ".MAIN_DB_PREFIX."accounting_system as a";
152  $sql .= " WHERE a.rowid = ".((int) $pcgver);
153 
154  $resqlchart = $db->query($sql);
155  if ($resqlchart) {
156  $obj = $db->fetch_object($resqlchart);
157  if ($obj) {
158  $pcgversion = $obj->pcg_version;
159  $pcglabel = $obj->label;
160  }
161  } else {
162  dol_print_error($db);
163  }
164  print ' <span class="opacitymedium">('.$langs->trans("CurrentChartOfAccount").': '.$pcgversion.')</span>';
165  }
166  print "<br>\n";
167 
168  print "<br>\n";
169  print $langs->trans("AccountancyAreaDescActionOnceBis");
170  print "<br>\n";
171  print "<br>\n";
172 
173  if (getDolGlobalString('ACCOUNTANCY_FISCAL_PERIOD_MODE') != 'blockedonclosed') {
174  $step++;
175  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescFiscalPeriod", $step, '{s}');
176  $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);
177  print $s;
178  print "<br>\n";
179  }
180 
181  $step++;
182  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
183  $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);
184  print $s;
185  print "<br>\n";
186 
187  $step++;
188  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
189  $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);
190  print $s;
191  print "<br>\n";
192 
193  $step++;
194  $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
195  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
196  $s = str_replace('{s}', $textlink, $s);
197  print $s;
198  print "<br>\n";
199 
200  if (isModEnabled('tax')) {
201  $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy" target="setupaccountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
202  $step++;
203  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
204  $s = str_replace('{s}', $textlink, $s);
205  print $s;
206  print "<br>\n";
207  }
208  if (isModEnabled('expensereport')) { // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
209  $step++;
210  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
211  $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);
212  print $s;
213  print "<br>\n";
214  }
215 
216  $step++;
217  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
218  $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);
219  print $s;
220  print "<br>\n";
221 
222  print '<br>';
223  }
224 
225  // Step A - E
226 
227  print "<br>\n";
228  print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
229  print '<hr>';
230  print "<br>\n";
231  $step = 0;
232 
233  $langs->loadLangs(array('bills', 'trips'));
234 
235  $step++;
236  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
237  $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);
238  print $s;
239  print "<br>\n";
240 
241  $step++;
242  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
243  $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);
244  print $s;
245  print "<br>\n";
246 
247  if (isModEnabled('expensereport') || isModEnabled('deplacement')) {
248  $step++;
249  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
250  $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);
251  print $s;
252  print "<br>\n";
253  }
254 
255  $step++;
256  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
257  print $s;
258  print "<br>\n";
259 
260  $step++;
261  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
262  print $s;
263 
264  $step++;
265  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescClosePeriod", chr(64 + $step))."<br>\n";
266  print $s;
267 
268  print "<br>\n";
269 
270 
271  print '<br>';
272 
273  print '</div>';
274 
275  print '<div class="clearboth"></div>';
276 } elseif (isModEnabled('comptabilite')) {
277  print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
278 
279  print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span>\n";
280  print "<br>";
281 } else {
282  // This case can happen mode no accounting module is on but module "intracommreport" is on
283  print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
284 }
285 
286 /*
287  * Show boxes
288  */
289 print $boxlist;
290 
291 // End of page
292 llxFooter();
293 $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.
if(isModEnabled('invoice') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&!getDolGlobalString('MAIN_USE_NEW_SUPPLIERMOD') && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') && $user->hasRight('tax', 'charges', 'lire')) if(isModEnabled('invoice') &&isModEnabled('order') && $user->hasRight("commande", "lire") &&!getDolGlobalString('WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER')) $sql
Social contributions to pay.
Definition: index.php:744
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
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.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information in HTML for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
llxFooter()
Footer empty.
Definition: index.php:72
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:64
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.