dolibarr 20.0.0
listbyaccount.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2016 Neil Orley <neil.orley@oeris.fr>
3 * Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
4 * Copyright (C) 2013-2020 Florian Henry <florian.henry@open-concept.pro>
5 * Copyright (C) 2013-2024 Alexandre Spangaro <alexandre@inovea-conseil.com>
6 * Copyright (C) 2018-2024 Frédéric France <frederic.france@free.fr>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29// Load Dolibarr environment
30require '../../main.inc.php';
31
32require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
33require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
34require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
35require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
40
41// Load translation files required by the page
42$langs->loadLangs(array("accountancy", "compta"));
43
44$action = GETPOST('action', 'aZ09');
45$socid = GETPOSTINT('socid');
46$massaction = GETPOST('massaction', 'alpha');
47$confirm = GETPOST('confirm', 'alpha');
48$toselect = GETPOST('toselect', 'array');
49$type = GETPOST('type', 'alpha');
50if ($type == 'sub') {
51 $context_default = 'bookkeepingbysubaccountlist';
52} else {
53 $context_default = 'bookkeepingbyaccountlist';
54}
55$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
56$search_date_startyear = GETPOSTINT('search_date_startyear');
57$search_date_startmonth = GETPOSTINT('search_date_startmonth');
58$search_date_startday = GETPOSTINT('search_date_startday');
59$search_date_endyear = GETPOSTINT('search_date_endyear');
60$search_date_endmonth = GETPOSTINT('search_date_endmonth');
61$search_date_endday = GETPOSTINT('search_date_endday');
62$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
63$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
64$search_doc_date = dol_mktime(0, 0, 0, GETPOSTINT('doc_datemonth'), GETPOSTINT('doc_dateday'), GETPOSTINT('doc_dateyear'));
65$search_date_export_startyear = GETPOSTINT('search_date_export_startyear');
66$search_date_export_startmonth = GETPOSTINT('search_date_export_startmonth');
67$search_date_export_startday = GETPOSTINT('search_date_export_startday');
68$search_date_export_endyear = GETPOSTINT('search_date_export_endyear');
69$search_date_export_endmonth = GETPOSTINT('search_date_export_endmonth');
70$search_date_export_endday = GETPOSTINT('search_date_export_endday');
71$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
72$search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
73$search_date_validation_startyear = GETPOSTINT('search_date_validation_startyear');
74$search_date_validation_startmonth = GETPOSTINT('search_date_validation_startmonth');
75$search_date_validation_startday = GETPOSTINT('search_date_validation_startday');
76$search_date_validation_endyear = GETPOSTINT('search_date_validation_endyear');
77$search_date_validation_endmonth = GETPOSTINT('search_date_validation_endmonth');
78$search_date_validation_endday = GETPOSTINT('search_date_validation_endday');
79$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
80$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
81$search_import_key = GETPOST("search_import_key", 'alpha');
82
83$search_account_category = GETPOSTINT('search_account_category');
84
85$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
86if ($search_accountancy_code_start == - 1) {
87 $search_accountancy_code_start = '';
88}
89$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
90if ($search_accountancy_code_end == - 1) {
91 $search_accountancy_code_end = '';
92}
93$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
94$search_label_operation = GETPOST('search_label_operation', 'alpha');
95$search_mvt_num = GETPOST('search_mvt_num', 'alpha');
96$search_direction = GETPOST('search_direction', 'alpha');
97$search_ledger_code = GETPOST('search_ledger_code', 'array');
98$search_debit = GETPOST('search_debit', 'alpha');
99$search_credit = GETPOST('search_credit', 'alpha');
100$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
101$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
102
103if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
104 $action = 'delbookkeepingyear';
105}
106
107// Load variable for pagination
108$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
109$sortfield = GETPOST('sortfield', 'aZ09comma');
110$sortorder = GETPOST('sortorder', 'aZ09comma');
111$optioncss = GETPOST('optioncss', 'alpha');
112$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
113if (empty($page) || $page < 0) {
114 $page = 0;
115}
116$offset = $limit * $page;
117$pageprev = $page - 1;
118$pagenext = $page + 1;
119if ($sortorder == "") {
120 $sortorder = "ASC";
121}
122if ($sortfield == "") {
123 $sortfield = "t.doc_date,t.rowid";
124}
125
126// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
127$object = new BookKeeping($db);
128$formfile = new FormFile($db);
129$hookmanager->initHooks(array($context_default));
130
131$formaccounting = new FormAccounting($db);
132$form = new Form($db);
133
134if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
135 $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
136 $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
137 $sql .= $db->plimit(1);
138 $res = $db->query($sql);
139
140 if ($res->num_rows > 0) {
141 $fiscalYear = $db->fetch_object($res);
142 $search_date_start = strtotime($fiscalYear->date_start);
143 $search_date_end = strtotime($fiscalYear->date_end);
144 } else {
145 $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
146 $year_start = dol_print_date(dol_now(), '%Y');
147 if (dol_print_date(dol_now(), '%m') < $month_start) {
148 $year_start--; // If current month is lower that starting fiscal month, we start last year
149 }
150 $year_end = $year_start + 1;
151 $month_end = $month_start - 1;
152 if ($month_end < 1) {
153 $month_end = 12;
154 $year_end--;
155 }
156 $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
157 $search_date_end = dol_get_last_day($year_end, $month_end);
158 }
159}
160
161$arrayfields = array(
162 // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
163 't.piece_num' => array('label' => $langs->trans("TransactionNumShort"), 'checked' => 1),
164 't.code_journal' => array('label' => $langs->trans("Codejournal"), 'checked' => 1),
165 't.doc_date' => array('label' => $langs->trans("Docdate"), 'checked' => 1),
166 't.doc_ref' => array('label' => $langs->trans("Piece"), 'checked' => 1),
167 't.label_operation' => array('label' => $langs->trans("Label"), 'checked' => 1),
168 't.lettering_code' => array('label' => $langs->trans("Lettering"), 'checked' => 1),
169 't.debit' => array('label' => $langs->trans("AccountingDebit"), 'checked' => 1),
170 't.credit' => array('label' => $langs->trans("AccountingCredit"), 'checked' => 1),
171 't.balance' => array('label' => $langs->trans("Balance"), 'checked' => 1),
172 't.date_export' => array('label' => $langs->trans("DateExport"), 'checked' => -1),
173 't.date_validated' => array('label' => $langs->trans("DateValidation"), 'checked' => -1, 'enabled' => !getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
174 't.import_key' => array('label' => $langs->trans("ImportId"), 'checked' => -1, 'position' => 1100),
175);
176
177if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) {
178 unset($arrayfields['t.lettering_code']);
179}
180
181if ($search_date_start && empty($search_date_startyear)) {
182 $tmparray = dol_getdate($search_date_start);
183 $search_date_startyear = $tmparray['year'];
184 $search_date_startmonth = $tmparray['mon'];
185 $search_date_startday = $tmparray['mday'];
186}
187if ($search_date_end && empty($search_date_endyear)) {
188 $tmparray = dol_getdate($search_date_end);
189 $search_date_endyear = $tmparray['year'];
190 $search_date_endmonth = $tmparray['mon'];
191 $search_date_endday = $tmparray['mday'];
192}
193
194if (!isModEnabled('accounting')) {
196}
197if ($user->socid > 0) {
199}
200if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
202}
203
204$error = 0;
205
206$permissiontoadd = $user->hasRight('accounting', 'mouvements', 'creer');
207
208
209/*
210 * Action
211 */
212
213$param = '';
214
215if (GETPOST('cancel', 'alpha')) {
216 $action = 'list';
217 $massaction = '';
218}
219if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
220 $massaction = '';
221}
222
223$parameters = array('socid' => $socid);
224$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
225if ($reshook < 0) {
226 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
227}
228
229if (empty($reshook)) {
230 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
231
232 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
233 $search_doc_date = '';
234 $search_account_category = '';
235 $search_accountancy_code_start = '';
236 $search_accountancy_code_end = '';
237 $search_label_account = '';
238 $search_doc_ref = '';
239 $search_label_operation = '';
240 $search_mvt_num = '';
241 $search_direction = '';
242 $search_ledger_code = array();
243 $search_date_start = '';
244 $search_date_end = '';
245 $search_date_startyear = '';
246 $search_date_startmonth = '';
247 $search_date_startday = '';
248 $search_date_endyear = '';
249 $search_date_endmonth = '';
250 $search_date_endday = '';
251 $search_date_export_start = '';
252 $search_date_export_end = '';
253 $search_date_export_startyear = '';
254 $search_date_export_startmonth = '';
255 $search_date_export_startday = '';
256 $search_date_export_endyear = '';
257 $search_date_export_endmonth = '';
258 $search_date_export_endday = '';
259 $search_date_validation_start = '';
260 $search_date_validation_end = '';
261 $search_date_validation_startyear = '';
262 $search_date_validation_startmonth = '';
263 $search_date_validation_startday = '';
264 $search_date_validation_endyear = '';
265 $search_date_validation_endmonth = '';
266 $search_date_validation_endday = '';
267 $search_lettering_code = '';
268 $search_debit = '';
269 $search_credit = '';
270 $search_not_reconciled = '';
271 $search_import_key = '';
272 $toselect = array();
273 }
274
275 // Must be after the remove filter action, before the export.
276 $filter = array();
277
278 if (!empty($search_date_start)) {
279 $filter['t.doc_date>='] = $search_date_start;
280 $param .= '&search_date_startmonth='.$search_date_startmonth.'&search_date_startday='.$search_date_startday.'&search_date_startyear='.$search_date_startyear;
281 }
282 if (!empty($search_date_end)) {
283 $filter['t.doc_date<='] = $search_date_end;
284 $param .= '&search_date_endmonth='.$search_date_endmonth.'&search_date_endday='.$search_date_endday.'&search_date_endyear='.$search_date_endyear;
285 }
286 if (!empty($search_doc_date)) {
287 $filter['t.doc_date'] = $search_doc_date;
288 $param .= '&doc_datemonth='.GETPOSTINT('doc_datemonth').'&doc_dateday='.GETPOSTINT('doc_dateday').'&doc_dateyear='.GETPOSTINT('doc_dateyear');
289 }
290 if ($search_account_category != '-1' && !empty($search_account_category)) {
291 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
292 $accountingcategory = new AccountancyCategory($db);
293
294 $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
295 $listofaccountsforgroup2 = array();
296 if (is_array($listofaccountsforgroup)) {
297 foreach ($listofaccountsforgroup as $tmpval) {
298 $listofaccountsforgroup2[] = "'".$db->escape($tmpval['id'])."'";
299 }
300 }
301 $filter['t.search_accounting_code_in'] = implode(',', $listofaccountsforgroup2);
302 $param .= '&search_account_category='.urlencode((string) ($search_account_category));
303 }
304 if (!empty($search_accountancy_code_start)) {
305 if ($type == 'sub') {
306 $filter['t.subledger_account>='] = $search_accountancy_code_start;
307 } else {
308 $filter['t.numero_compte>='] = $search_accountancy_code_start;
309 }
310 $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
311 }
312 if (!empty($search_accountancy_code_end)) {
313 if ($type == 'sub') {
314 $filter['t.subledger_account<='] = $search_accountancy_code_end;
315 } else {
316 $filter['t.numero_compte<='] = $search_accountancy_code_end;
317 }
318 $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
319 }
320 if (!empty($search_label_account)) {
321 $filter['t.label_compte'] = $search_label_account;
322 $param .= '&search_label_compte='.urlencode($search_label_account);
323 }
324 if (!empty($search_mvt_num)) {
325 $filter['t.piece_num'] = $search_mvt_num;
326 $param .= '&search_mvt_num='.urlencode((string) ($search_mvt_num));
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 (!empty($search_label_operation)) {
333 $filter['t.label_operation'] = $search_label_operation;
334 $param .= '&search_label_operation='.urlencode($search_label_operation);
335 }
336 if (!empty($search_direction)) {
337 $filter['t.sens'] = $search_direction;
338 $param .= '&search_direction='.urlencode($search_direction);
339 }
340 if (!empty($search_ledger_code)) {
341 $filter['t.code_journal'] = $search_ledger_code;
342 foreach ($search_ledger_code as $code) {
343 $param .= '&search_ledger_code[]='.urlencode($code);
344 }
345 }
346 if (!empty($search_lettering_code)) {
347 $filter['t.lettering_code'] = $search_lettering_code;
348 $param .= '&search_lettering_code='.urlencode($search_lettering_code);
349 }
350 if (!empty($search_debit)) {
351 $filter['t.debit'] = $search_debit;
352 $param .= '&search_debit='.urlencode($search_debit);
353 }
354 if (!empty($search_credit)) {
355 $filter['t.credit'] = $search_credit;
356 $param .= '&search_credit='.urlencode($search_credit);
357 }
358 if (!empty($search_not_reconciled)) {
359 $filter['t.reconciled_option'] = $search_not_reconciled;
360 $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
361 }
362 if (!empty($search_date_export_start)) {
363 $filter['t.date_export>='] = $search_date_export_start;
364 $param .= '&search_date_export_startmonth='.$search_date_export_startmonth.'&search_date_export_startday='.$search_date_export_startday.'&search_date_export_startyear='.$search_date_export_startyear;
365 }
366 if (!empty($search_date_export_end)) {
367 $filter['t.date_export<='] = $search_date_export_end;
368 $param .= '&search_date_export_endmonth='.$search_date_export_endmonth.'&search_date_export_endday='.$search_date_export_endday.'&search_date_export_endyear='.$search_date_export_endyear;
369 }
370 if (!empty($search_date_validation_start)) {
371 $filter['t.date_validated>='] = $search_date_validation_start;
372 $param .= '&search_date_validation_startmonth='.$search_date_validation_startmonth.'&search_date_validation_startday='.$search_date_validation_startday.'&search_date_validation_startyear='.$search_date_validation_startyear;
373 }
374 if (!empty($search_date_validation_end)) {
375 $filter['t.date_validated<='] = $search_date_validation_end;
376 $param .= '&search_date_validation_endmonth='.$search_date_validation_endmonth.'&search_date_validation_endday='.$search_date_validation_endday.'&search_date_validation_endyear='.$search_date_validation_endyear;
377 }
378 if (!empty($search_import_key)) {
379 $filter['t.import_key'] = $search_import_key;
380 $param .= '&search_import_key='.urlencode($search_import_key);
381 }
382 // param with type of list
383 $url_param = substr($param, 1); // remove first "&"
384 if (!empty($type)) {
385 $param = '&type='.$type.$param;
386 }
387
388 //if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) {
389 // $delmonth = GETPOST('delmonth', 'int');
390 // $delyear = GETPOST('delyear', 'int');
391 // if ($delyear == -1) {
392 // $delyear = 0;
393 // }
394 // $deljournal = GETPOST('deljournal', 'alpha');
395 // if ($deljournal == -1) {
396 // $deljournal = 0;
397 // }
398 //
399 // if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
400 // $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
401 // if ($result < 0) {
402 // setEventMessages($object->error, $object->errors, 'errors');
403 // } else {
404 // setEventMessages("RecordDeleted", null, 'mesgs');
405 // }
406 //
407 // // Make a redirect to avoid to launch the delete later after a back button
408 // header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
409 // exit;
410 // } else {
411 // setEventMessages("NoRecordDeleted", null, 'warnings');
412 // }
413 //}
414
415 // Mass actions
416 $objectclass = 'Bookkeeping';
417 $objectlabel = 'Bookkeeping';
418 $permissiontoread = $user->hasRight('societe', 'lire');
419 $permissiontodelete = $user->hasRight('societe', 'supprimer');
420 $permissiontoadd = $user->hasRight('societe', 'creer');
421 $uploaddir = $conf->societe->dir_output;
422 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
423
424 if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
425 $db->begin();
426
427 if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
428 $lettering = new Lettering($db);
429 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
430 if ($nb_lettering < 0) {
431 setEventMessages('', $lettering->errors, 'errors');
432 $error++;
433 }
434 }
435
436 $nbok = 0;
437 if (!$error) {
438 foreach ($toselect as $toselectid) {
439 $result = $object->fetch($toselectid);
440 if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
441 $result = $object->deleteMvtNum($object->piece_num);
442 if ($result > 0) {
443 $nbok++;
444 } else {
445 setEventMessages($object->error, $object->errors, 'errors');
446 $error++;
447 break;
448 }
449 } elseif ($result < 0) {
450 setEventMessages($object->error, $object->errors, 'errors');
451 $error++;
452 break;
453 } elseif (isset($object->date_validation) && $object->date_validation != '') {
454 setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
455 $error++;
456 break;
457 }
458 }
459 }
460
461 if (!$error) {
462 $db->commit();
463
464 // Message for elements well deleted
465 if ($nbok > 1) {
466 setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
467 } elseif ($nbok > 0) {
468 setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
469 } elseif (!$error) {
470 setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
471 }
472
473 header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
474 exit;
475 } else {
476 $db->rollback();
477 }
478 }
479
480 // others mass actions
481 if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
482 if ($massaction == 'letteringauto' && $permissiontoadd) {
483 $lettering = new Lettering($db);
484 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
485 if ($nb_lettering < 0) {
486 setEventMessages('', $lettering->errors, 'errors');
487 $error++;
488 $nb_lettering = max(0, abs($nb_lettering) - 2);
489 } elseif ($nb_lettering == 0) {
490 $nb_lettering = 0;
491 setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs');
492 }
493 if ($nb_lettering == 1) {
494 setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
495 } elseif ($nb_lettering > 1) {
496 setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
497 }
498
499 if (!$error) {
500 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
501 exit();
502 }
503 } elseif ($massaction == 'letteringmanual' && $permissiontoadd) {
504 $lettering = new Lettering($db);
505 $result = $lettering->updateLettering($toselect);
506 if ($result < 0) {
507 setEventMessages('', $lettering->errors, 'errors');
508 } else {
509 setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
510 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
511 exit();
512 }
513 } elseif ($action == 'unletteringauto' && $confirm == "yes" && $permissiontoadd) {
514 $lettering = new Lettering($db);
515 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
516 if ($nb_lettering < 0) {
517 setEventMessages('', $lettering->errors, 'errors');
518 $error++;
519 $nb_lettering = max(0, abs($nb_lettering) - 2);
520 } elseif ($nb_lettering == 0) {
521 $nb_lettering = 0;
522 setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs');
523 }
524 if ($nb_lettering == 1) {
525 setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
526 } elseif ($nb_lettering > 1) {
527 setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
528 }
529
530 if (!$error) {
531 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
532 exit();
533 }
534 } elseif ($action == 'unletteringmanual' && $confirm == "yes" && $permissiontoadd) {
535 $lettering = new Lettering($db);
536 $nb_lettering = $lettering->deleteLettering($toselect);
537 if ($result < 0) {
538 setEventMessages('', $lettering->errors, 'errors');
539 } else {
540 setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
541 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
542 exit();
543 }
544 }
545 }
546}
547
548
549/*
550 * View
551 */
552
553$formaccounting = new FormAccounting($db);
554$formfile = new FormFile($db);
555$formother = new FormOther($db);
556$form = new Form($db);
557
558$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' (';
559if ($type == 'sub') {
560 $title_page .= $langs->trans("BookkeepingSubAccount");
561} else {
562 $title_page .= $langs->trans("Bookkeeping");
563}
564$title_page .= ')';
565$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double';
566llxHeader('', $title_page, $help_url, '', 0, 0, '', '', '', 'mod-accountancy accountancy-consultation page-'.(($type == 'sub') ? 'sub' : '').'ledger');
567
568// List
569$nbtotalofrecords = '';
570if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
571 // TODO Perf Replace this by a count
572 if ($type == 'sub') {
573 $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
574 } else {
575 $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
576 }
577
578 if ($nbtotalofrecords < 0) {
579 setEventMessages($object->error, $object->errors, 'errors');
580 $error++;
581 }
582}
583
584if (!$error) {
585 if ($type == 'sub') {
586 $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
587 } else {
588 $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
589 }
590
591 if ($result < 0) {
592 setEventMessages($object->error, $object->errors, 'errors');
593 }
594}
595
596$arrayofselected = is_array($toselect) ? $toselect : array();
597
598$num = count($object->lines);
599
600
602// $form_question = array();
603// $delyear = GETPOST('delyear', 'int');
604// $deljournal = GETPOST('deljournal', 'alpha');
605//
606// if (empty($delyear)) {
607// $delyear = dol_print_date(dol_now(), '%Y');
608// }
609// $month_array = array();
610// for ($i = 1; $i <= 12; $i++) {
611// $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
612// }
613// $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
614// $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
615//
616// $form_question['delmonth'] = array(
617// 'name' => 'delmonth',
618// 'type' => 'select',
619// 'label' => $langs->trans('DelMonth'),
620// 'values' => $month_array,
621// 'default' => ''
622// );
623// $form_question['delyear'] = array(
624// 'name' => 'delyear',
625// 'type' => 'select',
626// 'label' => $langs->trans('DelYear'),
627// 'values' => $year_array,
628// 'default' => $delyear
629// );
630// $form_question['deljournal'] = array(
631// 'name' => 'deljournal',
632// 'type' => 'other', // We don't use select here, the journal_array is already a select html component
633// 'label' => $langs->trans('DelJournal'),
634// 'value' => $journal_array,
635// 'default' => $deljournal
636// );
637//
638// $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
639//}
640
641// Print form confirm
643print $formconfirm;
644
645// List of mass actions available
646$arrayofmassactions = array();
647if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
648 $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
649 $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
650 $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
651 $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
652}
653if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
654 $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
655}
656if (GETPOSTINT('nomassaction') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
657 $arrayofmassactions = array();
658}
659$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
660
661print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
662print '<input type="hidden" name="token" value="'.newToken().'">';
663print '<input type="hidden" name="action" value="list">';
664if ($optioncss != '') {
665 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
666}
667print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
668print '<input type="hidden" name="type" value="'.$type.'">';
669print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
670print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
671print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
672
673$parameters = array('param' => $param);
674$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
675if ($reshook < 0) {
676 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
677}
678
679$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
680
681if (empty($reshook)) {
682 $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
683 if ($type == 'sub') {
684 $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
685 $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
686 } else {
687 $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
688 $newcardbutton .= dolGetButtonTitle($langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
689 }
690 $newcardbutton .= dolGetButtonTitleSeparator();
691 $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
692}
693
694if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
695 $param .= '&contextpage='.urlencode($contextpage);
696}
697if ($limit > 0 && $limit != $conf->liste_limit) {
698 $param .= '&limit='.((int) $limit);
699}
700
701print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
702
703if ($massaction == 'preunletteringauto') {
704 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
705} elseif ($massaction == 'preunletteringmanual') {
706 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
707} elseif ($massaction == 'predeletebookkeepingwriting') {
708 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
709}
710//DeleteMvt=Supprimer des lignes d'opérations de la comptabilité
711//DelMonth=Mois à effacer
712//DelYear=Année à supprimer
713//DelJournal=Journal à supprimer
714//ConfirmDeleteMvt=Cette action supprime les lignes des opérations pour l'année/mois et/ou pour le journal sélectionné (au moins un critère est requis). Vous devrez utiliser de nouveau la fonctionnalité '%s' pour retrouver vos écritures dans la comptabilité.
715//ConfirmDeleteMvtPartial=Cette action supprime l'écriture de la comptabilité (toutes les lignes opérations liées à une même écriture seront effacées).
716
717//$topicmail = "Information";
718//$modelmail = "accountingbookkeeping";
719//$objecttmp = new BookKeeping($db);
720//$trackid = 'bk'.$object->id;
721include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
722
723$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
724$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
725if ($massactionbutton && $contextpage != 'poslist') {
726 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
727}
728
729// Reverse sort order
730if (preg_match('/^asc/i', $sortorder)) {
731 $sortorder = "asc";
732} else {
733 $sortorder = "desc";
734}
735
736// Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
737if ($type == 'sub') {
738 print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
739}
740
741$moreforfilter = '';
742
743// Search on accountancy custom groups or account
744$moreforfilter .= '<div class="divsearchfield">';
745$moreforfilter .= $langs->trans('AccountAccounting').': ';
746$moreforfilter .= '<div class="nowrap inline-block">';
747if ($type == 'sub') {
748 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
749} else {
750 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200');
751}
752$moreforfilter .= ' ';
753if ($type == 'sub') {
754 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
755} else {
756 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200');
757}
758$stringforfirstkey = $langs->trans("KeyboardShortcut");
759if ($conf->browser->name == 'chrome') {
760 $stringforfirstkey .= ' ALT +';
761} elseif ($conf->browser->name == 'firefox') {
762 $stringforfirstkey .= ' ALT + SHIFT +';
763} else {
764 $stringforfirstkey .= ' CTL +';
765}
766$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
767$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
768$moreforfilter .= <<<SCRIPT
769<script type="text/javascript">
770 jQuery(document).ready(function() {
771 var searchFormList = $('#searchFormList');
772 var searchAccountancyCodeStart = $('#search_accountancy_code_start');
773 var searchAccountancyCodeEnd = $('#search_accountancy_code_end');
774 jQuery('#previous_account').on('click', function() {
775 var previousOption = searchAccountancyCodeStart.find('option:selected').prev('option');
776 if (previousOption.length == 1) searchAccountancyCodeStart.val(previousOption.attr('value'));
777 searchAccountancyCodeEnd.val(searchAccountancyCodeStart.val());
778 searchFormList.submit();
779 });
780 jQuery('#next_account').on('click', function() {
781 var nextOption = searchAccountancyCodeStart.find('option:selected').next('option');
782 if (nextOption.length == 1) searchAccountancyCodeStart.val(nextOption.attr('value'));
783 searchAccountancyCodeEnd.val(searchAccountancyCodeStart.val());
784 searchFormList.submit();
785 });
786 jQuery('input[name="search_mvt_num"]').on("keypress", function(event) {
787 console.log(event);
788 });
789 });
790</script>
791SCRIPT;
792$moreforfilter .= '</div>';
793$moreforfilter .= '</div>';
794
795$moreforfilter .= '<div class="divsearchfield">';
796$moreforfilter .= $langs->trans('AccountingCategory').': ';
797$moreforfilter .= '<div class="nowrap inline-block">';
798$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
799$moreforfilter .= '</div>';
800$moreforfilter .= '</div>';
801
802$parameters = array();
803$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
804if (empty($reshook)) {
805 $moreforfilter .= $hookmanager->resPrint;
806} else {
807 $moreforfilter = $hookmanager->resPrint;
808}
809
810print '<div class="liste_titre liste_titre_bydiv centpercent">';
811print $moreforfilter;
812print '</div>';
813
814print '<div class="div-table-responsive">';
815print '<table class="tagtable liste centpercent">';
816
817// Filters lines
818print '<tr class="liste_titre_filter">';
819// Action column
820if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
821 print '<td class="liste_titre center">';
822 $searchpicto = $form->showFilterButtons('left');
823 print $searchpicto;
824 print '</td>';
825}
826// Movement number
827if (!empty($arrayfields['t.piece_num']['checked'])) {
828 print '<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
829}
830// Code journal
831if (!empty($arrayfields['t.code_journal']['checked'])) {
832 print '<td class="liste_titre center">';
833 print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75');
834 print '</td>';
835}
836// Date document
837if (!empty($arrayfields['t.doc_date']['checked'])) {
838 print '<td class="liste_titre center">';
839 print '<div class="nowrapfordate">';
840 print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
841 print '</div>';
842 print '<div class="nowrapfordate">';
843 print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
844 print '</div>';
845 print '</td>';
846}
847// Ref document
848if (!empty($arrayfields['t.doc_ref']['checked'])) {
849 print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
850}
851// Label operation
852if (!empty($arrayfields['t.label_operation']['checked'])) {
853 print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
854}
855// Lettering code
856if (!empty($arrayfields['t.lettering_code']['checked'])) {
857 print '<td class="liste_titre center">';
858 print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
859 print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
860 print '</td>';
861}
862// Debit
863if (!empty($arrayfields['t.debit']['checked'])) {
864 print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
865}
866// Credit
867if (!empty($arrayfields['t.credit']['checked'])) {
868 print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
869}
870// Balance
871if (!empty($arrayfields['t.balance']['checked'])) {
872 print '<td></td>';
873}
874// Date export
875if (!empty($arrayfields['t.date_export']['checked'])) {
876 print '<td class="liste_titre center">';
877 print '<div class="nowrapfordate">';
878 print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
879 print '</div>';
880 print '<div class="nowrapfordate">';
881 print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
882 print '</div>';
883 print '</td>';
884}
885// Date validation
886if (!empty($arrayfields['t.date_validated']['checked'])) {
887 print '<td class="liste_titre center">';
888 print '<div class="nowrapfordate">';
889 print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
890 print '</div>';
891 print '<div class="nowrapfordate">';
892 print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
893 print '</div>';
894 print '</td>';
895}
896if (!empty($arrayfields['t.import_key']['checked'])) {
897 print '<td class="liste_titre center">';
898 print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
899 print '</td>';
900}
901
902// Fields from hook
903$parameters = array('arrayfields' => $arrayfields);
904$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
905print $hookmanager->resPrint;
906
907// Action column
908if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
909 print '<td class="liste_titre center">';
910 $searchpicto = $form->showFilterButtons();
911 print $searchpicto;
912 print '</td>';
913}
914print "</tr>\n";
915
916print '<tr class="liste_titre">';
917if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
918 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
919}
920if (!empty($arrayfields['t.piece_num']['checked'])) {
921 print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
922}
923if (!empty($arrayfields['t.code_journal']['checked'])) {
924 print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
925}
926if (!empty($arrayfields['t.doc_date']['checked'])) {
927 print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
928}
929if (!empty($arrayfields['t.doc_ref']['checked'])) {
930 print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
931}
932if (!empty($arrayfields['t.label_operation']['checked'])) {
933 print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
934}
935if (!empty($arrayfields['t.lettering_code']['checked'])) {
936 print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
937}
938if (!empty($arrayfields['t.debit']['checked'])) {
939 print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
940}
941if (!empty($arrayfields['t.credit']['checked'])) {
942 print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
943}
944if (!empty($arrayfields['t.balance']['checked'])) {
945 print_liste_field_titre($arrayfields['t.balance']['label'], "", "", "", $param, '', $sortfield, $sortorder, 'right ');
946}
947if (!empty($arrayfields['t.date_export']['checked'])) {
948 print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
949}
950if (!empty($arrayfields['t.date_validated']['checked'])) {
951 print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center ');
952}
953if (!empty($arrayfields['t.import_key']['checked'])) {
954 print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
955}
956// Hook fields
957$parameters = array('arrayfields' => $arrayfields, 'param' => $param, 'sortfield' => $sortfield, 'sortorder' => $sortorder);
958$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
959print $hookmanager->resPrint;
960if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
961 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
962}
963print "</tr>\n";
964
965$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
966
967// Loop on record
968// --------------------------------------------------------------------
969$i = 0;
970
971$totalarray = array();
972$totalarray['nbfield'] = 0;
973$sous_total_debit = 0;
974$sous_total_credit = 0;
975$totalarray['val'] = array();
976$totalarray['val']['totaldebit'] = 0;
977$totalarray['val']['totalcredit'] = 0;
978$totalarray['val']['totalbalance']=0;
979
980while ($i < min($num, $limit)) {
981 $line = $object->lines[$i];
982
983 if ($type == 'sub') {
984 $accountg = length_accounta($line->subledger_account);
985 } else {
986 $accountg = length_accountg($line->numero_compte);
987 }
988 //if (empty($accountg)) $accountg = '-';
989
990 $colspan = 0; // colspan before field 'label of operation'
991 $colspanend = 0; // colspan after debit/credit
992 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
993 $colspan++;
994 }
995 if (!empty($arrayfields['t.piece_num']['checked'])) {
996 $colspan++;
997 }
998 if (!empty($arrayfields['t.code_journal']['checked'])) {
999 $colspan++;
1000 }
1001 if (!empty($arrayfields['t.doc_date']['checked'])) {
1002 $colspan++;
1003 }
1004 if (!empty($arrayfields['t.doc_ref']['checked'])) {
1005 $colspan++;
1006 }
1007 if (!empty($arrayfields['t.label_operation']['checked'])) {
1008 $colspan++;
1009 }
1010 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1011 $colspan++;
1012 }
1013
1014 if (!empty($arrayfields['t.balance']['checked'])) {
1015 $colspanend++;
1016 }
1017 if (!empty($arrayfields['t.date_export']['checked'])) {
1018 $colspanend++;
1019 }
1020 if (!empty($arrayfields['t.date_validated']['checked'])) {
1021 $colspanend++;
1022 }
1023 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1024 $colspanend++;
1025 }
1026 if (!empty($arrayfields['t.import_key']['checked'])) {
1027 $colspanend++;
1028 }
1029 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1030 $colspan++;
1031 $colspanend--;
1032 }
1033
1034 // Is it a break ?
1035 if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
1036 // Show a subtotal by accounting account
1037 if (isset($displayed_account_number)) {
1038 print '<tr class="liste_total">';
1039 if ($type == 'sub') {
1040 print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accounta($displayed_account_number) . ':</td>';
1041 } else {
1042 print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
1043 }
1044 print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
1045 print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
1046 if ($colspanend > 0) {
1047 print '<td colspan="'.$colspanend.'"></td>';
1048 }
1049 print '</tr>';
1050 // Show balance of last shown account
1051 $balance = $sous_total_debit - $sous_total_credit;
1052 print '<tr class="liste_total">';
1053 print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
1054 if ($balance > 0) {
1055 print '<td class="nowraponall right">';
1056 print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
1057 print '</td>';
1058 print '<td></td>';
1059 } else {
1060 print '<td></td>';
1061 print '<td class="nowraponall right">';
1062 print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
1063 print '</td>';
1064 }
1065 if ($colspanend > 0) {
1066 print '<td colspan="'.$colspanend.'"></td>';
1067 }
1068 print '</tr>';
1069 }
1070
1071 // Show the break account
1072 print '<tr class="trforbreak">';
1073 print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields) + 1).'" class="tdforbreak">';
1074 if ($type == 'sub') {
1075 if ($line->subledger_account != "" && $line->subledger_account != '-1') {
1076 print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
1077 print ' : ';
1078 print length_accounta($line->subledger_account);
1079 } else {
1080 // Should not happen: subledger account must be null or a non empty value
1081 print '<span class="error">' . $langs->trans("Unknown");
1082 if ($line->subledger_label) {
1083 print ' (' . $line->subledger_label . ')';
1084 $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
1085 } else {
1086 $htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
1087 }
1088 print $form->textwithpicto('', $htmltext);
1089 print '</span>';
1090 }
1091 } else {
1092 if ($line->numero_compte != "" && $line->numero_compte != '-1') {
1093 print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
1094 } else {
1095 print '<span class="error">' . $langs->trans("Unknown") . '</span>';
1096 }
1097 }
1098 print '</td>';
1099 print '</tr>';
1100
1101 $displayed_account_number = $accountg;
1102 //if (empty($displayed_account_number)) $displayed_account_number='-';
1103 $sous_total_debit = 0;
1104 $sous_total_credit = 0;
1105
1106 $colspan = 0;
1107 }
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 // Piece number
1126 if (!empty($arrayfields['t.piece_num']['checked'])) {
1127 print '<td>';
1128 $object->id = $line->id;
1129 $object->piece_num = $line->piece_num;
1130 print $object->getNomUrl(1, '', 0, '', 1);
1131 print '</td>';
1132 if (!$i) {
1133 $totalarray['nbfield']++;
1134 }
1135 }
1136
1137 // Journal code
1138 if (!empty($arrayfields['t.code_journal']['checked'])) {
1139 $accountingjournal = new AccountingJournal($db);
1140 $result = $accountingjournal->fetch(0, $line->code_journal);
1141 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
1142 print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
1143 if (!$i) {
1144 $totalarray['nbfield']++;
1145 }
1146 }
1147
1148 // Document date
1149 if (!empty($arrayfields['t.doc_date']['checked'])) {
1150 print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
1151 if (!$i) {
1152 $totalarray['nbfield']++;
1153 }
1154 }
1155
1156 // Document ref
1157 $modulepart = '';
1158 if (!empty($arrayfields['t.doc_ref']['checked'])) {
1159 if ($line->doc_type == 'customer_invoice') {
1160 $langs->loadLangs(array('bills'));
1161
1162 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
1163 $objectstatic = new Facture($db);
1164 $objectstatic->fetch($line->fk_doc);
1165 //$modulepart = 'facture';
1166
1167 $filename = dol_sanitizeFileName($line->doc_ref);
1168 $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1169 $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1170 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1171 } elseif ($line->doc_type == 'supplier_invoice') {
1172 $langs->loadLangs(array('bills'));
1173
1174 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
1175 $objectstatic = new FactureFournisseur($db);
1176 $objectstatic->fetch($line->fk_doc);
1177
1178 $modulepart = 'invoice_supplier';
1179 $filename = dol_sanitizeFileName($line->doc_ref);
1180 $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1181 $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref);
1182 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir);
1183 } elseif ($line->doc_type == 'expense_report') {
1184 $langs->loadLangs(array('trips'));
1185
1186 require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
1187 $objectstatic = new ExpenseReport($db);
1188 $objectstatic->fetch($line->fk_doc);
1189 //$modulepart = 'expensereport';
1190
1191 $filename = dol_sanitizeFileName($line->doc_ref);
1192 $filedir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($line->doc_ref);
1193 $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
1194 $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
1195 } elseif ($line->doc_type == 'bank') {
1196 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
1197 $objectstatic = new AccountLine($db);
1198 $objectstatic->fetch($line->fk_doc);
1199 } else {
1200 // Other type
1201 }
1202
1203 print '<td class="tdoverflowmax250">';
1204
1205 // Picto + Ref
1206 if ($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') {
1207 print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1);
1208 print $documentlink;
1209 } elseif ($line->doc_type == 'bank') {
1210 print $objectstatic->getNomUrl(1);
1211 $bank_ref = strstr($line->doc_ref, '-');
1212 print " " . $bank_ref;
1213 } else {
1214 print $line->doc_ref;
1215 }
1216
1217 print "</td>\n";
1218 if (!$i) {
1219 $totalarray['nbfield']++;
1220 }
1221 }
1222
1223 // Label operation
1224 if (!empty($arrayfields['t.label_operation']['checked'])) {
1225 // Affiche un lien vers la facture client/fournisseur
1226 $doc_ref = preg_replace('/\‍(.*\‍)/', '', $line->doc_ref);
1227 if (strlen(length_accounta($line->subledger_account)) == 0) {
1228 print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation).'">'.dol_escape_htmltag($line->label_operation).'</td>';
1229 } else {
1230 print '<td class="small tdoverflowmax350 classfortooltip" title="'.dol_escape_htmltag($line->label_operation.($line->label_operation ? '<br>' : '').'<span style="font-size:0.8em">('.length_accounta($line->subledger_account).')').'">'.dol_escape_htmltag($line->label_operation).($line->label_operation ? '<br>' : '').'<span style="font-size:0.8em">('.dol_escape_htmltag(length_accounta($line->subledger_account)).')</span></td>';
1231 }
1232 if (!$i) {
1233 $totalarray['nbfield']++;
1234 }
1235 }
1236
1237 // Lettering code
1238 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1239 print '<td class="center">'.dol_escape_htmltag($line->lettering_code).'</td>';
1240 if (!$i) {
1241 $totalarray['nbfield']++;
1242 }
1243 }
1244
1245 // Amount debit
1246 if (!empty($arrayfields['t.debit']['checked'])) {
1247 print '<td class="right nowraponall amount">'.($line->debit != 0 ? price($line->debit) : '').'</td>';
1248 if (!$i) {
1249 $totalarray['nbfield']++;
1250 }
1251 if (!$i) {
1252 $totalarray['pos'][$totalarray['nbfield']] = 'totaldebit';
1253 }
1254 $totalarray['val']['totaldebit'] += (float) $line->debit;
1255 }
1256
1257 // Amount credit
1258 if (!empty($arrayfields['t.credit']['checked'])) {
1259 print '<td class="right nowraponall amount">'.($line->credit != 0 ? price($line->credit) : '').'</td>';
1260 if (!$i) {
1261 $totalarray['nbfield']++;
1262 }
1263 if (!$i) {
1264 $totalarray['pos'][$totalarray['nbfield']] = 'totalcredit';
1265 }
1266 $totalarray['val']['totalcredit'] += (float) $line->credit;
1267 }
1268
1269 // Amount balance
1270 if (!empty($arrayfields['t.balance']['checked'])) {
1271 print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit + $line->debit - $sous_total_credit - $line->credit, 'MT')).'</td>';
1272 if (!$i) {
1273 $totalarray['nbfield']++;
1274 }
1275 if (!$i) {
1276 $totalarray['pos'][$totalarray['nbfield']] = 'totalbalance';
1277 };
1278 $totalarray['val']['totalbalance'] += $line->debit - $line->credit;
1279 }
1280
1281 // Exported operation date
1282 if (!empty($arrayfields['t.date_export']['checked'])) {
1283 print '<td class="center">'.dol_print_date($line->date_export, 'dayhour').'</td>';
1284 if (!$i) {
1285 $totalarray['nbfield']++;
1286 }
1287 }
1288
1289 // Validated operation date
1290 if (!empty($arrayfields['t.date_validated']['checked'])) {
1291 print '<td class="center">'.dol_print_date($line->date_validation, 'dayhour').'</td>';
1292 if (!$i) {
1293 $totalarray['nbfield']++;
1294 }
1295 }
1296
1297 if (!empty($arrayfields['t.import_key']['checked'])) {
1298 print '<td class="tdoverflowmax125" title="'.dol_escape_htmltag($line->import_key).'">'.dol_escape_htmltag($line->import_key)."</td>\n";
1299 if (!$i) {
1300 $totalarray['nbfield']++;
1301 }
1302 }
1303
1304 // Fields from hook
1305 $parameters = array('arrayfields' => $arrayfields, 'obj' => $line);
1306 $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
1307 print $hookmanager->resPrint;
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 // Comptabilise le sous-total
1326 $sous_total_debit += $line->debit;
1327 $sous_total_credit += $line->credit;
1328
1329 print "</tr>\n";
1330
1331 $i++;
1332}
1333
1334if ($num > 0 && $colspan > 0) {
1335 print '<tr class="liste_total">';
1336 print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("TotalForAccount").' '.$accountg.':</td>';
1337 print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
1338 print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
1339 if ($colspanend > 0) {
1340 print '<td colspan="'.$colspanend.'"></td>';
1341 }
1342 print '</tr>';
1343 // Show balance of last shown account
1344 $balance = $sous_total_debit - $sous_total_credit;
1345 print '<tr class="liste_total">';
1346 print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
1347 if ($balance > 0) {
1348 print '<td class="nowraponall right">';
1349 print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
1350 print '</td>';
1351 print '<td></td>';
1352 } else {
1353 print '<td></td>';
1354 print '<td class="nowraponall right">';
1355 print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
1356 print '</td>';
1357 }
1358 if ($colspanend > 0) {
1359 print '<td colspan="'.$colspanend.'"></td>';
1360 }
1361 print '</tr>';
1362}
1363
1364
1365// Clean total values to round them
1366if (!empty($totalarray['val']['totaldebit'])) {
1367 $totalarray['val']['totaldebit'] = (float) price2num($totalarray['val']['totaldebit'], 'MT');
1368}
1369if (!empty($totalarray['val']['totalcredit'])) {
1370 $totalarray['val']['totalcredit'] = (float) price2num($totalarray['val']['totalcredit'], 'MT');
1371}
1372if (!empty($totalarray['val']['totalbalance'])) {
1373 $totalarray['val']['totalbalance'] = (float) price2num($totalarray['val']['totaldebit'] - $totalarray['val']['totalcredit'], 'MT');
1374}
1375
1376// Show total line
1377include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
1378
1379// If no record found
1380if ($num == 0) {
1381 $colspan = 1;
1382 foreach ($arrayfields as $key => $val) {
1383 if (!empty($val['checked'])) {
1384 $colspan++;
1385 }
1386 }
1387 print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
1388}
1389
1390$parameters = array('arrayfields' => $arrayfields);
1391$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
1392print $hookmanager->resPrint;
1393
1394print "</table>";
1395print '</div>';
1396
1397// TODO Replace this with mass delete action
1398//if ($user->hasRight('accounting', 'mouvements, 'supprimer_tous')) {
1399// print '<div class="tabsAction tabsActionNoBottom">'."\n";
1400// print '<a class="butActionDelete" name="button_delmvt" href="'.$_SERVER["PHP_SELF"].'?action=delbookkeepingyear&token='.newToken().($param ? '&'.$param : '').'">'.$langs->trans("DeleteMvt").'</a>';
1401// print '</div>';
1402//}
1403
1404print '</form>';
1405
1406// End of page
1407llxFooter();
1408$db->close();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
length_accountg($account)
Return General accounting account with defined length (used for product and miscellaneous)
length_accounta($accounta)
Return Auxiliary accounting account of thirdparties with defined length.
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 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.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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.
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.
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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...
$formconfirm
if ($action == 'delbookkeepingyear') {
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:137
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.