From 6f9305cb589185cdf2776d8dee357f7553a05f83 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 29 Aug 2022 05:18:15 +0200 Subject: [PATCH 1/6] PHP8 Warning --- htdocs/accountancy/admin/categories.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 39aa21f2d63..68d4c03e0a6 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -1,6 +1,6 @@ - * Copyright (C) 2017 Alexandre Spangaro +/* Copyright (C) 2016 Jamal Elbaz + * Copyright (C) 2017-2022 Alexandre Spangaro * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -124,7 +124,8 @@ if (!empty($cat_id)) { $arraykeyvalue = array(); foreach ($accountingcategory->lines_cptbk as $key => $val) { - $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte).' ('.$val->label_compte.($val->doc_ref ? ' '.$val->doc_ref : '').')'; + $doc_ref = !empty($val->doc_ref) ? $val->doc_ref : ''; + $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' - ' . $val->label_compte . $doc_ref; } if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) { From f59795224fc5152383bed98868dbc7362e4a8156 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 29 Aug 2022 05:26:57 +0200 Subject: [PATCH 2/6] PHP8 Warnings --- htdocs/accountancy/bookkeeping/card.php | 31 ++++++++++--------- .../accountancy/class/bookkeeping.class.php | 8 +++-- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index c2071e76cea..9a91dcf675e 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -540,21 +540,24 @@ if ($action == 'create') { print ''; print ''; - // Date document export - print ''; - print ''.$langs->trans("DateExport").''; - print ''; - print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; - print ''; - print ''; + // Don't show in tmp mode, inevitably empty + if ($mode != "_tmp") { + // Date document export + print ''; + print '' . $langs->trans("DateExport") . ''; + print ''; + print $object->date_export ? dol_print_date($object->date_export, 'dayhour') : ' '; + print ''; + print ''; - // Date document validation - print ''; - print ''.$langs->trans("DateValidation").''; - print ''; - print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; - print ''; - print ''; + // Date document validation + print ''; + print '' . $langs->trans("DateValidation") . ''; + print ''; + print $object->date_validation ? dol_print_date($object->date_validation, 'dayhour') : ' '; + print ''; + print ''; + } // Validate /* diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 992b885f272..14a500c3ff3 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1667,7 +1667,9 @@ class BookKeeping extends CommonObject $this->doc_type = $obj->doc_type; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - $this->date_export = $this->db->jdate($obj->date_export); + if ($mode != "_tmp") { + $this->date_export = $this->db->jdate($obj->date_export); + } $this->date_validation = $this->db->jdate($obj->date_validation); } else { $this->error = "Error ".$this->db->lasterror(); @@ -1764,7 +1766,9 @@ class BookKeeping extends CommonObject $line->piece_num = $obj->piece_num; $line->date_creation = $obj->date_creation; $line->date_modification = $obj->date_modification; - $line->date_export = $obj->date_export; + if ($mode != "_tmp") { + $line->date_export = $obj->date_export; + } $line->date_validation = $obj->date_validation; $this->linesmvt[] = $line; From 4159aab038fc69f5c1be48b645171520b3712388 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 29 Aug 2022 05:43:25 +0200 Subject: [PATCH 3/6] PHP8 Warnings --- htdocs/accountancy/bookkeeping/list.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index f27a23256b6..23d33acd3b7 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018-2021 Frédéric France * @@ -1133,6 +1133,13 @@ $line = new BookKeepingLine(); // -------------------------------------------------------------------- $i = 0; $totalarray = array(); +$totalarray['val'] = array (); +$totalarray['nbfield'] = 0; +$total_debit = 0; +$total_credit = 0; +$totalarray['val']['totaldebit'] = 0; +$totalarray['val']['totalcredit'] = 0; + while ($i < min($num, $limit)) { $obj = $db->fetch_object($resql); if (empty($obj)) { From 3ec7a2796021d8f5990fdf050bb073fa3749b946 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 29 Aug 2022 05:43:33 +0200 Subject: [PATCH 4/6] PHP8 Warnings --- htdocs/accountancy/bookkeeping/listbyaccount.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 0bd1c06aab8..4b5f0d9bad6 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -824,17 +824,22 @@ print $hookmanager->resPrint; print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; - -$total_debit = 0; -$total_credit = 0; -$sous_total_debit = 0; -$sous_total_credit = 0; $displayed_account_number = null; // Start with undefined to be able to distinguish with empty // Loop on record // -------------------------------------------------------------------- $i = 0; + $totalarray = array(); +$totalarray['val'] = array (); +$totalarray['nbfield'] = 0; +$total_debit = 0; +$total_credit = 0; +$sous_total_debit = 0; +$sous_total_credit = 0; +$totalarray['val']['totaldebit'] = 0; +$totalarray['val']['totalcredit'] = 0; + while ($i < min($num, $limit)) { $line = $object->lines[$i]; From 32a6f3f7568d1e3e00507061da1b2cefd014b9a0 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 29 Aug 2022 05:48:18 +0200 Subject: [PATCH 5/6] PHP8 Warnings --- htdocs/accountancy/bookkeeping/card.php | 2 +- htdocs/accountancy/class/bookkeeping.class.php | 2 +- htdocs/accountancy/tpl/export_journal.tpl.php | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 9a91dcf675e..315b7a49847 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2021 Alexandre Spangaro + * Copyright (C) 2013-2022 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018-2020 Frédéric France * diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 14a500c3ff3..0cc8ab4e8d9 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2015-2020 Florian Henry * Copyright (C) 2018-2020 Frédéric France * diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index b595402228e..22537a60a39 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2022 Alexandre Spangaro * Copyright (C) 2016 Charlie Benke * * This program is free software; you can redistribute it and/or modify @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -// $formatexportset ùust be defined +// $formatexportset must be defined // Protection to avoid direct call of template if (empty($conf) || !is_object($conf)) { @@ -24,11 +24,11 @@ if (empty($conf) || !is_object($conf)) { exit; } -$code = $conf->global->MAIN_INFO_ACCOUNTANT_CODE; -$prefix = $conf->global->ACCOUNTING_EXPORT_PREFIX_SPEC; -$format = $conf->global->ACCOUNTING_EXPORT_FORMAT; -$nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; -$siren = $conf->global->MAIN_INFO_SIREN; +$code = getDolGlobalString('MAIN_INFO_ACCOUNTANT_CODE'); +$prefix = getDolGlobalString('ACCOUNTING_EXPORT_PREFIX_SPEC'); +$format = getDolGlobalString('ACCOUNTING_EXPORT_FORMAT'); +$nodateexport = getDolGlobalInt('ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME'); +$siren = getDolGlobalString('MAIN_INFO_SIREN'); $date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); From 87df13507c7f9a709a83ed7e42c7d6298d6bb9cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 30 Aug 2022 01:21:49 +0200 Subject: [PATCH 6/6] Update categories.php --- htdocs/accountancy/admin/categories.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 68d4c03e0a6..e65572eafd3 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -125,7 +125,7 @@ if (!empty($cat_id)) { $arraykeyvalue = array(); foreach ($accountingcategory->lines_cptbk as $key => $val) { $doc_ref = !empty($val->doc_ref) ? $val->doc_ref : ''; - $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' - ' . $val->label_compte . $doc_ref; + $arraykeyvalue[length_accountg($val->numero_compte)] = length_accountg($val->numero_compte) . ' - ' . $val->label_compte . ($doc_ref ? ' '.$doc_ref : ''); } if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {