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