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