From abd9a639a2c1ea56273cd8a34b3f322120f641e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 14 Mar 2021 23:41:06 +0100 Subject: [PATCH 1/2] fix php8 warning --- htdocs/core/lib/accounting.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 6b2526477b3..790de33eea8 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -3,6 +3,7 @@ * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2019 Eric Seigne + * Copyright (C) 2021 Frédéric France * * 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 @@ -274,8 +275,7 @@ function getDefaultDatesForTransfer() global $db, $conf; // Period by default on transfer (0: previous month | 1: current month | 2: fiscal year) - $periodbydefaultontransfer = $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER; - isset($periodbydefaultontransfer) ? $periodbydefaultontransfer : 0; + $periodbydefaultontransfer = (!empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0); if ($periodbydefaultontransfer == 2) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'"; From 57f9607e3e8bacbe2716e067131dbb8d8c9417d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Mar 2021 11:01:01 +0100 Subject: [PATCH 2/2] Update accounting.lib.php --- htdocs/core/lib/accounting.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/accounting.lib.php b/htdocs/core/lib/accounting.lib.php index 790de33eea8..36a74f8f85e 100644 --- a/htdocs/core/lib/accounting.lib.php +++ b/htdocs/core/lib/accounting.lib.php @@ -275,7 +275,7 @@ function getDefaultDatesForTransfer() global $db, $conf; // Period by default on transfer (0: previous month | 1: current month | 2: fiscal year) - $periodbydefaultontransfer = (!empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER : 0); + $periodbydefaultontransfer = (empty($conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER) ? 0 : $conf->global->ACCOUNTING_DEFAULT_PERIOD_ON_TRANSFER); if ($periodbydefaultontransfer == 2) { $sql = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; $sql .= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."'";