From 282dda8660e07762f8b34d75b1e62c0df1ef327c Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 24 Aug 2022 22:17:32 +0200 Subject: [PATCH] fix: use Dolibarr std method and set correct end Year on CA report --- htdocs/compta/resultat/clientfourn.php | 6 +++--- htdocs/compta/resultat/index.php | 6 +++--- htdocs/compta/stats/index.php | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 30d4f4ce825..44591b8bd2b 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -69,12 +69,12 @@ if (!$sortorder) { // Date range $year = GETPOST('year', 'int'); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); - $month_current = strftime("%m", dol_now()); + $year_current = dol_print_date(dol_now(), "%Y"); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year_current; } else { $year_current = $year; - $month_current = strftime("%m", dol_now()); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year; } $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 68068dec866..65e4e2a4f06 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -47,12 +47,12 @@ $nbofyear = 4; // Date range $year = GETPOST('year', 'int'); if (empty($year)) { - $year_current = strftime("%Y", dol_now()); - $month_current = strftime("%m", dol_now()); + $year_current = dol_print_date(dol_now(), "%Y"); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year_current - ($nbofyear - 1); } else { $year_current = $year; - $month_current = strftime("%m", dol_now()); + $month_current = dol_print_date(dol_now(), "%m"); $year_start = $year - ($nbofyear - 1); } $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_startyear); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index e7ec8c61db7..2c16ee8612c 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -69,6 +69,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $month_end = $month_start - 1; if ($month_end < 1) { $month_end = 12; + } else { + $year_end++; } } else { $month_end = $month_start;