dolibarr 19.0.4
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 <aspangaro@easya.solutions>
6 * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
28// Load Dolibarr environment
29require '../../main.inc.php';
30
31require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/accountancy/class/lettering.class.php';
33require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php';
34require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php';
35require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
36require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
37require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
39
40// Load translation files required by the page
41$langs->loadLangs(array("accountancy", "compta"));
42
43$action = GETPOST('action', 'aZ09');
44$socid = GETPOST('socid', 'int');
45$massaction = GETPOST('massaction', 'alpha');
46$confirm = GETPOST('confirm', 'alpha');
47$toselect = GETPOST('toselect', 'array');
48$type = GETPOST('type', 'alpha');
49if ($type == 'sub') {
50 $context_default = 'bookkeepingbysubaccountlist';
51} else {
52 $context_default = 'bookkeepingbyaccountlist';
53}
54$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : $context_default;
55$search_date_startyear = GETPOST('search_date_startyear', 'int');
56$search_date_startmonth = GETPOST('search_date_startmonth', 'int');
57$search_date_startday = GETPOST('search_date_startday', 'int');
58$search_date_endyear = GETPOST('search_date_endyear', 'int');
59$search_date_endmonth = GETPOST('search_date_endmonth', 'int');
60$search_date_endday = GETPOST('search_date_endday', 'int');
61$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
62$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
63$search_doc_date = dol_mktime(0, 0, 0, GETPOST('doc_datemonth', 'int'), GETPOST('doc_dateday', 'int'), GETPOST('doc_dateyear', 'int'));
64$search_date_export_startyear = GETPOST('search_date_export_startyear', 'int');
65$search_date_export_startmonth = GETPOST('search_date_export_startmonth', 'int');
66$search_date_export_startday = GETPOST('search_date_export_startday', 'int');
67$search_date_export_endyear = GETPOST('search_date_export_endyear', 'int');
68$search_date_export_endmonth = GETPOST('search_date_export_endmonth', 'int');
69$search_date_export_endday = GETPOST('search_date_export_endday', 'int');
70$search_date_export_start = dol_mktime(0, 0, 0, $search_date_export_startmonth, $search_date_export_startday, $search_date_export_startyear);
71$search_date_export_end = dol_mktime(23, 59, 59, $search_date_export_endmonth, $search_date_export_endday, $search_date_export_endyear);
72$search_date_validation_startyear = GETPOST('search_date_validation_startyear', 'int');
73$search_date_validation_startmonth = GETPOST('search_date_validation_startmonth', 'int');
74$search_date_validation_startday = GETPOST('search_date_validation_startday', 'int');
75$search_date_validation_endyear = GETPOST('search_date_validation_endyear', 'int');
76$search_date_validation_endmonth = GETPOST('search_date_validation_endmonth', 'int');
77$search_date_validation_endday = GETPOST('search_date_validation_endday', 'int');
78$search_date_validation_start = dol_mktime(0, 0, 0, $search_date_validation_startmonth, $search_date_validation_startday, $search_date_validation_startyear);
79$search_date_validation_end = dol_mktime(23, 59, 59, $search_date_validation_endmonth, $search_date_validation_endday, $search_date_validation_endyear);
80$search_import_key = GETPOST("search_import_key", 'alpha');
81
82$search_account_category = GETPOST('search_account_category', 'int');
83
84$search_accountancy_code_start = GETPOST('search_accountancy_code_start', 'alpha');
85if ($search_accountancy_code_start == - 1) {
86 $search_accountancy_code_start = '';
87}
88$search_accountancy_code_end = GETPOST('search_accountancy_code_end', 'alpha');
89if ($search_accountancy_code_end == - 1) {
90 $search_accountancy_code_end = '';
91}
92$search_doc_ref = GETPOST('search_doc_ref', 'alpha');
93$search_label_operation = GETPOST('search_label_operation', 'alpha');
94$search_mvt_num = GETPOST('search_mvt_num', 'int');
95$search_direction = GETPOST('search_direction', 'alpha');
96$search_ledger_code = GETPOST('search_ledger_code', 'array');
97$search_debit = GETPOST('search_debit', 'alpha');
98$search_credit = GETPOST('search_credit', 'alpha');
99$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
100$search_not_reconciled = GETPOST('search_not_reconciled', 'alpha');
101
102if (GETPOST("button_delmvt_x") || GETPOST("button_delmvt.x") || GETPOST("button_delmvt")) {
103 $action = 'delbookkeepingyear';
104}
105
106// Load variable for pagination
107$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : getDolGlobalString('ACCOUNTING_LIMIT_LIST_VENTILATION', $conf->liste_limit);
108$sortfield = GETPOST('sortfield', 'aZ09comma');
109$sortorder = GETPOST('sortorder', 'aZ09comma');
110$optioncss = GETPOST('optioncss', 'alpha');
111$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
112if (empty($page) || $page < 0) {
113 $page = 0;
114}
115$offset = $limit * $page;
116$pageprev = $page - 1;
117$pagenext = $page + 1;
118if ($sortorder == "") {
119 $sortorder = "ASC";
120}
121if ($sortfield == "") {
122 $sortfield = "t.doc_date,t.rowid";
123}
124
125// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
126$object = new BookKeeping($db);
127$formfile = new FormFile($db);
128$hookmanager->initHooks(array($context_default));
129
130$formaccounting = new FormAccounting($db);
131$form = new Form($db);
132
133if (empty($search_date_start) && empty($search_date_end) && !GETPOSTISSET('search_date_startday') && !GETPOSTISSET('search_date_startmonth') && !GETPOSTISSET('search_date_starthour')) {
134 $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear ";
135 $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";
136 $sql .= $db->plimit(1);
137 $res = $db->query($sql);
138
139 if ($res->num_rows > 0) {
140 $fiscalYear = $db->fetch_object($res);
141 $search_date_start = strtotime($fiscalYear->date_start);
142 $search_date_end = strtotime($fiscalYear->date_end);
143 } else {
144 $month_start = getDolGlobalInt('SOCIETE_FISCAL_MONTH_START', 1);
145 $year_start = dol_print_date(dol_now(), '%Y');
146 if (dol_print_date(dol_now(), '%m') < $month_start) {
147 $year_start--; // If current month is lower that starting fiscal month, we start last year
148 }
149 $year_end = $year_start + 1;
150 $month_end = $month_start - 1;
151 if ($month_end < 1) {
152 $month_end = 12;
153 $year_end--;
154 }
155 $search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
156 $search_date_end = dol_get_last_day($year_end, $month_end);
157 }
158}
159
160$arrayfields = array(
161 // 't.subledger_account'=>array('label'=>$langs->trans("SubledgerAccount"), 'checked'=>1),
162 't.piece_num'=>array('label'=>$langs->trans("TransactionNumShort"), 'checked'=>1),
163 't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
164 't.doc_date'=>array('label'=>$langs->trans("Docdate"), 'checked'=>1),
165 't.doc_ref'=>array('label'=>$langs->trans("Piece"), 'checked'=>1),
166 't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
167 't.lettering_code'=>array('label'=>$langs->trans("Lettering"), 'checked'=>1),
168 't.debit'=>array('label'=>$langs->trans("AccountingDebit"), 'checked'=>1),
169 't.credit'=>array('label'=>$langs->trans("AccountingCredit"), 'checked'=>1),
170 't.balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1),
171 't.date_export'=>array('label'=>$langs->trans("DateExport"), 'checked'=>-1),
172 't.date_validated'=>array('label'=>$langs->trans("DateValidation"), 'checked'=>-1, 'enabled'=>!getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")),
173 't.import_key'=>array('label'=>$langs->trans("ImportId"), 'checked'=>-1, 'position'=>1100),
174);
175
176if (!getDolGlobalString('ACCOUNTING_ENABLE_LETTERING')) {
177 unset($arrayfields['t.lettering_code']);
178}
179
180if ($search_date_start && empty($search_date_startyear)) {
181 $tmparray = dol_getdate($search_date_start);
182 $search_date_startyear = $tmparray['year'];
183 $search_date_startmonth = $tmparray['mon'];
184 $search_date_startday = $tmparray['mday'];
185}
186if ($search_date_end && empty($search_date_endyear)) {
187 $tmparray = dol_getdate($search_date_end);
188 $search_date_endyear = $tmparray['year'];
189 $search_date_endmonth = $tmparray['mon'];
190 $search_date_endday = $tmparray['mday'];
191}
192
193if (!isModEnabled('accounting')) {
195}
196if ($user->socid > 0) {
198}
199if (!$user->hasRight('accounting', 'mouvements', 'lire')) {
201}
202
203$error = 0;
204
205
206/*
207 * Action
208 */
209
210$param = '';
211
212if (GETPOST('cancel', 'alpha')) {
213 $action = 'list';
214 $massaction = '';
215}
216if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'preunletteringauto' && $massaction != 'preunletteringmanual' && $massaction != 'predeletebookkeepingwriting') {
217 $massaction = '';
218}
219
220$parameters = array('socid'=>$socid);
221$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
222if ($reshook < 0) {
223 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
224}
225
226if (empty($reshook)) {
227 include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
228
229 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
230 $search_doc_date = '';
231 $search_account_category = '';
232 $search_accountancy_code_start = '';
233 $search_accountancy_code_end = '';
234 $search_label_account = '';
235 $search_doc_ref = '';
236 $search_label_operation = '';
237 $search_mvt_num = '';
238 $search_direction = '';
239 $search_ledger_code = array();
240 $search_date_start = '';
241 $search_date_end = '';
242 $search_date_startyear = '';
243 $search_date_startmonth = '';
244 $search_date_startday = '';
245 $search_date_endyear = '';
246 $search_date_endmonth = '';
247 $search_date_endday = '';
248 $search_date_export_start = '';
249 $search_date_export_end = '';
250 $search_date_export_startyear = '';
251 $search_date_export_startmonth = '';
252 $search_date_export_startday = '';
253 $search_date_export_endyear = '';
254 $search_date_export_endmonth = '';
255 $search_date_export_endday = '';
256 $search_date_validation_start = '';
257 $search_date_validation_end = '';
258 $search_date_validation_startyear = '';
259 $search_date_validation_startmonth = '';
260 $search_date_validation_startday = '';
261 $search_date_validation_endyear = '';
262 $search_date_validation_endmonth = '';
263 $search_date_validation_endday = '';
264 $search_lettering_code = '';
265 $search_debit = '';
266 $search_credit = '';
267 $search_not_reconciled = '';
268 $search_import_key = '';
269 $toselect = array();
270 }
271
272 // Must be after the remove filter action, before the export.
273 $filter = array();
274
275 if (!empty($search_date_start)) {
276 $filter['t.doc_date>='] = $search_date_start;
277 $param .= '&search_date_startmonth='.$search_date_startmonth.'&search_date_startday='.$search_date_startday.'&search_date_startyear='.$search_date_startyear;
278 }
279 if (!empty($search_date_end)) {
280 $filter['t.doc_date<='] = $search_date_end;
281 $param .= '&search_date_endmonth='.$search_date_endmonth.'&search_date_endday='.$search_date_endday.'&search_date_endyear='.$search_date_endyear;
282 }
283 if (!empty($search_doc_date)) {
284 $filter['t.doc_date'] = $search_doc_date;
285 $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int');
286 }
287 if ($search_account_category != '-1' && !empty($search_account_category)) {
288 require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancycategory.class.php';
289 $accountingcategory = new AccountancyCategory($db);
290
291 $listofaccountsforgroup = $accountingcategory->getCptsCat(0, 'fk_accounting_category = '.((int) $search_account_category));
292 $listofaccountsforgroup2 = array();
293 if (is_array($listofaccountsforgroup)) {
294 foreach ($listofaccountsforgroup as $tmpval) {
295 $listofaccountsforgroup2[] = "'".$db->escape($tmpval['account_number'])."'";
296 }
297 }
298 $filter['t.search_accounting_code_in'] = join(',', $listofaccountsforgroup2);
299 $param .= '&search_account_category='.urlencode($search_account_category);
300 }
301 if (!empty($search_accountancy_code_start)) {
302 if ($type == 'sub') {
303 $filter['t.subledger_account>='] = $search_accountancy_code_start;
304 } else {
305 $filter['t.numero_compte>='] = $search_accountancy_code_start;
306 }
307 $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start);
308 }
309 if (!empty($search_accountancy_code_end)) {
310 if ($type == 'sub') {
311 $filter['t.subledger_account<='] = $search_accountancy_code_end;
312 } else {
313 $filter['t.numero_compte<='] = $search_accountancy_code_end;
314 }
315 $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end);
316 }
317 if (!empty($search_label_account)) {
318 $filter['t.label_compte'] = $search_label_account;
319 $param .= '&search_label_compte='.urlencode($search_label_account);
320 }
321 if (!empty($search_mvt_num)) {
322 $filter['t.piece_num'] = $search_mvt_num;
323 $param .= '&search_mvt_num='.urlencode($search_mvt_num);
324 }
325 if (!empty($search_doc_ref)) {
326 $filter['t.doc_ref'] = $search_doc_ref;
327 $param .= '&search_doc_ref='.urlencode($search_doc_ref);
328 }
329 if (!empty($search_label_operation)) {
330 $filter['t.label_operation'] = $search_label_operation;
331 $param .= '&search_label_operation='.urlencode($search_label_operation);
332 }
333 if (!empty($search_direction)) {
334 $filter['t.sens'] = $search_direction;
335 $param .= '&search_direction='.urlencode($search_direction);
336 }
337 if (!empty($search_ledger_code)) {
338 $filter['t.code_journal'] = $search_ledger_code;
339 foreach ($search_ledger_code as $code) {
340 $param .= '&search_ledger_code[]='.urlencode($code);
341 }
342 }
343 if (!empty($search_lettering_code)) {
344 $filter['t.lettering_code'] = $search_lettering_code;
345 $param .= '&search_lettering_code='.urlencode($search_lettering_code);
346 }
347 if (!empty($search_debit)) {
348 $filter['t.debit'] = $search_debit;
349 $param .= '&search_debit='.urlencode($search_debit);
350 }
351 if (!empty($search_credit)) {
352 $filter['t.credit'] = $search_credit;
353 $param .= '&search_credit='.urlencode($search_credit);
354 }
355 if (!empty($search_not_reconciled)) {
356 $filter['t.reconciled_option'] = $search_not_reconciled;
357 $param .= '&search_not_reconciled='.urlencode($search_not_reconciled);
358 }
359 if (!empty($search_date_export_start)) {
360 $filter['t.date_export>='] = $search_date_export_start;
361 $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;
362 }
363 if (!empty($search_date_export_end)) {
364 $filter['t.date_export<='] = $search_date_export_end;
365 $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;
366 }
367 if (!empty($search_date_validation_start)) {
368 $filter['t.date_validated>='] = $search_date_validation_start;
369 $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;
370 }
371 if (!empty($search_date_validation_end)) {
372 $filter['t.date_validated<='] = $search_date_validation_end;
373 $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;
374 }
375 if (!empty($search_import_key)) {
376 $filter['t.import_key'] = $search_import_key;
377 $param .= '&search_import_key='.urlencode($search_import_key);
378 }
379 // param with type of list
380 $url_param = substr($param, 1); // remove first "&"
381 if (!empty($type)) {
382 $param = '&type='.$type.$param;
383 }
384
385 //if ($action == 'delbookkeepingyearconfirm' && $user->hasRight('accounting', 'mouvements', 'supprimer')_tous) {
386 // $delmonth = GETPOST('delmonth', 'int');
387 // $delyear = GETPOST('delyear', 'int');
388 // if ($delyear == -1) {
389 // $delyear = 0;
390 // }
391 // $deljournal = GETPOST('deljournal', 'alpha');
392 // if ($deljournal == -1) {
393 // $deljournal = 0;
394 // }
395 //
396 // if (!empty($delmonth) || !empty($delyear) || !empty($deljournal)) {
397 // $result = $object->deleteByYearAndJournal($delyear, $deljournal, '', ($delmonth > 0 ? $delmonth : 0));
398 // if ($result < 0) {
399 // setEventMessages($object->error, $object->errors, 'errors');
400 // } else {
401 // setEventMessages("RecordDeleted", null, 'mesgs');
402 // }
403 //
404 // // Make a redirect to avoid to launch the delete later after a back button
405 // header("Location: ".$_SERVER["PHP_SELF"].($param ? '?'.$param : ''));
406 // exit;
407 // } else {
408 // setEventMessages("NoRecordDeleted", null, 'warnings');
409 // }
410 //}
411
412 // Mass actions
413 $objectclass = 'Bookkeeping';
414 $objectlabel = 'Bookkeeping';
415 $permissiontoread = $user->hasRight('societe', 'lire');
416 $permissiontodelete = $user->hasRight('societe', 'supprimer');
417 $permissiontoadd = $user->hasRight('societe', 'creer');
418 $uploaddir = $conf->societe->dir_output;
419 include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
420
421 if (!$error && $action == 'deletebookkeepingwriting' && $confirm == "yes" && $user->hasRight('accounting', 'mouvements', 'supprimer')) {
422 $db->begin();
423
424 if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING')) {
425 $lettering = new Lettering($db);
426 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
427 if ($nb_lettering < 0) {
428 setEventMessages('', $lettering->errors, 'errors');
429 $error++;
430 }
431 }
432
433 $nbok = 0;
434 if (!$error) {
435 foreach ($toselect as $toselectid) {
436 $result = $object->fetch($toselectid);
437 if ($result > 0 && (!isset($object->date_validation) || $object->date_validation === '')) {
438 $result = $object->deleteMvtNum($object->piece_num);
439 if ($result > 0) {
440 $nbok++;
441 } else {
442 setEventMessages($object->error, $object->errors, 'errors');
443 $error++;
444 break;
445 }
446 } elseif ($result < 0) {
447 setEventMessages($object->error, $object->errors, 'errors');
448 $error++;
449 break;
450 } elseif (isset($object->date_validation) && $object->date_validation != '') {
451 setEventMessages($langs->trans("ValidatedRecordWhereFound"), null, 'errors');
452 $error++;
453 break;
454 }
455 }
456 }
457
458 if (!$error) {
459 $db->commit();
460
461 // Message for elements well deleted
462 if ($nbok > 1) {
463 setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
464 } elseif ($nbok > 0) {
465 setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
466 } elseif (!$error) {
467 setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
468 }
469
470 header("Location: ".$_SERVER["PHP_SELF"]."?noreset=1".($param ? '&'.$param : ''));
471 exit;
472 } else {
473 $db->rollback();
474 }
475 }
476
477 // others mass actions
478 if (!$error && getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
479 if ($massaction == 'letteringauto') {
480 $lettering = new Lettering($db);
481 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect);
482 if ($nb_lettering < 0) {
483 setEventMessages('', $lettering->errors, 'errors');
484 $error++;
485 $nb_lettering = max(0, abs($nb_lettering) - 2);
486 } elseif ($nb_lettering == 0) {
487 $nb_lettering = 0;
488 setEventMessages($langs->trans('AccountancyNoLetteringModified'), array(), 'mesgs');
489 }
490 if ($nb_lettering == 1) {
491 setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
492 } elseif ($nb_lettering > 1) {
493 setEventMessages($langs->trans('AccountancyLetteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
494 }
495
496 if (!$error) {
497 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
498 exit();
499 }
500 } elseif ($massaction == 'letteringmanual') {
501 $lettering = new Lettering($db);
502 $result = $lettering->updateLettering($toselect);
503 if ($result < 0) {
504 setEventMessages('', $lettering->errors, 'errors');
505 } else {
506 setEventMessages($langs->trans('AccountancyOneLetteringModifiedSuccessfully'), array(), 'mesgs');
507 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
508 exit();
509 }
510 } elseif ($action == 'unletteringauto' && $confirm == "yes") {
511 $lettering = new Lettering($db);
512 $nb_lettering = $lettering->bookkeepingLetteringAll($toselect, true);
513 if ($nb_lettering < 0) {
514 setEventMessages('', $lettering->errors, 'errors');
515 $error++;
516 $nb_lettering = max(0, abs($nb_lettering) - 2);
517 } elseif ($nb_lettering == 0) {
518 $nb_lettering = 0;
519 setEventMessages($langs->trans('AccountancyNoUnletteringModified'), array(), 'mesgs');
520 }
521 if ($nb_lettering == 1) {
522 setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
523 } elseif ($nb_lettering > 1) {
524 setEventMessages($langs->trans('AccountancyUnletteringModifiedSuccessfully', $nb_lettering), array(), 'mesgs');
525 }
526
527 if (!$error) {
528 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
529 exit();
530 }
531 } elseif ($action == 'unletteringmanual' && $confirm == "yes") {
532 $lettering = new Lettering($db);
533 $nb_lettering = $lettering->deleteLettering($toselect);
534 if ($result < 0) {
535 setEventMessages('', $lettering->errors, 'errors');
536 } else {
537 setEventMessages($langs->trans('AccountancyOneUnletteringModifiedSuccessfully'), array(), 'mesgs');
538 header('Location: ' . $_SERVER['PHP_SELF'] . '?noreset=1' . $param);
539 exit();
540 }
541 }
542 }
543}
544
545
546/*
547 * View
548 */
549
550$formaccounting = new FormAccounting($db);
551$formfile = new FormFile($db);
552$formother = new FormOther($db);
553$form = new Form($db);
554
555$title_page = $langs->trans("Operations").' - '.$langs->trans("VueByAccountAccounting").' (';
556if ($type == 'sub') {
557 $title_page .= $langs->trans("BookkeepingSubAccount");
558} else {
559 $title_page .= $langs->trans("Bookkeeping");
560}
561$title_page .= ')';
562$help_url = 'EN:Module_Double_Entry_Accounting|FR:Module_Comptabilit&eacute;_en_Partie_Double';
563llxHeader('', $title_page, $help_url);
564
565// List
566$nbtotalofrecords = '';
567if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
568 // TODO Perf Replace this by a count
569 if ($type == 'sub') {
570 $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 1, 1);
571 } else {
572 $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter, 'AND', 0, 1);
573 }
574
575 if ($nbtotalofrecords < 0) {
576 setEventMessages($object->error, $object->errors, 'errors');
577 $error++;
578 }
579}
580
581if (!$error) {
582 if ($type == 'sub') {
583 $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 1);
584 } else {
585 $result = $object->fetchAllByAccount($sortorder, $sortfield, $limit, $offset, $filter, 'AND', 0);
586 }
587
588 if ($result < 0) {
589 setEventMessages($object->error, $object->errors, 'errors');
590 }
591}
592
593$arrayofselected = is_array($toselect) ? $toselect : array();
594
595$num = count($object->lines);
596
597
599// $form_question = array();
600// $delyear = GETPOST('delyear', 'int');
601// $deljournal = GETPOST('deljournal', 'alpha');
602//
603// if (empty($delyear)) {
604// $delyear = dol_print_date(dol_now(), '%Y');
605// }
606// $month_array = array();
607// for ($i = 1; $i <= 12; $i++) {
608// $month_array[$i] = $langs->trans("Month".sprintf("%02d", $i));
609// }
610// $year_array = $formaccounting->selectyear_accountancy_bookkepping($delyear, 'delyear', 0, 'array');
611// $journal_array = $formaccounting->select_journal($deljournal, 'deljournal', '', 1, 1, 1, '', 0, 1);
612//
613// $form_question['delmonth'] = array(
614// 'name' => 'delmonth',
615// 'type' => 'select',
616// 'label' => $langs->trans('DelMonth'),
617// 'values' => $month_array,
618// 'default' => ''
619// );
620// $form_question['delyear'] = array(
621// 'name' => 'delyear',
622// 'type' => 'select',
623// 'label' => $langs->trans('DelYear'),
624// 'values' => $year_array,
625// 'default' => $delyear
626// );
627// $form_question['deljournal'] = array(
628// 'name' => 'deljournal',
629// 'type' => 'other', // We don't use select here, the journal_array is already a select html component
630// 'label' => $langs->trans('DelJournal'),
631// 'value' => $journal_array,
632// 'default' => $deljournal
633// );
634//
635// $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?'.$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvt', $langs->transnoentitiesnoconv("RegistrationInAccounting")), 'delbookkeepingyearconfirm', $form_question, '', 1, 300);
636//}
637
638// Print form confirm
640print $formconfirm;
641
642// List of mass actions available
643$arrayofmassactions = array();
644if (getDolGlobalInt('ACCOUNTING_ENABLE_LETTERING') && $user->hasRight('accounting', 'mouvements', 'creer')) {
645 $arrayofmassactions['letteringauto'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringAuto');
646 $arrayofmassactions['preunletteringauto'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringAuto');
647 $arrayofmassactions['letteringmanual'] = img_picto('', 'check', 'class="pictofixedwidth"') . $langs->trans('LetteringManual');
648 $arrayofmassactions['preunletteringmanual'] = img_picto('', 'uncheck', 'class="pictofixedwidth"') . $langs->trans('UnletteringManual');
649}
650if ($user->hasRight('accounting', 'mouvements', 'supprimer')) {
651 $arrayofmassactions['predeletebookkeepingwriting'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
652}
653if (GETPOST('nomassaction', 'int') || in_array($massaction, array('preunletteringauto', 'preunletteringmanual', 'predeletebookkeepingwriting'))) {
654 $arrayofmassactions = array();
655}
656$massactionbutton = $form->selectMassAction($massaction, $arrayofmassactions);
657
658print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
659print '<input type="hidden" name="token" value="'.newToken().'">';
660print '<input type="hidden" name="action" value="list">';
661if ($optioncss != '') {
662 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
663}
664print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
665print '<input type="hidden" name="type" value="'.$type.'">';
666print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
667print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
668print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
669
670$parameters = array('param' => $param);
671$reshook = $hookmanager->executeHooks('addMoreActionsButtonsList', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
672if ($reshook < 0) {
673 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
674}
675
676$newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint;
677
678if (empty($reshook)) {
679 $newcardbutton = dolGetButtonTitle($langs->trans('ViewFlatList'), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/list.php?'.$param);
680 if ($type == 'sub') {
681 $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly'));
682 $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'));
683 } else {
684 $newcardbutton .= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected'));
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'));
686 }
687 $newcardbutton .= dolGetButtonTitleSeparator();
688 $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create');
689}
690
691if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
692 $param .= '&contextpage='.urlencode($contextpage);
693}
694if ($limit > 0 && $limit != $conf->liste_limit) {
695 $param .= '&limit='.((int) $limit);
696}
697
698print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1);
699
700if ($massaction == 'preunletteringauto') {
701 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringAuto"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringauto", null, '', 0, 200, 500, 1);
702} elseif ($massaction == 'preunletteringmanual') {
703 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassUnletteringManual"), $langs->trans("ConfirmMassUnletteringQuestion", count($toselect)), "unletteringmanual", null, '', 0, 200, 500, 1);
704} elseif ($massaction == 'predeletebookkeepingwriting') {
705 print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDeleteBookkeepingWriting"), $langs->trans("ConfirmMassDeleteBookkeepingWritingQuestion", count($toselect)), "deletebookkeepingwriting", null, '', 0, 200, 500, 1);
706}
707//DeleteMvt=Supprimer des lignes d'opérations de la comptabilité
708//DelMonth=Mois à effacer
709//DelYear=Année à supprimer
710//DelJournal=Journal à supprimer
711//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é.
712//ConfirmDeleteMvtPartial=Cette action supprime l'écriture de la comptabilité (toutes les lignes opérations liées à une même écriture seront effacées).
713
714//$topicmail = "Information";
715//$modelmail = "accountingbookkeeping";
716//$objecttmp = new BookKeeping($db);
717//$trackid = 'bk'.$object->id;
718include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
719
720$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
721$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields
722if ($massactionbutton && $contextpage != 'poslist') {
723 $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
724}
725
726// Reverse sort order
727if (preg_match('/^asc/i', $sortorder)) {
728 $sortorder = "asc";
729} else {
730 $sortorder = "desc";
731}
732
733// Warning to explain why list of record is not consistent with the other list view (missing a lot of lines)
734if ($type == 'sub') {
735 print info_admin($langs->trans("WarningRecordWithoutSubledgerAreExcluded"));
736}
737
738$moreforfilter = '';
739
740// Search on accountancy custom groups or account
741$moreforfilter .= '<div class="divsearchfield">';
742$moreforfilter .= $langs->trans('AccountAccounting').': ';
743$moreforfilter .= '<div class="nowrap inline-block">';
744if ($type == 'sub') {
745 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), 'maxwidth200');
746} else {
747 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_start, 'search_accountancy_code_start', $langs->trans('From'), array(), 1, 1, 'maxwidth200');
748}
749$moreforfilter .= ' ';
750if ($type == 'sub') {
751 $moreforfilter .= $formaccounting->select_auxaccount($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), 'maxwidth200');
752} else {
753 $moreforfilter .= $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', $langs->trans('to'), array(), 1, 1, 'maxwidth200');
754}
755$stringforfirstkey = $langs->trans("KeyboardShortcut");
756if ($conf->browser->name == 'chrome') {
757 $stringforfirstkey .= ' ALT +';
758} elseif ($conf->browser->name == 'firefox') {
759 $stringforfirstkey .= ' ALT + SHIFT +';
760} else {
761 $stringforfirstkey .= ' CTL +';
762}
763$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="previous_account" accesskey="p" title="' . $stringforfirstkey . ' p" class="classfortooltip" href="#"><i class="fa fa-chevron-left"></i></a>';
764$moreforfilter .= '&nbsp;&nbsp;&nbsp;<a id="next_account" accesskey="n" title="' . $stringforfirstkey . ' n" class="classfortooltip" href="#"><i class="fa fa-chevron-right"></i></a>';
765$moreforfilter .= <<<SCRIPT
766<script type="text/javascript">
767 jQuery(document).ready(function() {
768 var searchFormList = $('#searchFormList');
769 var searchAccountancyCodeStart = $('#search_accountancy_code_start');
770 var searchAccountancyCodeEnd = $('#search_accountancy_code_end');
771 jQuery('#previous_account').on('click', function() {
772 var previousOption = searchAccountancyCodeStart.find('option:selected').prev('option');
773 if (previousOption.length == 1) searchAccountancyCodeStart.val(previousOption.attr('value'));
774 searchAccountancyCodeEnd.val(searchAccountancyCodeStart.val());
775 searchFormList.submit();
776 });
777 jQuery('#next_account').on('click', function() {
778 var nextOption = searchAccountancyCodeStart.find('option:selected').next('option');
779 if (nextOption.length == 1) searchAccountancyCodeStart.val(nextOption.attr('value'));
780 searchAccountancyCodeEnd.val(searchAccountancyCodeStart.val());
781 searchFormList.submit();
782 });
783 jQuery('input[name="search_mvt_num"]').on("keypress", function(event) {
784 console.log(event);
785 });
786 });
787</script>
788SCRIPT;
789$moreforfilter .= '</div>';
790$moreforfilter .= '</div>';
791
792$moreforfilter .= '<div class="divsearchfield">';
793$moreforfilter .= $langs->trans('AccountingCategory').': ';
794$moreforfilter .= '<div class="nowrap inline-block">';
795$moreforfilter .= $formaccounting->select_accounting_category($search_account_category, 'search_account_category', 1, 0, 0, 0);
796$moreforfilter .= '</div>';
797$moreforfilter .= '</div>';
798
799$parameters = array();
800$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
801if (empty($reshook)) {
802 $moreforfilter .= $hookmanager->resPrint;
803} else {
804 $moreforfilter = $hookmanager->resPrint;
805}
806
807print '<div class="liste_titre liste_titre_bydiv centpercent">';
808print $moreforfilter;
809print '</div>';
810
811print '<div class="div-table-responsive">';
812print '<table class="tagtable liste centpercent">';
813
814// Filters lines
815print '<tr class="liste_titre_filter">';
816// Action column
817if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
818 print '<td class="liste_titre center">';
819 $searchpicto = $form->showFilterButtons('left');
820 print $searchpicto;
821 print '</td>';
822}
823// Movement number
824if (!empty($arrayfields['t.piece_num']['checked'])) {
825 print '<td class="liste_titre"><input type="text" name="search_mvt_num" class="width50" value="'.dol_escape_htmltag($search_mvt_num).'"></td>';
826}
827// Code journal
828if (!empty($arrayfields['t.code_journal']['checked'])) {
829 print '<td class="liste_titre center">';
830 print $formaccounting->multi_select_journal($search_ledger_code, 'search_ledger_code', 0, 1, 1, 1, 'maxwidth75');
831 print '</td>';
832}
833// Date document
834if (!empty($arrayfields['t.doc_date']['checked'])) {
835 print '<td class="liste_titre center">';
836 print '<div class="nowrapfordate">';
837 print $form->selectDate($search_date_start, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
838 print '</div>';
839 print '<div class="nowrapfordate">';
840 print $form->selectDate($search_date_end, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
841 print '</div>';
842 print '</td>';
843}
844// Ref document
845if (!empty($arrayfields['t.doc_ref']['checked'])) {
846 print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_doc_ref" value="'.dol_escape_htmltag($search_doc_ref).'"/></td>';
847}
848// Label operation
849if (!empty($arrayfields['t.label_operation']['checked'])) {
850 print '<td class="liste_titre"><input type="text" size="7" class="flat" name="search_label_operation" value="'.dol_escape_htmltag($search_label_operation).'"/></td>';
851}
852// Lettering code
853if (!empty($arrayfields['t.lettering_code']['checked'])) {
854 print '<td class="liste_titre center">';
855 print '<input type="text" size="3" class="flat" name="search_lettering_code" value="'.$search_lettering_code.'"/>';
856 print '<br><span class="nowrap"><input type="checkbox" name="search_not_reconciled" value="notreconciled"'.($search_not_reconciled == 'notreconciled' ? ' checked' : '').'>'.$langs->trans("NotReconciled").'</span>';
857 print '</td>';
858}
859// Debit
860if (!empty($arrayfields['t.debit']['checked'])) {
861 print '<td class="liste_titre right"><input type="text" class="flat" name="search_debit" size="4" value="'.dol_escape_htmltag($search_debit).'"></td>';
862}
863// Credit
864if (!empty($arrayfields['t.credit']['checked'])) {
865 print '<td class="liste_titre right"><input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'"></td>';
866}
867// Balance
868if (!empty($arrayfields['t.balance']['checked'])) {
869 print '<td></td>';
870}
871// Date export
872if (!empty($arrayfields['t.date_export']['checked'])) {
873 print '<td class="liste_titre center">';
874 print '<div class="nowrapfordate">';
875 print $form->selectDate($search_date_export_start, 'search_date_export_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
876 print '</div>';
877 print '<div class="nowrapfordate">';
878 print $form->selectDate($search_date_export_end, 'search_date_export_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
879 print '</div>';
880 print '</td>';
881}
882// Date validation
883if (!empty($arrayfields['t.date_validated']['checked'])) {
884 print '<td class="liste_titre center">';
885 print '<div class="nowrapfordate">';
886 print $form->selectDate($search_date_validation_start, 'search_date_validation_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("From"));
887 print '</div>';
888 print '<div class="nowrapfordate">';
889 print $form->selectDate($search_date_validation_end, 'search_date_validation_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans("to"));
890 print '</div>';
891 print '</td>';
892}
893if (!empty($arrayfields['t.import_key']['checked'])) {
894 print '<td class="liste_titre center">';
895 print '<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).'">';
896 print '</td>';
897}
898
899// Fields from hook
900$parameters = array('arrayfields'=>$arrayfields);
901$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
902print $hookmanager->resPrint;
903
904// Action column
905if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
906 print '<td class="liste_titre center">';
907 $searchpicto = $form->showFilterButtons();
908 print $searchpicto;
909 print '</td>';
910}
911print "</tr>\n";
912
913print '<tr class="liste_titre">';
914if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
915 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
916}
917if (!empty($arrayfields['t.piece_num']['checked'])) {
918 print_liste_field_titre($arrayfields['t.piece_num']['label'], $_SERVER['PHP_SELF'], "t.piece_num", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax80imp ');
919}
920if (!empty($arrayfields['t.code_journal']['checked'])) {
921 print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center ');
922}
923if (!empty($arrayfields['t.doc_date']['checked'])) {
924 print_liste_field_titre($arrayfields['t.doc_date']['label'], $_SERVER['PHP_SELF'], "t.doc_date", "", $param, '', $sortfield, $sortorder, 'center ');
925}
926if (!empty($arrayfields['t.doc_ref']['checked'])) {
927 print_liste_field_titre($arrayfields['t.doc_ref']['label'], $_SERVER['PHP_SELF'], "t.doc_ref", "", $param, "", $sortfield, $sortorder);
928}
929if (!empty($arrayfields['t.label_operation']['checked'])) {
930 print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
931}
932if (!empty($arrayfields['t.lettering_code']['checked'])) {
933 print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center ');
934}
935if (!empty($arrayfields['t.debit']['checked'])) {
936 print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, '', $sortfield, $sortorder, 'right ');
937}
938if (!empty($arrayfields['t.credit']['checked'])) {
939 print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right ');
940}
941if (!empty($arrayfields['t.balance']['checked'])) {
942 print_liste_field_titre($arrayfields['t.balance']['label'], "", "", "", $param, '', $sortfield, $sortorder, 'right ');
943}
944if (!empty($arrayfields['t.date_export']['checked'])) {
945 print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center ');
946}
947if (!empty($arrayfields['t.date_validated']['checked'])) {
948 print_liste_field_titre($arrayfields['t.date_validated']['label'], $_SERVER['PHP_SELF'], "t.date_validated", "", $param, '', $sortfield, $sortorder, 'center ');
949}
950if (!empty($arrayfields['t.import_key']['checked'])) {
951 print_liste_field_titre($arrayfields['t.import_key']['label'], $_SERVER["PHP_SELF"], "t.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
952}
953// Hook fields
954$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
955$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
956print $hookmanager->resPrint;
957if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
958 print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
959}
960print "</tr>\n";
961
962$displayed_account_number = null; // Start with undefined to be able to distinguish with empty
963
964// Loop on record
965// --------------------------------------------------------------------
966$i = 0;
967
968$totalarray = array();
969$totalarray['val'] = array();
970$totalarray['nbfield'] = 0;
971$total_debit = 0;
972$total_credit = 0;
973$sous_total_debit = 0;
974$sous_total_credit = 0;
975$totalarray['val']['totaldebit'] = 0;
976$totalarray['val']['totalcredit'] = 0;
977$totalarray['val']['totalbalance']=0;
978
979$colspan = 0; // colspan before field 'label of operation'
980$colspanend = 3; // colspan after debit/credit
981if (!empty($arrayfields['t.piece_num']['checked'])) { $colspan++; }
982if (!empty($arrayfields['t.code_journal']['checked'])) { $colspan++; }
983if (!empty($arrayfields['t.doc_date']['checked'])) { $colspan++; }
984if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
985if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
986if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
987if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
988if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
989if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
990 $colspan++;
991 $colspanend--;
992}
993
994while ($i < min($num, $limit)) {
995 $line = $object->lines[$i];
996
997 $total_debit += $line->debit;
998 $total_credit += $line->credit;
999
1000 if ($type == 'sub') {
1001 $accountg = length_accounta($line->subledger_account);
1002 } else {
1003 $accountg = length_accountg($line->numero_compte);
1004 }
1005 //if (empty($accountg)) $accountg = '-';
1006
1007 $colspan = 0; // colspan before field 'label of operation'
1008 $colspanend = 0; // colspan after debit/credit
1009 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1010 $colspan++;
1011 }
1012 if (!empty($arrayfields['t.piece_num']['checked'])) {
1013 $colspan++;
1014 }
1015 if (!empty($arrayfields['t.code_journal']['checked'])) {
1016 $colspan++;
1017 }
1018 if (!empty($arrayfields['t.doc_date']['checked'])) {
1019 $colspan++;
1020 }
1021 if (!empty($arrayfields['t.doc_ref']['checked'])) {
1022 $colspan++;
1023 }
1024 if (!empty($arrayfields['t.label_operation']['checked'])) {
1025 $colspan++;
1026 }
1027 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1028 $colspan++;
1029 }
1030
1031 if (!empty($arrayfields['t.balance']['checked'])) {
1032 $colspanend++;
1033 }
1034 if (!empty($arrayfields['t.date_export']['checked'])) {
1035 $colspanend++;
1036 }
1037 if (!empty($arrayfields['t.date_validated']['checked'])) {
1038 $colspanend++;
1039 }
1040 if (!empty($arrayfields['t.lettering_code']['checked'])) {
1041 $colspanend++;
1042 }
1043 if (!empty($arrayfields['t.import_key']['checked'])) {
1044 $colspanend++;
1045 }
1046 if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1047 $colspan++;
1048 $colspanend--;
1049 }
1050
1051 // Is it a break ?
1052 if ($accountg != $displayed_account_number || !isset($displayed_account_number)) {
1053 // Show a subtotal by accounting account
1054 if (isset($displayed_account_number)) {
1055 print '<tr class="liste_total">';
1056 if ($type == 'sub') {
1057 print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accounta($displayed_account_number) . ':</td>';
1058 } else {
1059 print '<td class="right" colspan="' . $colspan . '">' . $langs->trans("TotalForAccount") . ' ' . length_accountg($displayed_account_number) . ':</td>';
1060 }
1061 print '<td class="nowrap right">'.price(price2num($sous_total_debit, 'MT')).'</td>';
1062 print '<td class="nowrap right">'.price(price2num($sous_total_credit, 'MT')).'</td>';
1063 if ($colspanend > 0) {
1064 print '<td colspan="'.$colspanend.'"></td>';
1065 }
1066 print '</tr>';
1067 // Show balance of last shown account
1068 $balance = $sous_total_debit - $sous_total_credit;
1069 print '<tr class="liste_total">';
1070 print '<td class="right" colspan="'.$colspan.'">'.$langs->trans("Balance").':</td>';
1071 if ($balance > 0) {
1072 print '<td class="nowraponall right">';
1073 print price(price2num($sous_total_debit - $sous_total_credit, 'MT'));
1074 print '</td>';
1075 print '<td></td>';
1076 } else {
1077 print '<td></td>';
1078 print '<td class="nowraponall right">';
1079 print price(price2num($sous_total_credit - $sous_total_debit, 'MT'));
1080 print '</td>';
1081 }
1082 if ($colspanend > 0) {
1083 print '<td colspan="'.$colspanend.'"></td>';
1084 }
1085 print '</tr>';
1086 }
1087
1088 // Show the break account
1089 print '<tr class="trforbreak">';
1090 print '<td colspan="'.($totalarray['nbfield'] ? $totalarray['nbfield'] : count($arrayfields)+1).'" class="tdforbreak">';
1091 if ($type == 'sub') {
1092 if ($line->subledger_account != "" && $line->subledger_account != '-1') {
1093 print empty($line->subledger_label) ? '<span class="error">'.$langs->trans("Unknown").'</span>' : $line->subledger_label;
1094 print ' : ';
1095 print length_accounta($line->subledger_account);
1096 } else {
1097 // Should not happen: subledger account must be null or a non empty value
1098 print '<span class="error">' . $langs->trans("Unknown");
1099 if ($line->subledger_label) {
1100 print ' (' . $line->subledger_label . ')';
1101 $htmltext = 'EmptyStringForSubledgerAccountButSubledgerLabelDefined';
1102 } else {
1103 $htmltext = 'EmptyStringForSubledgerAccountAndSubledgerLabel';
1104 }
1105 print $form->textwithpicto('', $htmltext);
1106 print '</span>';
1107 }
1108 } else {
1109 if ($line->numero_compte != "" && $line->numero_compte != '-1') {
1110 print length_accountg($line->numero_compte) . ' : ' . $object->get_compte_desc($line->numero_compte);
1111 } else {
1112 print '<span class="error">' . $langs->trans("Unknown") . '</span>';
1113 }
1114 }
1115 print '</td>';
1116 print '</tr>';
1117
1118 $displayed_account_number = $accountg;
1119 //if (empty($displayed_account_number)) $displayed_account_number='-';
1120 $sous_total_debit = 0;
1121 $sous_total_credit = 0;
1122 }
1123
1124 print '<tr class="oddeven">';
1125 // Action column
1126 if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
1127 print '<td class="nowraponall center">';
1128 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
1129 $selected = 0;
1130 if (in_array($line->id, $arrayofselected)) {
1131 $selected = 1;
1132 }
1133 print '<input id="cb' . $line->id . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $line->id . '"' . ($selected ? ' checked="checked"' : '') . ' />';
1134 }
1135 print '</td>';
1136 if (!$i) {
1137 $totalarray['nbfield']++;
1138 }
1139 }
1140 // Piece number
1141 if (!empty($arrayfields['t.piece_num']['checked'])) {
1142 print '<td>';
1143 $object->id = $line->id;
1144 $object->piece_num = $line->piece_num;
1145 print $object->getNomUrl(1, '', 0, '', 1);
1146 print '</td>';
1147 if (!$i) {
1148 $totalarray['nbfield']++;
1149 }
1150 }
1151
1152 // Journal code
1153 if (!empty($arrayfields['t.code_journal']['checked'])) {
1154 $accountingjournal = new AccountingJournal($db);
1155 $result = $accountingjournal->fetch('', $line->code_journal);
1156 $journaltoshow = (($result > 0) ? $accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
1157 print '<td class="center tdoverflowmax80">'.$journaltoshow.'</td>';
1158 if (!$i) {
1159 $totalarray['nbfield']++;
1160 }
1161 }
1162
1163 // Document date
1164 if (!empty($arrayfields['t.doc_date']['checked'])) {
1165 print '<td class="center">'.dol_print_date($line->doc_date, 'day').'</td>';
1166 if (!$i) {
1167 $totalarray['nbfield']++;
1168 }
1169 }
1170
1171 // Document ref
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 //$modulepart = 'invoice_supplier';
1192
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 " " . $bank_ref;
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'] += $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'] += $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'] = price2num($totalarray['val']['totaldebit'], 'MT');
1382}
1383if (!empty($totalarray['val']['totalcredit'])) {
1384 $totalarray['val']['totalcredit'] = price2num($totalarray['val']['totalcredit'], 'MT');
1385}
1386if (!empty($totalarray['val']['totalbalance'])) {
1387 $totalarray['val']['totalbalance'] = 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();
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.
Classe permettant la generation de composants html autre Only common components are here.
Class Lettering.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Definition date.lib.php:613
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
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_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_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:121
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.