dolibarr 19.0.4
export.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
3 * Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
4 * Copyright (C) 2013-2024 Alexandre Spangaro <aspangaro@easya.solutions>
5 * Copyright (C) 2022 Lionel Vessiller <lvessiller@open-dsi.fr>
6 * Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
7 * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
8 * Copyright (C) 2022 Progiseize <a.bisotti@progiseize.fr>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 */
23
30// Load Dolibarr environment
31require '../../main.inc.php';
32require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
33require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
34require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
35require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
36require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
42
43// Load translation files required by the page
44$langs->loadLangs(array("accountancy", "compta"));
45
46$socid = GETPOST('socid', 'int');
47
48$action = GETPOST('action', 'aZ09');
49$massaction = GETPOST('massaction', 'alpha');
50$confirm = GETPOST('confirm', 'alpha');
51$toselect = GETPOST('toselect', 'array');
52$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'bookkeepinglist';
53$search_mvt_num = GETPOST('search_mvt_num', 'int');
54$search_doc_type = GETPOST("search_doc_type", 'alpha');
55$search_doc_ref = GETPOST("search_doc_ref", 'alpha');
56$search_date_startyear = GETPOST('search_date_startyear', 'int');
57$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
58$search_date_startday = GETPOST('search_date_startday', 'int');
59$search_date_endyear = GETPOST('search_date_endyear', 'int');
60$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
61$search_date_endday = GETPOST('search_date_endday', 'int');
62$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
63$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
64$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
65$search_date_creation_startyear = GETPOST('search_date_creation_startyear', 'int');
66$search_date_creation_startmonth = GETPOST('search_date_creation_startmonth', 'int');
67$search_date_creation_startday = GETPOST('search_date_creation_startday', 'int');
68$search_date_creation_endyear = GETPOST('search_date_creation_endyear', 'int');
69$search_date_creation_endmonth = GETPOST('search_date_creation_endmonth', 'int');
70$search_date_creation_endday = GETPOST('search_date_creation_endday', 'int');
71$search_date_creation_start = dol_mktime(0, 0, 0, $search_date_creation_startmonth, $search_date_creation_startday, $search_date_creation_startyear);
72$search_date_creation_end = dol_mktime(23, 59, 59, $search_date_creation_endmonth, $search_date_creation_endday, $search_date_creation_endyear);
73$search_date_modification_startyear = GETPOST('search_date_modification_startyear', 'int');
74$search_date_modification_startmonth = GETPOST('search_date_modification_startmonth', 'int');
75$search_date_modification_startday = GETPOST('search_date_modification_startday', 'int');
76$search_date_modification_endyear = GETPOST('search_date_modification_endyear', 'int');
77$search_date_modification_endmonth = GETPOST('search_date_modification_endmonth', 'int');
78$search_date_modification_endday = GETPOST('search_date_modification_endday', 'int');
79$search_date_modification_start = dol_mktime(0, 0, 0, $search_date_modification_startmonth, $search_date_modification_startday, $search_date_modification_startyear);
80$search_date_modification_end = dol_mktime(23, 59, 59, $search_date_modification_endmonth, $search_date_modification_endday, $search_date_modification_endyear);
81$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
82$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
83$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
84$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
85$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
86$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
87$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
88$search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
89$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int');
90$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int');
91$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int');
92$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int');
93$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int');
94$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int');
95$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
96$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
97$search_import_key = GETPOST("search_import_key", 'alpha');
98
99//var_dump($search_date_start);exit;
100if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
101 $action = 'delbookkeepingyear';
102}
103if (GETPOST("button_export_file_x") || GETPOST("button_export_file.x") || GETPOST("button_export_file")) {
104 $action = 'export_file';
105}
106
107$search_account_category = GETPOST('search_account_category', 'int');
108
109$search_accountancy_code = GETPOST("search_accountancy_code", 'alpha');
110$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
111if ($search_accountancy_code_start == - 1) {
112 $search_accountancy_code_start = '';
113}
114$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
115if ($search_accountancy_code_end == - 1) {
116 $search_accountancy_code_end = '';
117}
118
119$search_accountancy_aux_code = GETPOST("search_accountancy_aux_code", 'alpha');
120$search_accountancy_aux_code_start = GETPOST('search_accountancy_aux_code_start', 'alpha');
121if ($search_accountancy_aux_code_start == - 1) {
122 $search_accountancy_aux_code_start = '';
123}
124$search_accountancy_aux_code_end = GETPOST('search_accountancy_aux_code_end', 'alpha');
125if ($search_accountancy_aux_code_end == - 1) {
126 $search_accountancy_aux_code_end = '';
127}
128$search_mvt_label = GETPOST('search_mvt_label', 'alpha');
129$search_direction = GETPOST('search_direction', 'alpha');
130$search_debit = GETPOST('search_debit', 'alpha');
131$search_credit = GETPOST('search_credit', 'alpha');
132$search_ledger_code = GETPOST('search_ledger_code', 'array');
133$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
134$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
135
136// Load variable for pagination
137$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
138$sortfield = GETPOST('sortfield', 'aZ09comma');
139$sortorder = GETPOST('sortorder', 'aZ09comma');
140$optioncss = GETPOST('optioncss', 'alpha');
141$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
142if (empty($page) || $page < 0) {
143 $page = 0;
144}
145$offset = $limit * $page;
146$pageprev = $page - 1;
147$pagenext = $page + 1;
148if ($sortorder == "") {
149 $sortorder = "ASC";
150}
151if ($sortfield == "") {
152 $sortfield = "t.piece_num,t.rowid";
153}
154
155// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
156$object = new BookKeeping($db);
157$hookmanager->initHooks(array('bookkeepingexport'));
158
159$formaccounting = new FormAccounting($db);
160$form = new Form($db);
161
162if (!in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && !GETPOSTISSET('begin') && !GETPOSTISSET('formfilteraction') && GETPOST('page', 'int') == '' && !GETPOST('noreset', 'int') && $user->hasRight('accounting', 'mouvements', 'export')) {
163 if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('restore_lastsearch_values') && !GETPOST('search_accountancy_code_start')) {
164 $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
165 $query .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1";
166 $res = $db->query($query);
167
168 if ($res->num_rows > 0) {
169 $fiscalYear = $db->fetch_object($res);
170 $search_date_start = strtotime($fiscalYear->date_start);
171 $search_date_end = strtotime($fiscalYear->date_end);
172 } else {
173 $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
174 $year_start = dol_print_date(dol_now(), '%Y');
175 if (dol_print_date(dol_now(), '%m') < $month_start) {
176 $year_start--; // If current month is lower that starting fiscal month, we start last year
177 }
178 $year_end = $year_start + 1;
179 $month_end = $month_start - 1;
180 if ($month_end < 1) {
181 $month_end = 12;
182 $year_end--;
183 }
184 $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
185 $search_date_end = dol_get_last_day($year_end, $month_end);
186 }
187 }
188}
189
190
191$arrayfields = array(
192 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
193 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
194 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
195 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
196 't.numero_compte'=>array('label'=>$langs->trans("AccountAccountingShort"), 'checked'=>1),
197 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
198 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
199 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
200 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
201 't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
202 't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
203 't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
204 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>1),
205 't.date_validated'=>array('label'=>$langs->trans("DateValidationAndLock"), 'checked'=>1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
206 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>0, 'position'=>1100),
207);
208
209if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) {
210 unset($arrayfields['t.lettering_code']);
211}
212
213$accountancyexport = new AccountancyExport($db);
214$listofformat = $accountancyexport->getType();
215$formatexportset = getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV');
216if (empty($listofformat[$formatexportset])) {
217 $formatexportset = 1;
218}
219
220$error = 0;
221
222if (!isModEnabled('accounting')) {
224}
225if ($user->socid > 0) {
227}
228if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
230}
231
232
233/*
234 * Actions
235 */
236
237$param = '';
238
239if (GETPOST('cancel', 'alpha')) {
240 $action = 'list';
241 $massaction = '';
242}
243if (!GETPOST('confirmmassaction', 'alpha')) {
244 $massaction = '';
245}
246
247$parameters = array('socid'=>$socid);
248$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
249if ($reshook < 0) {
250 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
251}
252
253if (empty($reshook)) {
254 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
255
256 if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
257 $search_mvt_num = '';
258 $search_doc_type = '';
259 $search_doc_ref = '';
260 $search_doc_date = '';
261 $search_account_category = '';
262 $search_accountancy_code = '';
263 $search_accountancy_code_start = '';
264 $search_accountancy_code_end = '';
265 $search_accountancy_aux_code = '';
266 $search_accountancy_aux_code_start = '';
267 $search_accountancy_aux_code_end = '';
268 $search_mvt_label = '';
269 $search_direction = '';
270 $search_ledger_code = array();
271 $search_date_startyear = '';
272 $search_date_startmonth = '';
273 $search_date_startday = '';
274 $search_date_endyear = '';
275 $search_date_endmonth = '';
276 $search_date_endday = '';
277 $search_date_start = '';
278 $search_date_end = '';
279 $search_date_creation_startyear = '';
280 $search_date_creation_startmonth = '';
281 $search_date_creation_startday = '';
282 $search_date_creation_endyear = '';
283 $search_date_creation_endmonth = '';
284 $search_date_creation_endday = '';
285 $search_date_creation_start = '';
286 $search_date_creation_end = '';
287 $search_date_modification_startyear = '';
288 $search_date_modification_startmonth = '';
289 $search_date_modification_startday = '';
290 $search_date_modification_endyear = '';
291 $search_date_modification_endmonth = '';
292 $search_date_modification_endday = '';
293 $search_date_modification_start = '';
294 $search_date_modification_end = '';
295 $search_date_export_startyear = '';
296 $search_date_export_startmonth = '';
297 $search_date_export_startday = '';
298 $search_date_export_endyear = '';
299 $search_date_export_endmonth = '';
300 $search_date_export_endday = '';
301 $search_date_export_start = '';
302 $search_date_export_end = '';
303 $search_date_validation_startyear = '';
304 $search_date_validation_startmonth = '';
305 $search_date_validation_startday = '';
306 $search_date_validation_endyear = '';
307 $search_date_validation_endmonth = '';
308 $search_date_validation_endday = '';
309 $search_date_validation_start = '';
310 $search_date_validation_end = '';
311 $search_debit = '';
312 $search_credit = '';
313 $search_lettering_code = '';
314 $search_not_reconciled = '';
315 $search_import_key = '';
316 $toselect = array();
317 }
318
319 // Must be after the remove filter action, before the export.
320 $filter = array();
321 if (!empty($search_date_start)) {
322 $filter['t.doc_date>='] = $search_date_start;
323 $tmp = dol_getdate($search_date_start);
324 $param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
325 }
326 if (!empty($search_date_end)) {
327 $filter['t.doc_date<='] = $search_date_end;
328 $tmp = dol_getdate($search_date_end);
329 $param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
330 }
331 if (!empty($search_doc_date)) {
332 $filter['t.doc_date'] = $search_doc_date;
333 $tmp = dol_getdate($search_doc_date);
334 $param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
335 }
336 if (!empty($search_doc_type)) {
337 $filter['t.doc_type'] = $search_doc_type;
338 $param .= '&search_doc_type='.urlencode($search_doc_type);
339 }
340 if (!empty($search_doc_ref)) {
341 $filter['t.doc_ref'] = $search_doc_ref;
342 $param .= '&search_doc_ref='.urlencode($search_doc_ref);
343 }
344 if ($search_account_category != '-1' && !empty($search_account_category)) {
345 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
346 $accountingcategory = new AccountancyCategory($db);
347
348 $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
349 $listofaccountsforgroup2 = array();
350 if (is_array($listofaccountsforgroup)) {
351 foreach ($listofaccountsforgroup as $tmpval) {
352 $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
353 }
354 }
355 $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
356 $param .= '&search_account_category='.urlencode($search_account_category);
357 }
358 if (!empty($search_accountancy_code)) {
359 $filter['t.numero_compte'] = $search_accountancy_code;
360 $param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
361 }
362 if (!empty($search_accountancy_code_start)) {
363 $filter['t.numero_compte>='] = $search_accountancy_code_start;
364 $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
365 }
366 if (!empty($search_accountancy_code_end)) {
367 $filter['t.numero_compte<='] = $search_accountancy_code_end;
368 $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
369 }
370 if (!empty($search_accountancy_aux_code)) {
371 $filter['t.subledger_account'] = $search_accountancy_aux_code;
372 $param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
373 }
374 if (!empty($search_accountancy_aux_code_start)) {
375 $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
376 $param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
377 }
378 if (!empty($search_accountancy_aux_code_end)) {
379 $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
380 $param .= '&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
381 }
382 if (!empty($search_mvt_label)) {
383 $filter['t.label_operation'] = $search_mvt_label;
384 $param .= '&search_mvt_label='.urlencode($search_mvt_label);
385 }
386 if (!empty($search_direction)) {
387 $filter['t.sens'] = $search_direction;
388 $param .= '&search_direction='.urlencode($search_direction);
389 }
390 if (!empty($search_ledger_code)) {
391 $filter['t.code_journal'] = $search_ledger_code;
392 foreach ($search_ledger_code as $code) {
393 $param .= '&search_ledger_code[]='.urlencode($code);
394 }
395 }
396 if (!empty($search_mvt_num)) {
397 $filter['t.piece_num'] = $search_mvt_num;
398 $param .= '&search_mvt_num='.urlencode($search_mvt_num);
399 }
400 if (!empty($search_date_creation_start)) {
401 $filter['t.date_creation>='] = $search_date_creation_start;
402 $tmp = dol_getdate($search_date_creation_start);
403 $param .= '&search_date_creation_startmonth='.urlencode($tmp['mon']).'&search_date_creation_startday='.urlencode($tmp['mday']).'&search_date_creation_startyear='.urlencode($tmp['year']);
404 }
405 if (!empty($search_date_creation_end)) {
406 $filter['t.date_creation<='] = $search_date_creation_end;
407 $tmp = dol_getdate($search_date_creation_end);
408 $param .= '&search_date_creation_endmonth='.urlencode($tmp['mon']).'&search_date_creation_endday='.urlencode($tmp['mday']).'&search_date_creation_endyear='.urlencode($tmp['year']);
409 }
410 if (!empty($search_date_modification_start)) {
411 $filter['t.tms>='] = $search_date_modification_start;
412 $tmp = dol_getdate($search_date_modification_start);
413 $param .= '&search_date_modification_startmonth='.urlencode($tmp['mon']).'&search_date_modification_startday='.urlencode($tmp['mday']).'&search_date_modification_startyear='.urlencode($tmp['year']);
414 }
415 if (!empty($search_date_modification_end)) {
416 $filter['t.tms<='] = $search_date_modification_end;
417 $tmp = dol_getdate($search_date_modification_end);
418 $param .= '&search_date_modification_endmonth='.urlencode($tmp['mon']).'&search_date_modification_endday='.urlencode($tmp['mday']).'&search_date_modification_endyear='.urlencode($tmp['year']);
419 }
420 if (!empty($search_date_export_start)) {
421 $filter['t.date_export>='] = $search_date_export_start;
422 $tmp = dol_getdate($search_date_export_start);
423 $param .= '&search_date_export_startmonth='.urlencode($tmp['mon']).'&search_date_export_startday='.urlencode($tmp['mday']).'&search_date_export_startyear='.urlencode($tmp['year']);
424 }
425 if (!empty($search_date_export_end)) {
426 $filter['t.date_export<='] = $search_date_export_end;
427 $tmp = dol_getdate($search_date_export_end);
428 $param .= '&search_date_export_endmonth='.urlencode($tmp['mon']).'&search_date_export_endday='.urlencode($tmp['mday']).'&search_date_export_endyear='.urlencode($tmp['year']);
429 }
430 if (!empty($search_date_validation_start)) {
431 $filter['t.date_validated>='] = $search_date_validation_start;
432 $tmp = dol_getdate($search_date_validation_start);
433 $param .= '&search_date_validation_startmonth='.urlencode($tmp['mon']).'&search_date_validation_startday='.urlencode($tmp['mday']).'&search_date_validation_startyear='.urlencode($tmp['year']);
434 }
435 if (!empty($search_date_validation_end)) {
436 $filter['t.date_validated<='] = $search_date_validation_end;
437 $tmp = dol_getdate($search_date_validation_end);
438 $param .= '&search_date_validation_endmonth='.urlencode($tmp['mon']).'&search_date_validation_endday='.urlencode($tmp['mday']).'&search_date_validation_endyear='.urlencode($tmp['year']);
439 }
440 if (!empty($search_debit)) {
441 $filter['t.debit'] = $search_debit;
442 $param .= '&search_debit='.urlencode($search_debit);
443 }
444 if (!empty($search_credit)) {
445 $filter['t.credit'] = $search_credit;
446 $param .= '&search_credit='.urlencode($search_credit);
447 }
448 if (!empty($search_lettering_code)) {
449 $filter['t.lettering_code'] = $search_lettering_code;
450 $param .= '&search_lettering_code='.urlencode($search_lettering_code);
451 }
452 if (!empty($search_not_reconciled)) {
453 $filter['t.reconciled_option'] = $search_not_reconciled;
454 $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
455 }
456 if (!empty($search_import_key)) {
457 $filter['t.import_key'] = $search_import_key;
458 $param .= '&search_import_key='.urlencode($search_import_key);
459 }
460
461 if ($action == 'setreexport') {
462 $setreexport = GETPOST('value', 'int');
463 if (!dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) {
464 $error++;
465 }
466
467 if (!$error) {
468 if (!getDolGlobalString('ACCOUNTING_REEXPORT')) {
469 setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
470 } else {
471 setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'warnings');
472 }
473 } else {
474 setEventMessages($langs->trans("Error"), null, 'errors');
475 }
476 }
477
478 // Mass actions
479 $objectclass = 'Bookkeeping';
480 $objectlabel = 'Bookkeeping';
481 $permissiontoread = $user->hasRight('societe', 'lire');
482 $permissiontodelete = $user->hasRight('societe', 'supprimer');
483 $permissiontoadd = $user->hasRight('societe', 'creer');
484 $uploaddir = $conf->societe->dir_output;
485 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
486}
487
488// Build and execute select (used by page and export action)
489// must de set after the action that set $filter
490// --------------------------------------------------------------------
491
492$sql = 'SELECT';
493$sql .= ' t.rowid,';
494$sql .= " t.doc_date,";
495$sql .= " t.doc_type,";
496$sql .= " t.doc_ref,";
497$sql .= " t.fk_doc,";
498$sql .= " t.fk_docdet,";
499$sql .= " t.thirdparty_code,";
500$sql .= " t.subledger_account,";
501$sql .= " t.subledger_label,";
502$sql .= " t.numero_compte,";
503$sql .= " t.label_compte,";
504$sql .= " t.label_operation,";
505$sql .= " t.debit,";
506$sql .= " t.credit,";
507$sql .= " t.lettering_code,";
508$sql .= " t.montant as amount,";
509$sql .= " t.sens,";
510$sql .= " t.fk_user_author,";
511$sql .= " t.import_key,";
512$sql .= " t.code_journal,";
513$sql .= " t.journal_label,";
514$sql .= " t.piece_num,";
515$sql .= " t.date_creation,";
516$sql .= " t.tms as date_modification,";
517$sql .= " t.date_export,";
518$sql .= " t.date_validated as date_validation,";
519$sql .= " t.import_key";
520
521$sqlfields = $sql; // $sql fields to remove for count total
522
523$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
524// Manage filter
525$sqlwhere = array();
526if (count($filter) > 0) {
527 foreach ($filter as $key => $value) {
528 if ($key == 't.doc_date') {
529 $sqlwhere[] = $key."='".$db->idate($value)."'";
530 } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
531 $sqlwhere[] = $key."'".$db->idate($value)."'";
532 } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
533 $sqlwhere[] = $key."'".$db->escape($value)."'";
534 } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
535 $sqlwhere[] = $key.'='.((int) $value);
536 } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
537 $sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
538 } elseif ($key == 't.subledger_account') {
539 $sqlwhere[] = natural_search($key, $value, 0, 1);
540 } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
541 $sqlwhere[] = $key."'".$db->idate($value)."'";
542 } elseif ($key == 't.tms>=' || $key == 't.tms<=') {
543 $sqlwhere[] = $key."'".$db->idate($value)."'";
544 } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
545 $sqlwhere[] = $key."'".$db->idate($value)."'";
546 } elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
547 $sqlwhere[] = $key."'".$db->idate($value)."'";
548 } elseif ($key == 't.credit' || $key == 't.debit') {
549 $sqlwhere[] = natural_search($key, $value, 1, 1);
550 } elseif ($key == 't.reconciled_option') {
551 $sqlwhere[] = 't.lettering_code IS NULL';
552 } elseif ($key == 't.code_journal' && !empty($value)) {
553 if (is_array($value)) {
554 $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
555 } else {
556 $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
557 }
558 } elseif ($key == 't.search_accounting_code_in' && !empty($value)) {
559 $sqlwhere[] = 't.numero_compte IN ('.$db->sanitize($value, 1).')';
560 } else {
561 $sqlwhere[] = natural_search($key, $value, 0, 1);
562 }
563 }
564}
565$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
566if (!getDolGlobalString('ACCOUNTING_REEXPORT')) { // Reexport not enabled (default mode)
567 $sql .= " AND t.date_export IS NULL";
568}
569if (count($sqlwhere) > 0) {
570 $sql .= ' AND '.implode(' AND ', $sqlwhere);
571}
572//print $sql;
573
574
575// Export into a file with format defined into setup (FEC, CSV, ...)
576// Must be after definition of $sql
577if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
578 // TODO Replace the fetchAll to get all ->line followed by call to ->export(). fetchAll() currently consumes too much memory on large export.
579 // Replace this with the query($sql) and loop on each line to export them.
580 $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (!getDolGlobalString('ACCOUNTING_REEXPORT') ? 0 : 1));
581
582 if ($result < 0) {
583 setEventMessages($object->error, $object->errors, 'errors');
584 } else {
585 // Export files then exit
586 $accountancyexport = new AccountancyExport($db);
587
588 $formatexport = GETPOST('formatexport', 'int');
589 $notexportlettering = GETPOST('notexportlettering', 'alpha');
590
591 if (!empty($notexportlettering)) {
592 if (is_array($object->lines)) {
593 foreach ($object->lines as $k => $movement) {
594 unset($object->lines[$k]->lettering_code);
595 unset($object->lines[$k]->date_lettering);
596 }
597 }
598 }
599
600 $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
601 $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
602 $withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
603
604 // Output data on screen or download
605 $result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
606
607 $error = 0;
608 if ($result < 0) {
609 $error++;
610 } else {
611 if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
612 if (is_array($object->lines)) {
613 dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
614
615 // Specify as export : update field date_export or date_validated
616 $db->begin();
617
618 // TODO Merge update for each line into one global using rowid IN (list of movement ids)
619 foreach ($object->lines as $movement) {
620 $now = dol_now();
621
622 $setfields = '';
623 if (!empty($notifiedexportdate) && empty($movement->date_export)) {
624 $setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
625 }
626 if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
627 $setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
628 }
629
630 if ($setfields) {
631 $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
632 $sql .= " SET ".$setfields;
633 $sql .= " WHERE rowid = ".((int) $movement->id);
634
635 $result = $db->query($sql);
636 if (!$result) {
637 $error++;
638 break;
639 }
640 }
641 }
642
643 if (!$error) {
644 $db->commit();
645 } else {
646 $error++;
647 $accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
648 $db->rollback();
649 }
650 }
651 }
652 }
653
654 if ($error) {
655 setEventMessages('', $accountancyexport->errors, 'errors');
656 header('Location: '.$_SERVER['PHP_SELF']);
657 }
658 exit(); // download or show errors
659 }
660}
661
662
663/*
664 * View
665 */
666
667$formother = new FormOther($db);
668$formfile = new FormFile($db);
669
670$title_page = $langs->trans("Operations").' - '.$langs->trans("ExportAccountancy");
671
672// Count total nb of records
673$nbtotalofrecords = '';
674if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
675 /* The fast and low memory method to get and count full list converts the sql into a sql count */
676 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
677 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
678 $resql = $db->query($sqlforcount);
679 if ($resql) {
680 $objforcount = $db->fetch_object($resql);
681 $nbtotalofrecords = $objforcount->nbtotalofrecords;
682 } else {
683 dol_print_error($db);
684 }
685
686 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
687 $page = 0;
688 $offset = 0;
689 }
690 $db->free($resql);
691}
692
693// Complete request and execute it with limit
694$sql .= $db->order($sortfield, $sortorder);
695if ($limit) {
696 $sql .= $db->plimit($limit + 1, $offset);
697}
698
699$resql = $db->query($sql);
700if (!$resql) {
701 dol_print_error($db);
702 exit;
703}
704
705$num = $db->num_rows($resql);
706
707$arrayofselected = is_array($toselect) ? $toselect : array();
708
709// Output page
710// --------------------------------------------------------------------
711$help_url ='EN:Module_Double_Entry_Accounting#Exports|FR:Module_Comptabilit&eacute;_en_Partie_Double#Exports';
712
713llxHeader('', $title_page, $help_url);
714
715$formconfirm = '';
716
717if ($action == 'export_file') {
718 $form_question = array();
719
720 $form_question['formatexport'] = array(
721 'name' => 'formatexport',
722 'type' => 'select',
723 'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
724 'values' => $listofformat,
725 'default' => $formatexportset,
726 'morecss' => 'minwidth200 maxwidth200'
727 );
728
729 $form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
730
731 if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
732 // If 1, we check by default.
733 $checked = getDolGlobalString('ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING') ? 'true' : 'false';
734 $form_question['notexportlettering'] = array(
735 'name' => 'notexportlettering',
736 'type' => 'checkbox',
737 'label' => $langs->trans('NotExportLettering'),
738 'value' => $checked,
739 );
740
741 $form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
742 }
743
744 // If 1 or not set, we check by default.
745 $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE'));
746 $form_question['notifiedexportdate'] = array(
747 'name' => 'notifiedexportdate',
748 'type' => 'checkbox',
749 'label' => $langs->trans('NotifiedExportDate'),
750 'value' => (getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE') ? 'false' : 'true'),
751 );
752
753 $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
754
755 if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
756 // If 0 or not set, we NOT check by default.
757 $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || getDolGlobalString('ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE'));
758 $form_question['notifiedvalidationdate'] = array(
759 'name' => 'notifiedvalidationdate',
760 'type' => 'checkbox',
761 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
762 'value' => $checked,
763 );
764
765 $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
766 }
767
768 // add documents in an archive for some accountancy export format
769 if (getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_QUADRATUS
770 || getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC
771 || getDolGlobalString('ACCOUNTING_EXPORT_MODELCSV') == AccountancyExport::$EXPORT_TYPE_FEC2
772 ) {
773 $form_question['notifiedexportfull'] = array(
774 'name' => 'notifiedexportfull',
775 'type' => 'checkbox',
776 'label' => $langs->trans('NotifiedExportFull'),
777 'value' => 'false',
778 );
779 }
780
781 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
782}
783
784// Print form confirm
785print $formconfirm;
786
787//$param=''; param started before
788if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
789 $param .= '&contextpage='.urlencode($contextpage);
790}
791if ($limit > 0 && $limit != $conf->liste_limit) {
792 $param .= '&limit='.urlencode($limit);
793}
794
795// List of mass actions available
796$arrayofmassactions = array();
797$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
798
799print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
800print '<input type="hidden" name="token" value="'.newToken().'">';
801print '<input type="hidden" name="action" value="list">';
802if ($optioncss != '') {
803 print '<input type="hidden" name="optioncss" value="'.urlencode($optioncss).'">';
804}
805print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
806print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
807print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
808print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
809
810if (count($filter)) {
811 $buttonLabel = $langs->trans("ExportFilteredList");
812} else {
813 $buttonLabel = $langs->trans("ExportList");
814}
815
816$parameters = array('param' => $param);
817$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
818if ($reshook < 0) {
819 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
820}
821
822$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
823if (empty($reshook)) {
824 // Button re-export
825 if (!getDolGlobalString('ACCOUNTING_REEXPORT')) {
826 $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=1'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("ClickToShowAlreadyExportedLines"), 'switch_off', 'class="small size15x valignmiddle"');
827 $newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToShowAlreadyExportedLines").'</span>';
828 $newcardbutton .= '</a>';
829 } else {
830 $newcardbutton .= '<a class="valignmiddle" href="'.$_SERVER['PHP_SELF'].'?action=setreexport&token='.newToken().'&value=0'.($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'">'.img_picto($langs->trans("DocsAlreadyExportedAreIncluded"), 'switch_on', 'class="warning size15x valignmiddle"');
831 $newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreIncluded").'</span>';
832 $newcardbutton .= '</a>';
833 }
834
835 if ($user->hasRight('accounting', 'mouvements', 'export')) {
836 $newcardbutton .= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList"), 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file&token='.newToken().($param ? '&'.$param : '').'&sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder), $user->hasRight('accounting', 'mouvements', 'export'));
837 }
838}
839
840print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
841
842// Not display message when all the list of docs are included
843if (!getDolGlobalString('ACCOUNTING_REEXPORT')) {
844 print info_admin($langs->trans("WarningDataDisappearsWhenDataIsExported"), 0, 0, 0, 'hideonsmartphone info');
845}
846
847//$topicmail = "Information";
848//$modelmail = "accountingbookkeeping";
849//$objecttmp = new BookKeeping($db);
850//$trackid = 'bk'.$object->id;
851include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
852
853$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
854$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
855if ($massactionbutton && $contextpage != 'poslist') {
856 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
857}
858
859$moreforfilter = '';
860$moreforfilter .= '<div class="divsearchfield">';
861$moreforfilter .= $langs->trans('AccountingCategory').': ';
862$moreforfilter .= '<div class="nowrap inline-block">';
863$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
864$moreforfilter .= '</div>';
865$moreforfilter .= '</div>';
866
867$parameters = array();
868$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
869if (empty($reshook)) {
870 $moreforfilter .= $hookmanager->resPrint;
871} else {
872 $moreforfilter = $hookmanager->resPrint;
873}
874
875print '<div class="liste_titre liste_titre_bydiv centpercent">';
876print $moreforfilter;
877print '</div>';
878
879print '<div class="div-table-responsive">';
880print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
881
882// Filters lines
883print '<tr class="liste_titre_filter">';
884// Action column
885if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
886 print '<td class="liste_titre center">';
887 $searchpicto = $form->showFilterButtons('left');
888 print $searchpicto;
889 print '</td>';
890}
891// Movement number
892if (!empty($arrayfields['t.piece_num']['checked'])) {
893 print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
894}
895// Code journal
896if (!empty($arrayfields['t.code_journal']['checked'])) {
897 print '<td class="liste_titre center">';
898 print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth75');
899 print '</td>';
900}
901// Date document
902if (!empty($arrayfields['t.doc_date']['checked'])) {
903 print '<td class="liste_titre center">';
904 print '<div class="nowrapfordate">';
905 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
906 print '</div>';
907 print '<div class="nowrapfordate">';
908 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
909 print '</div>';
910 print '</td>';
911}
912// Ref document
913if (!empty($arrayfields['t.doc_ref']['checked'])) {
914 print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="'.dol_escape_htmltag($search_doc_ref).'"></td>';
915}
916// Accountancy account
917if (!empty($arrayfields['t.numero_compte']['checked'])) {
918 print '<td class="liste_titre">';
919 print '<div class="nowrap">';
920 print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth150', 'account');
921 print '</div>';
922 print '<div class="nowrap">';
923 print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth150', 'account');
924 print '</div>';
925 print '</td>';
926}
927// Subledger account
928if (!empty($arrayfields['t.subledger_account']['checked'])) {
929 print '<td class="liste_titre">';
930 // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
931 // use setup of keypress to select thirdparty and this hang browser on large database.
932 if (getDolGlobalString('ACCOUNTANCY_COMBO_FOR_AUX')) {
933 print '<div class="nowrap">';
934 //print $langs->trans('From').' ';
935 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount');
936 print '</div>';
937 print '<div class="nowrap">';
938 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount');
939 print '</div>';
940 } else {
941 print '<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).'">';
942 }
943 print '</td>';
944}
945// Label operation
946if (!empty($arrayfields['t.label_operation']['checked'])) {
947 print '<td class="liste_titre">';
948 print '<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).'"/>';
949 print '</td>';
950}
951// Debit
952if (!empty($arrayfields['t.debit']['checked'])) {
953 print '<td class="liste_titre right">';
954 print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
955 print '</td>';
956}
957// Credit
958if (!empty($arrayfields['t.credit']['checked'])) {
959 print '<td class="liste_titre right">';
960 print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
961 print '</td>';
962}
963// Lettering code
964if (!empty($arrayfields['t.lettering_code']['checked'])) {
965 print '<td class="liste_titre center">';
966 print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).'"/>';
967 print '<br><span class="nowrap"><input type="checkbox" id="search_not_reconciled" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'><label for="search_not_reconciled">'.$langs->trans("NotReconciled").'</label></span>';
968 print '</td>';
969}
970
971// Fields from hook
972$parameters = array('arrayfields'=>$arrayfields);
973$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
974print $hookmanager->resPrint;
975
976// Date creation
977if (!empty($arrayfields['t.date_creation']['checked'])) {
978 print '<td class="liste_titre center">';
979 print '<div class="nowrapfordate">';
980 print $form->selectDate($search_date_creation_start, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
981 print '</div>';
982 print '<div class="nowrapfordate">';
983 print $form->selectDate($search_date_creation_end, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
984 print '</div>';
985 print '</td>';
986}
987// Date modification
988if (!empty($arrayfields['t.tms']['checked'])) {
989 print '<td class="liste_titre center">';
990 print '<div class="nowrapfordate">';
991 print $form->selectDate($search_date_modification_start, 'search_date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
992 print '</div>';
993 print '<div class="nowrapfordate">';
994 print $form->selectDate($search_date_modification_end, 'search_date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
995 print '</div>';
996 print '</td>';
997}
998// Date export
999if (!empty($arrayfields['t.date_export']['checked'])) {
1000 print '<td class="liste_titre center">';
1001 print '<div class="nowrapfordate">';
1002 print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
1003 print '</div>';
1004 print '<div class="nowrapfordate">';
1005 print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1006 print '</div>';
1007 print '</td>';
1008}
1009// Date validation
1010if (!empty($arrayfields['t.date_validated']['checked'])) {
1011 print '<td class="liste_titre center">';
1012 print '<div class="nowrapfordate">';
1013 print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
1014 print '</div>';
1015 print '<div class="nowrapfordate">';
1016 print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1017 print '</div>';
1018 print '</td>';
1019}
1020if (!empty($arrayfields['t.import_key']['checked'])) {
1021 print '<td class="liste_titre center">';
1022 print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1023 print '</td>';
1024}
1025// Action column
1026if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1027 print '<td class="liste_titre center">';
1028 $searchpicto = $form->showFilterButtons();
1029 print $searchpicto;
1030 print '</td>';
1031}
1032print "</tr>\n";
1033
1034print '<tr class="liste_titre">';
1035if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1036 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');
1037}
1038if (!empty($arrayfields['t.piece_num']['checked'])) {
1039 print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
1040}
1041if (!empty($arrayfields['t.code_journal']['checked'])) {
1042 print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
1043}
1044if (!empty($arrayfields['t.doc_date']['checked'])) {
1045 print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
1046}
1047if (!empty($arrayfields['t.doc_ref']['checked'])) {
1048 print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
1049}
1050if (!empty($arrayfields['t.numero_compte']['checked'])) {
1051 print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
1052}
1053if (!empty($arrayfields['t.subledger_account']['checked'])) {
1054 print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
1055}
1056if (!empty($arrayfields['t.label_operation']['checked'])) {
1057 print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
1058}
1059if (!empty($arrayfields['t.debit']['checked'])) {
1060 print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
1061}
1062if (!empty($arrayfields['t.credit']['checked'])) {
1063 print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
1064}
1065if (!empty($arrayfields['t.lettering_code']['checked'])) {
1066 print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
1067}
1068// Hook fields
1069$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
1070$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
1071print $hookmanager->resPrint;
1072if (!empty($arrayfields['t.date_creation']['checked'])) {
1073 print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
1074}
1075if (!empty($arrayfields['t.tms']['checked'])) {
1076 print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
1077}
1078if (!empty($arrayfields['t.date_export']['checked'])) {
1079 print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
1080}
1081if (!empty($arrayfields['t.date_validated']['checked'])) {
1082 print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
1083}
1084if (!empty($arrayfields['t.import_key']['checked'])) {
1085 print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
1086}
1087if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1088 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1089}
1090print "</tr>\n";
1091
1092
1093$line = new BookKeepingLine();
1094
1095// Loop on record
1096// --------------------------------------------------------------------
1097$i = 0;
1098$totalarray = array();
1099$totalarray['nbfield'] = 0;
1100$total_debit = 0;
1101$total_credit = 0;
1102$totalarray['val'] = array();
1103$totalarray['val']['totaldebit'] = 0;
1104$totalarray['val']['totalcredit'] = 0;
1105
1106while ($i < min($num, $limit)) {
1107 $obj = $db->fetch_object($resql);
1108 if (empty($obj)) {
1109 break; // Should not happen
1110 }
1111
1112 $line->id = $obj->rowid;
1113 $line->doc_date = $db->jdate($obj->doc_date);
1114 $line->doc_type = $obj->doc_type;
1115 $line->doc_ref = $obj->doc_ref;
1116 $line->fk_doc = $obj->fk_doc;
1117 $line->fk_docdet = $obj->fk_docdet;
1118 $line->thirdparty_code = $obj->thirdparty_code;
1119 $line->subledger_account = $obj->subledger_account;
1120 $line->subledger_label = $obj->subledger_label;
1121 $line->numero_compte = $obj->numero_compte;
1122 $line->label_compte = $obj->label_compte;
1123 $line->label_operation = $obj->label_operation;
1124 $line->debit = $obj->debit;
1125 $line->credit = $obj->credit;
1126 $line->montant = $obj->amount; // deprecated
1127 $line->amount = $obj->amount;
1128 $line->sens = $obj->sens;
1129 $line->lettering_code = $obj->lettering_code;
1130 $line->fk_user_author = $obj->fk_user_author;
1131 $line->import_key = $obj->import_key;
1132 $line->code_journal = $obj->code_journal;
1133 $line->journal_label = $obj->journal_label;
1134 $line->piece_num = $obj->piece_num;
1135 $line->date_creation = $db->jdate($obj->date_creation);
1136 $line->date_modification = $db->jdate($obj->date_modification);
1137 $line->date_export = $db->jdate($obj->date_export);
1138 $line->date_validation = $db->jdate($obj->date_validation);
1139
1140 $total_debit += $line->debit;
1141 $total_credit += $line->credit;
1142
1143 print '<tr class="oddeven">';
1144 // Action column
1145 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1146 print '<td class="nowraponall center">';
1147 if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1148 $selected = 0;
1149 if (in_array($line->id, $arrayofselected)) {
1150 $selected = 1;
1151 }
1152 print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1153 }
1154 print '</td>';
1155 if (!$i) {
1156 $totalarray['nbfield']++;
1157 }
1158 }
1159
1160 // Piece number
1161 if (!empty($arrayfields['t.piece_num']['checked'])) {
1162 print '<td>';
1163 $object->id = $line->id;
1164 $object->piece_num = $line->piece_num;
1165 print $object->getNomUrl(1, '', 0, '', 1);
1166 print '</td>';
1167 if (!$i) {
1168 $totalarray['nbfield']++;
1169 }
1170 }
1171
1172 // Journal code
1173 if (!empty($arrayfields['t.code_journal']['checked'])) {
1174 $accountingjournal = new AccountingJournal($db);
1175 $result = $accountingjournal->fetch('', $line->code_journal);
1176 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
1177 print '<td class="center tdoverflowmax150">'.$journaltoshow.'</td>';
1178 if (!$i) {
1179 $totalarray['nbfield']++;
1180 }
1181 }
1182
1183 // Document date
1184 if (!empty($arrayfields['t.doc_date']['checked'])) {
1185 print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
1186 if (!$i) {
1187 $totalarray['nbfield']++;
1188 }
1189 }
1190
1191 // Document ref
1192 if (!empty($arrayfields['t.doc_ref']['checked'])) {
1193 if ($line->doc_type == 'customer_invoice') {
1194 $langs->loadLangs(array('bills'));
1195
1196 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1197 $objectstatic = new Facture($db);
1198 $objectstatic->fetch($line->fk_doc);
1199
1200 $filename = dol_sanitizeFileName($line->doc_ref);
1201 $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1202 $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1203 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1204 } elseif ($line->doc_type == 'supplier_invoice') {
1205 $langs->loadLangs(array('bills'));
1206
1207 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
1208 $objectstatic = new FactureFournisseur($db);
1209 $objectstatic->fetch($line->fk_doc);
1210
1211 $filename = dol_sanitizeFileName($line->doc_ref);
1212 $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref);
1213 $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref);
1214 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1215 } elseif ($line->doc_type == 'expense_report') {
1216 $langs->loadLangs(array('trips'));
1217
1218 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
1219 $objectstatic = new ExpenseReport($db);
1220 $objectstatic->fetch($line->fk_doc);
1221
1222 $filename = dol_sanitizeFileName($line->doc_ref);
1223 $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1224 $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1225 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1226 } elseif ($line->doc_type == 'bank') {
1227 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
1228 $objectstatic = new AccountLine($db);
1229 $objectstatic->fetch($line->fk_doc);
1230 } else {
1231 // Other type
1232 }
1233
1234 $labeltoshow = '';
1235 $labeltoshowalt = '';
1236 if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
1237 $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
1238 $labeltoshow .= $documentlink;
1239 $labeltoshowalt .= $objectstatic->ref;
1240 } elseif ($line->doc_type == 'bank') {
1241 $labeltoshow .= $objectstatic->getNomUrl(1);
1242 $labeltoshowalt .= $objectstatic->ref;
1243 $bank_ref = strstr($line->doc_ref, '-');
1244 $labeltoshow .= " " . $bank_ref;
1245 $labeltoshowalt .= " " . $bank_ref;
1246 } else {
1247 $labeltoshow .= $line->doc_ref;
1248 $labeltoshowalt .= $line->doc_ref;
1249 }
1250
1251 print '<td class="nowraponall tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshowalt).'">';
1252 print $labeltoshow;
1253 print "</td>\n";
1254 if (!$i) {
1255 $totalarray['nbfield']++;
1256 }
1257 }
1258
1259 // Account number
1260 if (!empty($arrayfields['t.numero_compte']['checked'])) {
1261 print '<td>'.length_accountg($line->numero_compte).'</td>';
1262 if (!$i) {
1263 $totalarray['nbfield']++;
1264 }
1265 }
1266
1267 // Subledger account
1268 if (!empty($arrayfields['t.subledger_account']['checked'])) {
1269 print '<td>'.length_accounta($line->subledger_account).'</td>';
1270 if (!$i) {
1271 $totalarray['nbfield']++;
1272 }
1273 }
1274
1275 // Label operation
1276 if (!empty($arrayfields['t.label_operation']['checked'])) {
1277 print '<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).'">'.dol_escape_htmltag($line->label_operation).'</td>';
1278 if (!$i) {
1279 $totalarray['nbfield']++;
1280 }
1281 }
1282
1283 // Amount debit
1284 if (!empty($arrayfields['t.debit']['checked'])) {
1285 print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
1286 if (!$i) {
1287 $totalarray['nbfield']++;
1288 }
1289 if (!$i) {
1290 $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
1291 }
1292 $totalarray['val']['totaldebit'] += $line->debit;
1293 }
1294
1295 // Amount credit
1296 if (!empty($arrayfields['t.credit']['checked'])) {
1297 print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
1298 if (!$i) {
1299 $totalarray['nbfield']++;
1300 }
1301 if (!$i) {
1302 $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
1303 }
1304 $totalarray['val']['totalcredit'] += $line->credit;
1305 }
1306
1307 // Lettering code
1308 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1309 print '<td class="center">'.$line->lettering_code.'</td>';
1310 if (!$i) {
1311 $totalarray['nbfield']++;
1312 }
1313 }
1314
1315 // Fields from hook
1316 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1317 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1318 print $hookmanager->resPrint;
1319
1320 // Creation operation date
1321 if (!empty($arrayfields['t.date_creation']['checked'])) {
1322 print '<td class="center">'.dol_print_date($line->date_creation, 'dayhour', 'tzuserrel').'</td>';
1323 if (!$i) {
1324 $totalarray['nbfield']++;
1325 }
1326 }
1327
1328 // Modification operation date
1329 if (!empty($arrayfields['t.tms']['checked'])) {
1330 print '<td class="center">'.dol_print_date($line->date_modification, 'dayhour', 'tzuserrel').'</td>';
1331 if (!$i) {
1332 $totalarray['nbfield']++;
1333 }
1334 }
1335
1336 // Exported operation date
1337 if (!empty($arrayfields['t.date_export']['checked'])) {
1338 print '<td class="center nowraponall">'.dol_print_date($line->date_export, 'dayhour', 'tzuserrel').'</td>';
1339 if (!$i) {
1340 $totalarray['nbfield']++;
1341 }
1342 }
1343
1344 // Validated operation date
1345 if (!empty($arrayfields['t.date_validated']['checked'])) {
1346 print '<td class="center nowraponall">'.dol_print_date($line->date_validation, 'dayhour', 'tzuserrel').'</td>';
1347 if (!$i) {
1348 $totalarray['nbfield']++;
1349 }
1350 }
1351
1352 if (!empty($arrayfields['t.import_key']['checked'])) {
1353 print '<td class="tdoverflowmax100">'.$obj->import_key."</td>\n";
1354 if (!$i) {
1355 $totalarray['nbfield']++;
1356 }
1357 }
1358
1359 // Action column
1360 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1361 print '<td class="nowraponall center">';
1362 if (($massactionbutton || $massaction) && $contextpage != 'poslist') { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
1363 $selected = 0;
1364 if (in_array($line->id, $arrayofselected)) {
1365 $selected = 1;
1366 }
1367 print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1368 }
1369 print '</td>';
1370 if (!$i) {
1371 $totalarray['nbfield']++;
1372 }
1373 }
1374
1375
1376 print "</tr>\n";
1377
1378 $i++;
1379}
1380
1381// Show total line
1382include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1383
1384// If no record found
1385if ($num == 0) {
1386 $colspan = 1;
1387 foreach ($arrayfields as $key => $val) {
1388 if (!empty($val['checked'])) {
1389 $colspan++;
1390 }
1391 }
1392 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1393}
1394
1395$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1396$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1397print $hookmanager->resPrint;
1398
1399print "</table>";
1400print '</div>';
1401
1402print '</form>';
1403
1404// End of page
1405llxFooter();
1406
1407$db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
Class to manage bank transaction lines.
Class to manage categories of an accounting account.
Manage the different format accountancy export.
Class to manage accounting journals.
Class to manage Ledger (General Ledger and Subledger)
Class BookKeepingLine.
Class to manage Trips and Expenses.
Class to manage suppliers invoices.
Class to manage invoices.
Class to manage generation of HTML components for accounting management.
Class to offer components to list and upload files.
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation de composants html autre Only common components are here.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition date.lib.php:613
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
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.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.