dolibarr 18.0.9
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-2023 Alexandre Spangaro <aspangaro@open-dsi.fr>
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') : (empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION) ? $conf->liste_limit : $conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
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 = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->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 (empty($conf->global->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'; $massaction = '';
241}
242if (!GETPOST('confirmmassaction', 'alpha')) {
243 $massaction = '';
244}
245
246$parameters = array('socid'=>$socid);
247$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
248if ($reshook < 0) {
249 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
250}
251
252if (empty($reshook)) {
253 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
254
255 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
256 $search_mvt_num = '';
257 $search_doc_type = '';
258 $search_doc_ref = '';
259 $search_doc_date = '';
260 $search_account_category = '';
261 $search_accountancy_code = '';
262 $search_accountancy_code_start = '';
263 $search_accountancy_code_end = '';
264 $search_accountancy_aux_code = '';
265 $search_accountancy_aux_code_start = '';
266 $search_accountancy_aux_code_end = '';
267 $search_mvt_label = '';
268 $search_direction = '';
269 $search_ledger_code = array();
270 $search_date_startyear = '';
271 $search_date_startmonth = '';
272 $search_date_startday = '';
273 $search_date_endyear = '';
274 $search_date_endmonth = '';
275 $search_date_endday = '';
276 $search_date_start = '';
277 $search_date_end = '';
278 $search_date_creation_startyear = '';
279 $search_date_creation_startmonth = '';
280 $search_date_creation_startday = '';
281 $search_date_creation_endyear = '';
282 $search_date_creation_endmonth = '';
283 $search_date_creation_endday = '';
284 $search_date_creation_start = '';
285 $search_date_creation_end = '';
286 $search_date_modification_startyear = '';
287 $search_date_modification_startmonth = '';
288 $search_date_modification_startday = '';
289 $search_date_modification_endyear = '';
290 $search_date_modification_endmonth = '';
291 $search_date_modification_endday = '';
292 $search_date_modification_start = '';
293 $search_date_modification_end = '';
294 $search_date_export_startyear = '';
295 $search_date_export_startmonth = '';
296 $search_date_export_startday = '';
297 $search_date_export_endyear = '';
298 $search_date_export_endmonth = '';
299 $search_date_export_endday = '';
300 $search_date_export_start = '';
301 $search_date_export_end = '';
302 $search_date_validation_startyear = '';
303 $search_date_validation_startmonth = '';
304 $search_date_validation_startday = '';
305 $search_date_validation_endyear = '';
306 $search_date_validation_endmonth = '';
307 $search_date_validation_endday = '';
308 $search_date_validation_start = '';
309 $search_date_validation_end = '';
310 $search_debit = '';
311 $search_credit = '';
312 $search_lettering_code = '';
313 $search_not_reconciled = '';
314 $search_import_key = '';
315 $toselect = array();
316 }
317
318 // Must be after the remove filter action, before the export.
319 $filter = array();
320 if (!empty($search_date_start)) {
321 $filter['t.doc_date>='] = $search_date_start;
322 $tmp = dol_getdate($search_date_start);
323 $param .= '&search_date_startmonth='.urlencode($tmp['mon']).'&search_date_startday='.urlencode($tmp['mday']).'&search_date_startyear='.urlencode($tmp['year']);
324 }
325 if (!empty($search_date_end)) {
326 $filter['t.doc_date<='] = $search_date_end;
327 $tmp = dol_getdate($search_date_end);
328 $param .= '&search_date_endmonth='.urlencode($tmp['mon']).'&search_date_endday='.urlencode($tmp['mday']).'&search_date_endyear='.urlencode($tmp['year']);
329 }
330 if (!empty($search_doc_date)) {
331 $filter['t.doc_date'] = $search_doc_date;
332 $tmp = dol_getdate($search_doc_date);
333 $param .= '&doc_datemonth='.urlencode($tmp['mon']).'&doc_dateday='.urlencode($tmp['mday']).'&doc_dateyear='.urlencode($tmp['year']);
334 }
335 if (!empty($search_doc_type)) {
336 $filter['t.doc_type'] = $search_doc_type;
337 $param .= '&search_doc_type='.urlencode($search_doc_type);
338 }
339 if (!empty($search_doc_ref)) {
340 $filter['t.doc_ref'] = $search_doc_ref;
341 $param .= '&search_doc_ref='.urlencode($search_doc_ref);
342 }
343 if ($search_account_category != '-1' && !empty($search_account_category)) {
344 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
345 $accountingcategory = new AccountancyCategory($db);
346
347 $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
348 $listofaccountsforgroup2 = array();
349 if (is_array($listofaccountsforgroup)) {
350 foreach ($listofaccountsforgroup as $tmpval) {
351 $listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
352 }
353 }
354 $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
355 $param .= '&search_account_category='.urlencode($search_account_category);
356 }
357 if (!empty($search_accountancy_code)) {
358 $filter['t.numero_compte'] = $search_accountancy_code;
359 $param .= '&search_accountancy_code='.urlencode($search_accountancy_code);
360 }
361 if (!empty($search_accountancy_code_start)) {
362 $filter['t.numero_compte>='] = $search_accountancy_code_start;
363 $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start);
364 }
365 if (!empty($search_accountancy_code_end)) {
366 $filter['t.numero_compte<='] = $search_accountancy_code_end;
367 $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
368 }
369 if (!empty($search_accountancy_aux_code)) {
370 $filter['t.subledger_account'] = $search_accountancy_aux_code;
371 $param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
372 }
373 if (!empty($search_accountancy_aux_code_start)) {
374 $filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
375 $param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
376 }
377 if (!empty($search_accountancy_aux_code_end)) {
378 $filter['t.subledger_account<='] = $search_accountancy_aux_code_end;
379 $param .= '&search_accountancy_aux_code_end='.urlencode($search_accountancy_aux_code_end);
380 }
381 if (!empty($search_mvt_label)) {
382 $filter['t.label_operation'] = $search_mvt_label;
383 $param .= '&search_mvt_label='.urlencode($search_mvt_label);
384 }
385 if (!empty($search_direction)) {
386 $filter['t.sens'] = $search_direction;
387 $param .= '&search_direction='.urlencode($search_direction);
388 }
389 if (!empty($search_ledger_code)) {
390 $filter['t.code_journal'] = $search_ledger_code;
391 foreach ($search_ledger_code as $code) {
392 $param .= '&search_ledger_code[]='.urlencode($code);
393 }
394 }
395 if (!empty($search_mvt_num)) {
396 $filter['t.piece_num'] = $search_mvt_num;
397 $param .= '&search_mvt_num='.urlencode($search_mvt_num);
398 }
399 if (!empty($search_date_creation_start)) {
400 $filter['t.date_creation>='] = $search_date_creation_start;
401 $tmp = dol_getdate($search_date_creation_start);
402 $param .= '&search_date_creation_startmonth='.urlencode($tmp['mon']).'&search_date_creation_startday='.urlencode($tmp['mday']).'&search_date_creation_startyear='.urlencode($tmp['year']);
403 }
404 if (!empty($search_date_creation_end)) {
405 $filter['t.date_creation<='] = $search_date_creation_end;
406 $tmp = dol_getdate($search_date_creation_end);
407 $param .= '&search_date_creation_endmonth='.urlencode($tmp['mon']).'&search_date_creation_endday='.urlencode($tmp['mday']).'&search_date_creation_endyear='.urlencode($tmp['year']);
408 }
409 if (!empty($search_date_modification_start)) {
410 $filter['t.tms>='] = $search_date_modification_start;
411 $tmp = dol_getdate($search_date_modification_start);
412 $param .= '&search_date_modification_startmonth='.urlencode($tmp['mon']).'&search_date_modification_startday='.urlencode($tmp['mday']).'&search_date_modification_startyear='.urlencode($tmp['year']);
413 }
414 if (!empty($search_date_modification_end)) {
415 $filter['t.tms<='] = $search_date_modification_end;
416 $tmp = dol_getdate($search_date_modification_end);
417 $param .= '&search_date_modification_endmonth='.urlencode($tmp['mon']).'&search_date_modification_endday='.urlencode($tmp['mday']).'&search_date_modification_endyear='.urlencode($tmp['year']);
418 }
419 if (!empty($search_date_export_start)) {
420 $filter['t.date_export>='] = $search_date_export_start;
421 $tmp = dol_getdate($search_date_export_start);
422 $param .= '&search_date_export_startmonth='.urlencode($tmp['mon']).'&search_date_export_startday='.urlencode($tmp['mday']).'&search_date_export_startyear='.urlencode($tmp['year']);
423 }
424 if (!empty($search_date_export_end)) {
425 $filter['t.date_export<='] = $search_date_export_end;
426 $tmp = dol_getdate($search_date_export_end);
427 $param .= '&search_date_export_endmonth='.urlencode($tmp['mon']).'&search_date_export_endday='.urlencode($tmp['mday']).'&search_date_export_endyear='.urlencode($tmp['year']);
428 }
429 if (!empty($search_date_validation_start)) {
430 $filter['t.date_validated>='] = $search_date_validation_start;
431 $tmp = dol_getdate($search_date_validation_start);
432 $param .= '&search_date_validation_startmonth='.urlencode($tmp['mon']).'&search_date_validation_startday='.urlencode($tmp['mday']).'&search_date_validation_startyear='.urlencode($tmp['year']);
433 }
434 if (!empty($search_date_validation_end)) {
435 $filter['t.date_validated<='] = $search_date_validation_end;
436 $tmp = dol_getdate($search_date_validation_end);
437 $param .= '&search_date_validation_endmonth='.urlencode($tmp['mon']).'&search_date_validation_endday='.urlencode($tmp['mday']).'&search_date_validation_endyear='.urlencode($tmp['year']);
438 }
439 if (!empty($search_debit)) {
440 $filter['t.debit'] = $search_debit;
441 $param .= '&search_debit='.urlencode($search_debit);
442 }
443 if (!empty($search_credit)) {
444 $filter['t.credit'] = $search_credit;
445 $param .= '&search_credit='.urlencode($search_credit);
446 }
447 if (!empty($search_lettering_code)) {
448 $filter['t.lettering_code'] = $search_lettering_code;
449 $param .= '&search_lettering_code='.urlencode($search_lettering_code);
450 }
451 if (!empty($search_not_reconciled)) {
452 $filter['t.reconciled_option'] = $search_not_reconciled;
453 $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
454 }
455 if (!empty($search_import_key)) {
456 $filter['t.import_key'] = $search_import_key;
457 $param .= '&search_import_key='.urlencode($search_import_key);
458 }
459
460 if ($action == 'setreexport') {
461 $setreexport = GETPOST('value', 'int');
462 if (!dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) {
463 $error++;
464 }
465
466 if (!$error) {
467 if (empty($conf->global->ACCOUNTING_REEXPORT)) {
468 setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
469 } else {
470 setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'warnings');
471 }
472 } else {
473 setEventMessages($langs->trans("Error"), null, 'errors');
474 }
475 }
476
477 // Mass actions
478 $objectclass = 'Bookkeeping';
479 $objectlabel = 'Bookkeeping';
480 $permissiontoread = $user->hasRight('societe', 'lire');
481 $permissiontodelete = $user->hasRight('societe', 'supprimer');
482 $permissiontoadd = $user->hasRight('societe', 'creer');
483 $uploaddir = $conf->societe->dir_output;
484 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
485}
486
487// Build and execute select (used by page and export action)
488// must de set after the action that set $filter
489// --------------------------------------------------------------------
490
491$sql = 'SELECT';
492$sql .= ' t.rowid,';
493$sql .= " t.doc_date,";
494$sql .= " t.doc_type,";
495$sql .= " t.doc_ref,";
496$sql .= " t.fk_doc,";
497$sql .= " t.fk_docdet,";
498$sql .= " t.thirdparty_code,";
499$sql .= " t.subledger_account,";
500$sql .= " t.subledger_label,";
501$sql .= " t.numero_compte,";
502$sql .= " t.label_compte,";
503$sql .= " t.label_operation,";
504$sql .= " t.debit,";
505$sql .= " t.credit,";
506$sql .= " t.lettering_code,";
507$sql .= " t.montant as amount,";
508$sql .= " t.sens,";
509$sql .= " t.fk_user_author,";
510$sql .= " t.import_key,";
511$sql .= " t.code_journal,";
512$sql .= " t.journal_label,";
513$sql .= " t.piece_num,";
514$sql .= " t.date_creation,";
515$sql .= " t.tms as date_modification,";
516$sql .= " t.date_export,";
517$sql .= " t.date_validated as date_validation,";
518$sql .= " t.import_key";
519
520$sqlfields = $sql; // $sql fields to remove for count total
521
522$sql .= ' FROM '.MAIN_DB_PREFIX.$object->table_element.' as t';
523// Manage filter
524$sqlwhere = array();
525if (count($filter) > 0) {
526 foreach ($filter as $key => $value) {
527 if ($key == 't.doc_date') {
528 $sqlwhere[] = $key."='".$db->idate($value)."'";
529 } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
530 $sqlwhere[] = $key."'".$db->idate($value)."'";
531 } elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
532 $sqlwhere[] = $key."'".$db->escape($value)."'";
533 } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
534 $sqlwhere[] = $key.'='.((int) $value);
535 } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
536 $sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
537 } elseif ($key == 't.subledger_account') {
538 $sqlwhere[] = natural_search($key, $value, 0, 1);
539 } elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
540 $sqlwhere[] = $key."'".$db->idate($value)."'";
541 } elseif ($key == 't.tms>=' || $key == 't.tms<=') {
542 $sqlwhere[] = $key."'".$db->idate($value)."'";
543 } elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
544 $sqlwhere[] = $key."'".$db->idate($value)."'";
545 } elseif ($key == 't.date_validated>=' || $key == 't.date_validated<=') {
546 $sqlwhere[] = $key."'".$db->idate($value)."'";
547 } elseif ($key == 't.credit' || $key == 't.debit') {
548 $sqlwhere[] = natural_search($key, $value, 1, 1);
549 } elseif ($key == 't.reconciled_option') {
550 $sqlwhere[] = 't.lettering_code IS NULL';
551 } elseif ($key == 't.code_journal' && !empty($value)) {
552 if (is_array($value)) {
553 $sqlwhere[] = natural_search("t.code_journal", join(',', $value), 3, 1);
554 } else {
555 $sqlwhere[] = natural_search("t.code_journal", $value, 3, 1);
556 }
557 } elseif ($key == 't.search_accounting_code_in' && !empty($value)) {
558 $sqlwhere[] = 't.numero_compte IN ('.$db->sanitize($value, 1).')';
559 } else {
560 $sqlwhere[] = natural_search($key, $value, 0, 1);
561 }
562 }
563}
564$sql .= ' WHERE t.entity IN ('.getEntity('accountancy').')';
565if (empty($conf->global->ACCOUNTING_REEXPORT)) { // Reexport not enabled (default mode)
566 $sql .= " AND t.date_export IS NULL";
567}
568if (count($sqlwhere) > 0) {
569 $sql .= ' AND '.implode(' AND ', $sqlwhere);
570}
571//print $sql;
572
573
574// Export into a file with format defined into setup (FEC, CSV, ...)
575// Must be after definition of $sql
576if ($action == 'export_fileconfirm' && $user->hasRight('accounting', 'mouvements', 'export')) {
577 // TODO Replace the fetchAll to get all ->line followed by call to ->export(). fetchAll() currently consumes too much memory on large export.
578 // Replace this with the query($sql) and loop on each line to export them.
579 $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', (empty($conf->global->ACCOUNTING_REEXPORT) ? 0 : 1));
580
581 if ($result < 0) {
582 setEventMessages($object->error, $object->errors, 'errors');
583 } else {
584 // Export files then exit
585 $accountancyexport = new AccountancyExport($db);
586
587 $formatexport = GETPOST('formatexport', 'int');
588 $notexportlettering = GETPOST('notexportlettering', 'alpha');
589
590 if (!empty($notexportlettering)) {
591 if (is_array($object->lines)) {
592 foreach ($object->lines as $k => $movement) {
593 unset($object->lines[$k]->lettering_code);
594 unset($object->lines[$k]->date_lettering);
595 }
596 }
597 }
598
599 $notifiedexportdate = GETPOST('notifiedexportdate', 'alpha');
600 $notifiedvalidationdate = GETPOST('notifiedvalidationdate', 'alpha');
601 $withAttachment = !empty(trim(GETPOST('notifiedexportfull', 'alphanohtml'))) ? 1 : 0;
602
603 // Output data on screen or download
604 $result = $accountancyexport->export($object->lines, $formatexport, $withAttachment);
605
606 $error = 0;
607 if ($result < 0) {
608 $error++;
609 } else {
610 if (!empty($notifiedexportdate) || !empty($notifiedvalidationdate)) {
611 if (is_array($object->lines)) {
612 dol_syslog("/accountancy/bookkeeping/list.php Function export_file Specify movements as exported", LOG_DEBUG);
613
614 // Specify as export : update field date_export or date_validated
615 $db->begin();
616
617 // TODO Merge update for each line into one global using rowid IN (list of movement ids)
618 foreach ($object->lines as $movement) {
619 $now = dol_now();
620
621 $setfields = '';
622 if (!empty($notifiedexportdate) && empty($movement->date_export)) {
623 $setfields .= ($setfields ? "," : "")." date_export = '".$db->idate($now)."'";
624 }
625 if (!empty($notifiedvalidationdate) && empty($movement->date_validation)) {
626 $setfields .= ($setfields ? "," : "")." date_validated = '".$db->idate($now)."'";
627 }
628
629 if ($setfields) {
630 $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping";
631 $sql .= " SET ".$setfields;
632 $sql .= " WHERE rowid = ".((int) $movement->id);
633
634 $result = $db->query($sql);
635 if (!$result) {
636 $error++;
637 break;
638 }
639 }
640 }
641
642 if (!$error) {
643 $db->commit();
644 } else {
645 $error++;
646 $accountancyexport->errors[] = $langs->trans('NotAllExportedMovementsCouldBeRecordedAsExportedOrValidated');
647 $db->rollback();
648 }
649 }
650 }
651 }
652
653 if ($error) {
654 setEventMessages('', $accountancyexport->errors, 'errors');
655 header('Location: '.$_SERVER['PHP_SELF']);
656 }
657 exit(); // download or show errors
658 }
659}
660
661
662/*
663 * View
664 */
665
666$formother = new FormOther($db);
667$formfile = new FormFile($db);
668
669$title_page = $langs->trans("Operations").' - '.$langs->trans("ExportAccountancy");
670
671// Count total nb of records
672$nbtotalofrecords = '';
673if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
674 /* The fast and low memory method to get and count full list converts the sql into a sql count */
675 $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql);
676 $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount);
677 $resql = $db->query($sqlforcount);
678 if ($resql) {
679 $objforcount = $db->fetch_object($resql);
680 $nbtotalofrecords = $objforcount->nbtotalofrecords;
681 } else {
682 dol_print_error($db);
683 }
684
685 if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
686 $page = 0;
687 $offset = 0;
688 }
689 $db->free($resql);
690}
691
692// Complete request and execute it with limit
693$sql .= $db->order($sortfield, $sortorder);
694if ($limit) {
695 $sql .= $db->plimit($limit + 1, $offset);
696}
697
698$resql = $db->query($sql);
699if (!$resql) {
700 dol_print_error($db);
701 exit;
702}
703
704$num = $db->num_rows($resql);
705
706$arrayofselected = is_array($toselect) ? $toselect : array();
707
708// Output page
709// --------------------------------------------------------------------
710
711llxHeader('', $title_page);
712
713$formconfirm = '';
714
715if ($action == 'export_file') {
716 $form_question = array();
717
718 $form_question['formatexport'] = array(
719 'name' => 'formatexport',
720 'type' => 'select',
721 'label' => $langs->trans('Modelcsv'), // TODO Use Selectmodelcsv and show a select combo
722 'values' => $listofformat,
723 'default' => $formatexportset,
724 'morecss' => 'minwidth200 maxwidth200'
725 );
726
727 $form_question['separator0'] = array('name'=>'separator0', 'type'=>'separator');
728
729 if (getDolGlobalInt("ACCOUNTING_ENABLE_LETTERING")) {
730 // If 1, we check by default.
731 $checked = !empty($conf->global->ACCOUNTING_DEFAULT_NOT_EXPORT_LETTERING) ? 'true' : 'false';
732 $form_question['notexportlettering'] = array(
733 'name' => 'notexportlettering',
734 'type' => 'checkbox',
735 'label' => $langs->trans('NotExportLettering'),
736 'value' => $checked,
737 );
738
739 $form_question['separator1'] = array('name'=>'separator1', 'type'=>'separator');
740 }
741
742 // If 1 or not set, we check by default.
743 $checked = (!isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE));
744 $form_question['notifiedexportdate'] = array(
745 'name' => 'notifiedexportdate',
746 'type' => 'checkbox',
747 'label' => $langs->trans('NotifiedExportDate'),
748 'value' => (!empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_EXPORT_DATE) ? 'false' : 'true'),
749 );
750
751 $form_question['separator2'] = array('name'=>'separator2', 'type'=>'separator');
752
753 if (!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) {
754 // If 0 or not set, we NOT check by default.
755 $checked = (isset($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE) || !empty($conf->global->ACCOUNTING_DEFAULT_NOT_NOTIFIED_VALIDATION_DATE));
756 $form_question['notifiedvalidationdate'] = array(
757 'name' => 'notifiedvalidationdate',
758 'type' => 'checkbox',
759 'label' => $langs->trans('NotifiedValidationDate', $langs->transnoentitiesnoconv("MenuAccountancyClosure")),
760 'value' => $checked,
761 );
762
763 $form_question['separator3'] = array('name'=>'separator3', 'type'=>'separator');
764 }
765
766 // add documents in an archive for accountancy export (Quadratus)
767 $exportTypesWithDocs = array(
768 AccountancyExport::$EXPORT_TYPE_QUADRATUS,
769 );
770 $form_question['notifiedexportfull'] = array(
771 'name' => 'notifiedexportfull',
772 'type' => 'checkbox',
773 'label' => $langs->trans('NotifiedExportFull'),
774 'value' => 'false',
775 );
776
777 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans("ExportFilteredList").'...', $langs->trans('ConfirmExportFile'), 'export_fileconfirm', $form_question, '', 1, 420, 600);
778 $formconfirm .= '<script>
779jQuery(document).ready(function() {
780 const exportTypesWithDocs = ['.implode(',', $exportTypesWithDocs).'];
781 const $formatExport = jQuery("#formatexport");
782
783 function toggleExportFull() {
784 const $checkbox = jQuery("#notifiedexportfull");
785 const show = exportTypesWithDocs.indexOf(parseInt($formatExport.val())) !== -1;
786 $checkbox.closest(".tagtr").toggle(show);
787 if (!show) {
788 $checkbox.prop("checked", false); // remove checked if hidden
789 }
790 }
791
792 $formatExport.on("change", toggleExportFull);
793 toggleExportFull();
794});
795</script>';
796}
797
798// Print form confirm
799print $formconfirm;
800
801//$param=''; param started before
802if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
803 $param .= '&contextpage='.urlencode($contextpage);
804}
805if ($limit > 0 && $limit != $conf->liste_limit) {
806 $param .= '&limit='.urlencode($limit);
807}
808
809// List of mass actions available
810$arrayofmassactions = array();
811$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
812
813print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
814print '<input type="hidden" name="token" value="'.newToken().'">';
815print '<input type="hidden" name="action" value="list">';
816if ($optioncss != '') {
817 print '<input type="hidden" name="optioncss" value="'.urlencode($optioncss).'">';
818}
819print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
820print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
821print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
822print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
823
824if (count($filter)) {
825 $buttonLabel = $langs->trans("ExportFilteredList");
826} else {
827 $buttonLabel = $langs->trans("ExportList");
828}
829
830$parameters = array('param' => $param);
831$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
832if ($reshook < 0) {
833 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
834}
835
836$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
837if (empty($reshook)) {
838 // Button re-export
839 if (empty($conf->global->ACCOUNTING_REEXPORT)) {
840 $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"');
841 $newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("ClickToShowAlreadyExportedLines").'</span>';
842 $newcardbutton .= '</a>';
843 } else {
844 $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"');
845 $newcardbutton .= '<span class="valignmiddle marginrightonly paddingleft">'.$langs->trans("DocsAlreadyExportedAreIncluded").'</span>';
846 $newcardbutton .= '</a>';
847 }
848
849 if ($user->hasRight('accounting', 'mouvements', 'export')) {
850 $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'));
851 }
852}
853
854print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
855
856// Not display message when all the list of docs are included
857if (empty($conf->global->ACCOUNTING_REEXPORT)) {
858 print info_admin($langs->trans("WarningDataDisappearsWhenDataIsExported"), 0, 0, 0, 'hideonsmartphone info');
859}
860
861//$topicmail = "Information";
862//$modelmail = "accountingbookkeeping";
863//$objecttmp = new BookKeeping($db);
864//$trackid = 'bk'.$object->id;
865include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
866
867$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
868$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
869if ($massactionbutton && $contextpage != 'poslist') {
870 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
871}
872
873$moreforfilter = '';
874$moreforfilter .= '<div class="divsearchfield">';
875$moreforfilter .= $langs->trans('AccountingCategory').': ';
876$moreforfilter .= '<div class="nowrap inline-block">';
877$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
878$moreforfilter .= '</div>';
879$moreforfilter .= '</div>';
880
881$parameters = array();
882$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
883if (empty($reshook)) {
884 $moreforfilter .= $hookmanager->resPrint;
885} else {
886 $moreforfilter = $hookmanager->resPrint;
887}
888
889print '<div class="liste_titre liste_titre_bydiv centpercent">';
890print $moreforfilter;
891print '</div>';
892
893print '<div class="div-table-responsive">';
894print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">';
895
896// Filters lines
897print '<tr class="liste_titre_filter">';
898// Action column
899if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
900 print '<td class="liste_titre center">';
901 $searchpicto = $form->showFilterButtons('left');
902 print $searchpicto;
903 print '</td>';
904}
905// Movement number
906if (!empty($arrayfields['t.piece_num']['checked'])) {
907 print '<td class="liste_titre"><input type="text" name="search_mvt_num" size="6" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
908}
909// Code journal
910if (!empty($arrayfields['t.code_journal']['checked'])) {
911 print '<td class="liste_titre center">';
912 print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'small maxwidth75');
913 print '</td>';
914}
915// Date document
916if (!empty($arrayfields['t.doc_date']['checked'])) {
917 print '<td class="liste_titre center">';
918 print '<div class="nowrap">';
919 print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
920 print '</div>';
921 print '<div class="nowrap">';
922 print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
923 print '</div>';
924 print '</td>';
925}
926// Ref document
927if (!empty($arrayfields['t.doc_ref']['checked'])) {
928 print '<td class="liste_titre"><input type="text" name="search_doc_ref" size="8" value="'.dol_escape_htmltag($search_doc_ref).'"></td>';
929}
930// Accountancy account
931if (!empty($arrayfields['t.numero_compte']['checked'])) {
932 print '<td class="liste_titre">';
933 print '<div class="nowrap">';
934 print $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth150', 'account');
935 print '</div>';
936 print '<div class="nowrap">';
937 print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth150', 'account');
938 print '</div>';
939 print '</td>';
940}
941// Subledger account
942if (!empty($arrayfields['t.subledger_account']['checked'])) {
943 print '<td class="liste_titre">';
944 // TODO For the moment we keep a free input text instead of a combo. The select_auxaccount has problem because it does not
945 // use setup of keypress to select thirdparty and this hang browser on large database.
946 if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) {
947 print '<div class="nowrap">';
948 //print $langs->trans('From').' ';
949 print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', $langs->trans('From'), 'maxwidth250', 'subledgeraccount');
950 print '</div>';
951 print '<div class="nowrap">';
952 print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', $langs->trans('to'), 'maxwidth250', 'subledgeraccount');
953 print '</div>';
954 } else {
955 print '<input type="text" class="maxwidth75" name="search_accountancy_aux_code" value="'.dol_escape_htmltag($search_accountancy_aux_code).'">';
956 }
957 print '</td>';
958}
959// Label operation
960if (!empty($arrayfields['t.label_operation']['checked'])) {
961 print '<td class="liste_titre">';
962 print '<input type="text" size="7" class="flat" name="search_mvt_label" value="'.dol_escape_htmltag($search_mvt_label).'"/>';
963 print '</td>';
964}
965// Debit
966if (!empty($arrayfields['t.debit']['checked'])) {
967 print '<td class="liste_titre right">';
968 print '<input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'">';
969 print '</td>';
970}
971// Credit
972if (!empty($arrayfields['t.credit']['checked'])) {
973 print '<td class="liste_titre right">';
974 print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
975 print '</td>';
976}
977// Lettering code
978if (!empty($arrayfields['t.lettering_code']['checked'])) {
979 print '<td class="liste_titre center">';
980 print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.dol_escape_htmltag($search_lettering_code).'"/>';
981 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>';
982 print '</td>';
983}
984
985// Fields from hook
986$parameters = array('arrayfields'=>$arrayfields);
987$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
988print $hookmanager->resPrint;
989
990// Date creation
991if (!empty($arrayfields['t.date_creation']['checked'])) {
992 print '<td class="liste_titre center">';
993 print '<div class="nowrap">';
994 print $form->selectDate($search_date_creation_start, 'search_date_creation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
995 print '</div>';
996 print '<div class="nowrap">';
997 print $form->selectDate($search_date_creation_end, 'search_date_creation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
998 print '</div>';
999 print '</td>';
1000}
1001// Date modification
1002if (!empty($arrayfields['t.tms']['checked'])) {
1003 print '<td class="liste_titre center">';
1004 print '<div class="nowrap">';
1005 print $form->selectDate($search_date_modification_start, 'search_date_modification_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
1006 print '</div>';
1007 print '<div class="nowrap">';
1008 print $form->selectDate($search_date_modification_end, 'search_date_modification_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
1009 print '</div>';
1010 print '</td>';
1011}
1012// Date export
1013if (!empty($arrayfields['t.date_export']['checked'])) {
1014 print '<td class="liste_titre center">';
1015 print '<div class="nowrap">';
1016 print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
1017 print '</div>';
1018 print '<div class="nowrap">';
1019 print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1020 print '</div>';
1021 print '</td>';
1022}
1023// Date validation
1024if (!empty($arrayfields['t.date_validated']['checked'])) {
1025 print '<td class="liste_titre center">';
1026 print '<div class="nowrap">';
1027 print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
1028 print '</div>';
1029 print '<div class="nowrap">';
1030 print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
1031 print '</div>';
1032 print '</td>';
1033}
1034if (!empty($arrayfields['t.import_key']['checked'])) {
1035 print '<td class="liste_titre center">';
1036 print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
1037 print '</td>';
1038}
1039// Action column
1040if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1041 print '<td class="liste_titre center">';
1042 $searchpicto = $form->showFilterButtons();
1043 print $searchpicto;
1044 print '</td>';
1045}
1046print "</tr>\n";
1047
1048print '<tr class="liste_titre">';
1049if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1050 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch actioncolumn ');}
1051if (!empty($arrayfields['t.piece_num']['checked'])) {
1052 print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, "", $sortfield, $sortorder);
1053}
1054if (!empty($arrayfields['t.code_journal']['checked'])) {
1055 print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
1056}
1057if (!empty($arrayfields['t.doc_date']['checked'])) {
1058 print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
1059}
1060if (!empty($arrayfields['t.doc_ref']['checked'])) {
1061 print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
1062}
1063if (!empty($arrayfields['t.numero_compte']['checked'])) {
1064 print_liste_field_titre($arrayfields['t.numero_compte']['label'], $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder);
1065}
1066if (!empty($arrayfields['t.subledger_account']['checked'])) {
1067 print_liste_field_titre($arrayfields['t.subledger_account']['label'], $_SERVER['PHP_SELF'], "t.subledger_account", "", $param, "", $sortfield, $sortorder);
1068}
1069if (!empty($arrayfields['t.label_operation']['checked'])) {
1070 print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
1071}
1072if (!empty($arrayfields['t.debit']['checked'])) {
1073 print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
1074}
1075if (!empty($arrayfields['t.credit']['checked'])) {
1076 print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
1077}
1078if (!empty($arrayfields['t.lettering_code']['checked'])) {
1079 print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
1080}
1081// Hook fields
1082$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
1083$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
1084print $hookmanager->resPrint;
1085if (!empty($arrayfields['t.date_creation']['checked'])) {
1086 print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center ');
1087}
1088if (!empty($arrayfields['t.tms']['checked'])) {
1089 print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center ');
1090}
1091if (!empty($arrayfields['t.date_export']['checked'])) {
1092 print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
1093}
1094if (!empty($arrayfields['t.date_validated']['checked'])) {
1095 print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated,t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
1096}
1097if (!empty($arrayfields['t.import_key']['checked'])) {
1098 print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
1099}
1100if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1101 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
1102}
1103print "</tr>\n";
1104
1105
1106$line = new BookKeepingLine();
1107
1108// Loop on record
1109// --------------------------------------------------------------------
1110$i = 0;
1111$totalarray = array();
1112$totalarray['nbfield'] = 0;
1113$total_debit = 0;
1114$total_credit = 0;
1115$totalarray['val'] = array ();
1116$totalarray['val']['totaldebit'] = 0;
1117$totalarray['val']['totalcredit'] = 0;
1118
1119while ($i < min($num, $limit)) {
1120 $obj = $db->fetch_object($resql);
1121 if (empty($obj)) {
1122 break; // Should not happen
1123 }
1124
1125 $line->id = $obj->rowid;
1126 $line->doc_date = $db->jdate($obj->doc_date);
1127 $line->doc_type = $obj->doc_type;
1128 $line->doc_ref = $obj->doc_ref;
1129 $line->fk_doc = $obj->fk_doc;
1130 $line->fk_docdet = $obj->fk_docdet;
1131 $line->thirdparty_code = $obj->thirdparty_code;
1132 $line->subledger_account = $obj->subledger_account;
1133 $line->subledger_label = $obj->subledger_label;
1134 $line->numero_compte = $obj->numero_compte;
1135 $line->label_compte = $obj->label_compte;
1136 $line->label_operation = $obj->label_operation;
1137 $line->debit = $obj->debit;
1138 $line->credit = $obj->credit;
1139 $line->montant = $obj->amount; // deprecated
1140 $line->amount = $obj->amount;
1141 $line->sens = $obj->sens;
1142 $line->lettering_code = $obj->lettering_code;
1143 $line->fk_user_author = $obj->fk_user_author;
1144 $line->import_key = $obj->import_key;
1145 $line->code_journal = $obj->code_journal;
1146 $line->journal_label = $obj->journal_label;
1147 $line->piece_num = $obj->piece_num;
1148 $line->date_creation = $db->jdate($obj->date_creation);
1149 $line->date_modification = $db->jdate($obj->date_modification);
1150 $line->date_export = $db->jdate($obj->date_export);
1151 $line->date_validation = $db->jdate($obj->date_validation);
1152
1153 $total_debit += $line->debit;
1154 $total_credit += $line->credit;
1155
1156 print '<tr class="oddeven">';
1157 // Action column
1158 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1159 print '<td class="nowraponall center">';
1160 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
1161 $selected = 0;
1162 if (in_array($line->id, $arrayofselected)) {
1163 $selected = 1;
1164 }
1165 print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1166 }
1167 print '</td>';
1168 if (!$i) {
1169 $totalarray['nbfield']++;
1170 }
1171 }
1172
1173 // Piece number
1174 if (!empty($arrayfields['t.piece_num']['checked'])) {
1175 print '<td>';
1176 $object->id = $line->id;
1177 $object->piece_num = $line->piece_num;
1178 print $object->getNomUrl(1, '', 0, '', 1);
1179 print '</td>';
1180 if (!$i) {
1181 $totalarray['nbfield']++;
1182 }
1183 }
1184
1185 // Journal code
1186 if (!empty($arrayfields['t.code_journal']['checked'])) {
1187 $accountingjournal = new AccountingJournal($db);
1188 $result = $accountingjournal->fetch('', $line->code_journal);
1189 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
1190 print '<td class="center tdoverflowmax150">'.$journaltoshow.'</td>';
1191 if (!$i) {
1192 $totalarray['nbfield']++;
1193 }
1194 }
1195
1196 // Document date
1197 if (!empty($arrayfields['t.doc_date']['checked'])) {
1198 print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
1199 if (!$i) {
1200 $totalarray['nbfield']++;
1201 }
1202 }
1203
1204 // Document ref
1205 if (!empty($arrayfields['t.doc_ref']['checked'])) {
1206 if ($line->doc_type == 'customer_invoice') {
1207 $langs->loadLangs(array('bills'));
1208
1209 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1210 $objectstatic = new Facture($db);
1211 $objectstatic->fetch($line->fk_doc);
1212
1213 $filename = dol_sanitizeFileName($line->doc_ref);
1214 $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1215 $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1216 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1217 } elseif ($line->doc_type == 'supplier_invoice') {
1218 $langs->loadLangs(array('bills'));
1219
1220 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
1221 $objectstatic = new FactureFournisseur($db);
1222 $objectstatic->fetch($line->fk_doc);
1223
1224 $filename = dol_sanitizeFileName($line->doc_ref);
1225 $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref);
1226 $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $objectstatic->element).dol_sanitizeFileName($line->doc_ref);
1227 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1228 } elseif ($line->doc_type == 'expense_report') {
1229 $langs->loadLangs(array('trips'));
1230
1231 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
1232 $objectstatic = new ExpenseReport($db);
1233 $objectstatic->fetch($line->fk_doc);
1234
1235 $filename = dol_sanitizeFileName($line->doc_ref);
1236 $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1237 $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1238 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1239 } elseif ($line->doc_type == 'bank') {
1240 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
1241 $objectstatic = new AccountLine($db);
1242 $objectstatic->fetch($line->fk_doc);
1243 } else {
1244 // Other type
1245 }
1246
1247 $labeltoshow = '';
1248 $labeltoshowalt = '';
1249 if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
1250 $labeltoshow .= $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
1251 $labeltoshow .= $documentlink;
1252 $labeltoshowalt .= $objectstatic->ref;
1253 } elseif ($line->doc_type == 'bank') {
1254 $labeltoshow .= $objectstatic->getNomUrl(1);
1255 $labeltoshowalt .= $objectstatic->ref;
1256 $bank_ref = strstr($line->doc_ref, '-');
1257 $labeltoshow .= " " . $bank_ref;
1258 $labeltoshowalt .= " " . $bank_ref;
1259 } else {
1260 $labeltoshow .= $line->doc_ref;
1261 $labeltoshowalt .= $line->doc_ref;
1262 }
1263
1264 print '<td class="nowraponall tdoverflowmax200" title="'.dol_escape_htmltag($labeltoshowalt).'">';
1265 print $labeltoshow;
1266 print "</td>\n";
1267 if (!$i) {
1268 $totalarray['nbfield']++;
1269 }
1270 }
1271
1272 // Account number
1273 if (!empty($arrayfields['t.numero_compte']['checked'])) {
1274 print '<td>'.length_accountg($line->numero_compte).'</td>';
1275 if (!$i) {
1276 $totalarray['nbfield']++;
1277 }
1278 }
1279
1280 // Subledger account
1281 if (!empty($arrayfields['t.subledger_account']['checked'])) {
1282 print '<td>'.length_accounta($line->subledger_account).'</td>';
1283 if (!$i) {
1284 $totalarray['nbfield']++;
1285 }
1286 }
1287
1288 // Label operation
1289 if (!empty($arrayfields['t.label_operation']['checked'])) {
1290 print '<td class="small tdoverflowmax200" title="'.dol_escape_htmltag($line->label_operation).'">'.dol_escape_htmltag($line->label_operation).'</td>';
1291 if (!$i) {
1292 $totalarray['nbfield']++;
1293 }
1294 }
1295
1296 // Amount debit
1297 if (!empty($arrayfields['t.debit']['checked'])) {
1298 print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
1299 if (!$i) {
1300 $totalarray['nbfield']++;
1301 }
1302 if (!$i) {
1303 $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
1304 }
1305 $totalarray['val']['totaldebit'] += $line->debit;
1306 }
1307
1308 // Amount credit
1309 if (!empty($arrayfields['t.credit']['checked'])) {
1310 print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
1311 if (!$i) {
1312 $totalarray['nbfield']++;
1313 }
1314 if (!$i) {
1315 $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
1316 }
1317 $totalarray['val']['totalcredit'] += $line->credit;
1318 }
1319
1320 // Lettering code
1321 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1322 print '<td class="center">'.$line->lettering_code.'</td>';
1323 if (!$i) {
1324 $totalarray['nbfield']++;
1325 }
1326 }
1327
1328 // Fields from hook
1329 $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
1330 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1331 print $hookmanager->resPrint;
1332
1333 // Creation operation date
1334 if (!empty($arrayfields['t.date_creation']['checked'])) {
1335 print '<td class="center">'.dol_print_date($line->date_creation, 'dayhour', 'tzuserrel').'</td>';
1336 if (!$i) {
1337 $totalarray['nbfield']++;
1338 }
1339 }
1340
1341 // Modification operation date
1342 if (!empty($arrayfields['t.tms']['checked'])) {
1343 print '<td class="center">'.dol_print_date($line->date_modification, 'dayhour', 'tzuserrel').'</td>';
1344 if (!$i) {
1345 $totalarray['nbfield']++;
1346 }
1347 }
1348
1349 // Exported operation date
1350 if (!empty($arrayfields['t.date_export']['checked'])) {
1351 print '<td class="center nowraponall">'.dol_print_date($line->date_export, 'dayhour', 'tzuserrel').'</td>';
1352 if (!$i) {
1353 $totalarray['nbfield']++;
1354 }
1355 }
1356
1357 // Validated operation date
1358 if (!empty($arrayfields['t.date_validated']['checked'])) {
1359 print '<td class="center nowraponall">'.dol_print_date($line->date_validation, 'dayhour', 'tzuserrel').'</td>';
1360 if (!$i) {
1361 $totalarray['nbfield']++;
1362 }
1363 }
1364
1365 if (!empty($arrayfields['t.import_key']['checked'])) {
1366 print '<td class="tdoverflowmax100">'.$obj->import_key."</td>\n";
1367 if (!$i) {
1368 $totalarray['nbfield']++;
1369 }
1370 }
1371
1372 // Action column
1373 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1374 print '<td class="nowraponall center">';
1375 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
1376 $selected = 0;
1377 if (in_array($line->id, $arrayofselected)) {
1378 $selected = 1;
1379 }
1380 print '<input id="cb'.$line->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$line->id.'"'.($selected ? ' checked="checked"' : '').' />';
1381 }
1382 print '</td>';
1383 if (!$i) {
1384 $totalarray['nbfield']++;
1385 }
1386 }
1387
1388
1389 print "</tr>\n";
1390
1391 $i++;
1392}
1393
1394// Show total line
1395include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1396
1397// If no record found
1398if ($num == 0) {
1399 $colspan = 1;
1400 foreach ($arrayfields as $key => $val) {
1401 if (!empty($val['checked'])) {
1402 $colspan++;
1403 }
1404 }
1405 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1406}
1407
1408$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
1409$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1410print $hookmanager->resPrint;
1411
1412print "</table>";
1413print '</div>';
1414
1415print '</form>';
1416
1417// End of page
1418llxFooter();
1419
1420$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:56
llxFooter()
Empty footer.
Definition wrapper.php:70
Class to manage bank transaction lines.
Class to manage categories of an accounting account.
Manage the different format accountancy export.
Class to manage accounting accounts.
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:597
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 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.