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