dolibarr  13.0.2
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 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 // Security check
35 if ($user->socid > 0)
37 
38 // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array of hooks
39 $hookmanager->initHooks(array('accountancyindex'));
40 
41 
42 /*
43  * Actions
44  */
45 
46 if (GETPOST('addbox')) // Add box (when submit is done from a form when ajax disabled)
47 {
48  require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
49  $zone = GETPOST('areacode', 'aZ09');
50  $userid = GETPOST('userid', 'int');
51  $boxorder = GETPOST('boxorder', 'aZ09');
52  $boxorder .= GETPOST('boxcombo', 'aZ09');
53 
54  $result = InfoBox::saveboxorder($db, $zone, $boxorder, $userid);
55  if ($result > 0) setEventMessages($langs->trans("BoxAdded"), null);
56 }
57 
58 
59 /*
60  * View
61  */
62 
63 llxHeader('', $langs->trans("AccountancyArea"));
64 
65 if ($conf->accounting->enabled)
66 {
67  $step = 0;
68 
69  $resultboxes = FormOther::getBoxesArea($user, "27"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
70 
71  $helpisexpanded = empty($resultboxes['boxactivated']) || (empty($resultboxes['boxlista']) && empty($resultboxes['boxlistb'])); // If there is no widget, the tooltip help is expanded by default.
72  $showtutorial = '';
73 
74  if (!$helpisexpanded)
75  {
76  $showtutorial = '<div align="right"><a href="#" id="show_hide">';
77  $showtutorial .= img_picto('', 'chevron-down');
78  $showtutorial .= ' '.$langs->trans("ShowTutorial");
79  $showtutorial .= '</a></div>';
80 
81  $showtutorial .= '<script type="text/javascript" language="javascript">
82  jQuery(document).ready(function() {
83  jQuery("#show_hide").click(function () {
84  jQuery( "#idfaq" ).toggle({
85  duration: 400,
86  });
87  });
88  });
89  </script>';
90  }
91 
92 
93  print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial);
94 
95  print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
96  print "<br>\n";
97  print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
98  print "<br>\n"; print "<br>\n";
99 
100  print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
101  print '<hr>';
102  print "<br>\n";
103 
104  // STEPS
105  $step++;
106  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '{s}');
107  $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);
108  print $s;
109  print "<br>\n";
110  $step++;
111  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '{s}');
112  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>', $s);
113  print $s;
114  print "<br>\n";
115  $step++;
116  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '{s}');
117  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>', $s);
118  print $s;
119  print "<br>\n";
120 
121  print "<br>\n";
122  print $langs->trans("AccountancyAreaDescActionOnceBis");
123  print "<br>\n";
124  print "<br>\n";
125 
126  $step++;
127  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '{s}');
128  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>', $s);
129  print $s;
130  print "<br>\n";
131 
132  $step++;
133  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '{s}')."\n";
134  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>', $s);
135  print $s;
136  print "<br>\n";
137 
138  $step++;
139  $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
140  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, '{s}');
141  $s = str_replace('{s}', $textlink, $s);
142  print $s;
143  print "<br>\n";
144  if (!empty($conf->tax->enabled))
145  {
146  $textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
147  $step++;
148  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, '{s}');
149  $s = str_replace('{s}', $textlink, $s);
150  print $s;
151  print "<br>\n";
152  }
153  if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
154  {
155  $step++;
156  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '{s}');
157  $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);
158  print $s;
159  print "<br>\n";
160  }
161 
162  $step++;
163  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '{s}');
164  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>', $s);
165  print $s;
166  print "<br>\n";
167 
168 
169  print '<br>';
170 
171  // Step A - E
172 
173  print "<br>\n";
174  print load_fiche_titre('<span class="fa fa-calendar"></span> '.$langs->trans("AccountancyAreaDescActionFreq"), '', '');
175  print '<hr>';
176  print "<br>\n";
177  $step = 0;
178 
179  $langs->loadLangs(array('bills', 'trips'));
180 
181  $step++;
182  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), '{s}')."\n";
183  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/customer/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'</strong></a>', $s);
184  print $s;
185  print "<br>\n";
186 
187  $step++;
188  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), '{s}')."\n";
189  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/supplier/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'</strong></a>', $s);
190  print $s;
191  print "<br>\n";
192 
193  if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled))
194  {
195  $step++;
196  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), '{s}')."\n";
197  $s = str_replace('{s}', '<a href="'.DOL_URL_ROOT.'/accountancy/expensereport/index.php"><strong>'.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'</strong></a>', $s);
198  print $s;
199  print "<br>\n";
200  }
201 
202  $step++;
203  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescWriteRecords", chr(64 + $step), $langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("RegistrationInAccounting"), $langs->transnoentitiesnoconv("WriteBookKeeping"))."\n";
204  print $s;
205  print "<br>\n";
206 
207  $step++;
208  $s = img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescAnalyze", chr(64 + $step))."<br>\n";
209  print $s;
210  print "<br>\n";
211 
212  print '<br>';
213 
214  print '</div>';
215 
216  print '<div class="clearboth"></div>';
217 
218  print '<div class="fichecenter fichecenterbis">';
219 
220  /*
221  * Show boxes
222  */
223  $boxlist .= '<div class="twocolumns">';
224 
225  $boxlist .= '<div class="firstcolumn fichehalfleft boxhalfleft" id="boxhalfleft">';
226 
227  $boxlist .= $resultboxes['boxlista'];
228 
229  $boxlist .= '</div>';
230 
231  $boxlist .= '<div class="secondcolumn fichehalfright boxhalfright" id="boxhalfright">';
232 
233  $boxlist .= $resultboxes['boxlistb'];
234 
235  $boxlist .= '</div>';
236  $boxlist .= "\n";
237 
238  $boxlist .= '</div>';
239 
240 
241  print $boxlist;
242 
243  print '</div>';
244 } else {
245  print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
246 
247  print '<span class="opacitymedium">'.$langs->trans("Module10Desc")."</span><br>\n";
248 }
249 
250 // End of page
251 llxFooter();
252 $db->close();
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
static saveboxorder($db, $zone, $boxorder, $userid=0)
Save order of boxes for area and user.
llxHeader()
Empty header.
Definition: wrapper.php:45
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
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&#39;s its name (generic function)
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 ...
print
Draft customers invoices.
Definition: index.php:89
llxFooter()
Empty footer.
Definition: wrapper.php:59
static getBoxesArea($user, $areacode)
Get array with HTML tabs with boxes of a particular area including personalized choices of user...