From 249eaeb22d4106b46da60258e21247ed57940dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 27 Apr 2023 20:34:46 +0200 Subject: [PATCH 1/4] fix warnings --- htdocs/accountancy/journal/bankjournal.php | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 89f495a97bc..4720a01e9be 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -195,13 +195,13 @@ if ($result) { //print $sql; // Variables - $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word - $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word - $account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word + $account_supplier = getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER', 'NotDefined'); // NotDefined is a reserved word + $account_customer = getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER', 'NotDefined'); // NotDefined is a reserved word + $account_employee = getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT', 'NotDefined'); // NotDefined is a reserved word + $account_pay_vat = getDolGlobalString('ACCOUNTING_VAT_PAY_ACCOUNT', 'NotDefined'); // NotDefined is a reserved word + $account_pay_donation = getDolGlobalString('DONATION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word + $account_pay_subscription = getDolGlobalString('ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT', 'NotDefined'); // NotDefined is a reserved word + $account_transfer = getDolGlobalString('ACCOUNTING_ACCOUNT_TRANSFER_CASH', 'NotDefined'); // NotDefined is a reserved word $tabcompany = array(); $tabuser = array(); @@ -1088,9 +1088,9 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger - if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' - || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1' - || empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER' == "") || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' + || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' + || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { print ($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); $desc = ' : '.$langs->trans("AccountancyAreaDescMisc", 4, '{link}'); $desc = str_replace('{link}', ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").'', $desc); @@ -1105,8 +1105,8 @@ if (empty($action) || $action == 'view') { print ''; } - if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' - || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' + || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1') { print ''; } else { if ($in_bookkeeping == 'notyet') { From 5be9203d546bf6d1cadd231f10e6c194b62feac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 28 Apr 2023 20:46:19 +0200 Subject: [PATCH 2/4] fix nedd buy new glasses --- htdocs/accountancy/journal/bankjournal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 4720a01e9be..b79d63cfbce 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1088,7 +1088,7 @@ if (empty($action) || $action == 'view') { // Button to write into Ledger - if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER' == "") || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' + if (getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER') == '-1' || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == "" || getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER') == '-1' || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == "" || getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT') == '-1') { print ($desc ? '' : '
').'
'.img_warning().' '.$langs->trans("SomeMandatoryStepsOfSetupWereNotDone"); From 0c93c89a94f448d51941174a1f2aa242952b0e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 29 Apr 2023 09:08:38 +0200 Subject: [PATCH 3/4] clean code --- htdocs/accountancy/journal/bankjournal.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b79d63cfbce..3e2aa4b3b4a 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -7,7 +7,7 @@ * Copyright (C) 2013-2022 Open-DSI * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy - * Copyright (C) 2017-2021 Frédéric France + * Copyright (C) 2017-2023 Frédéric France * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Eric Seigne * Copyright (C) 2021 Gauthier VERDOL @@ -148,7 +148,7 @@ if ($date_start && $date_end) { } // Define begin binding date if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { - $sql .= " AND b.dateo >= '".$db->idate($conf->global->ACCOUNTING_DATE_START_BINDING)."'"; + $sql .= " AND b.dateo >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') { @@ -912,7 +912,7 @@ if (!$error && $action == 'writebookkeeping') { // Export if ($action == 'exportcsv') { // ISO and not UTF8 ! - $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; + $sep = getDolGlobalString('ACCOUNTING_EXPORT_SEPARATORCSV'); $filename = 'journal'; $type_export = 'journal'; @@ -983,13 +983,13 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$val["type_payment"].'"'.$sep; print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; if ($tabtype[$key] == 'payment_supplier') { - print '"'.$conf->global->ACCOUNTING_ACCOUNT_SUPPLIER.'"'.$sep; + print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_SUPPLIER').'"'.$sep; } elseif ($tabtype[$key] == 'payment') { - print '"'.$conf->global->ACCOUNTING_ACCOUNT_CUSTOMER.'"'.$sep; + print '"'.getDolGlobalString('ACCOUNTING_ACCOUNT_CUSTOMER').'"'.$sep; } elseif ($tabtype[$key] == 'payment_expensereport') { - print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep; + print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; } elseif ($tabtype[$key] == 'payment_salary') { - print '"'.$conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT.'"'.$sep; + print '"'.getDolGlobalString('SALARIES_ACCOUNTING_ACCOUNT_PAYMENT').'"'.$sep; } else { print '"'.length_accountg(html_entity_decode($k)).'"'.$sep; } @@ -1014,8 +1014,8 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"'.$key.'"'.$sep; print '"'.$date.'"'.$sep; print '"'.$val["type_payment"].'"'.$sep; - print '"'.length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; - print '"'.length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE).'"'.$sep; + print '"'.length_accountg(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep; + print '"'.length_accounta(getDolGlobalString('ACCOUNTING_ACCOUNT_SUSPENSE')).'"'.$sep; print "".$sep; print '"'.$reflabel.'"'.$sep; print '"'.($mt < 0 ? price(-$mt) : '').'"'.$sep; From 0a89cb6c50b6af54a9ff788073e6958c20c82f77 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 2 May 2023 06:11:23 +0200 Subject: [PATCH 4/4] Update bankjournal.php --- htdocs/accountancy/journal/bankjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 3e2aa4b3b4a..76f25557662 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -147,8 +147,8 @@ if ($date_start && $date_end) { $sql .= " AND b.dateo >= '".$db->idate($date_start)."' AND b.dateo <= '".$db->idate($date_end)."'"; } // Define begin binding date -if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) { - $sql .= " AND b.dateo >= '".$db->idate(getDolGlobalString('ACCOUNTING_DATE_START_BINDING'))."'"; +if (getDolGlobalInt('ACCOUNTING_DATE_START_BINDING')) { + $sql .= " AND b.dateo >= '".$db->idate(getDolGlobalInt('ACCOUNTING_DATE_START_BINDING'))."'"; } // Already in bookkeeping or not if ($in_bookkeeping == 'already') {