From 9988925fb5bb1c08bf3cee5dbb574b1f195037f9 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 28 Nov 2023 13:24:49 +0000 Subject: [PATCH] Bug 35418: Fix _get_usage_months No longer falls in an endless loop if the last month in the report period is december. Test plan: 1) Apply just the tests patch, run EUsage tests prove t/db_dependent/Koha/ERM/EUsage/ 2) Wait for a few seconds. Notice SushiCounter.t it hangs. CTRL+C (cancel it) 3) Apply the fix patch. 4) Run the tests again. Notice all EUsage tests pass with no issues. Signed-off-by: David Nind Signed-off-by: Andrew Auld Signed-off-by: Tomas Cohen Arazi --- Koha/ERM/EUsage/SushiCounter.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/ERM/EUsage/SushiCounter.pm b/Koha/ERM/EUsage/SushiCounter.pm index d128b868b7..4e33f8988f 100644 --- a/Koha/ERM/EUsage/SushiCounter.pm +++ b/Koha/ERM/EUsage/SushiCounter.pm @@ -681,7 +681,7 @@ sub _get_usage_months { my $end_year = substr( $end_date[0], 0, 4 ); my @month_headings = (); - while ( $begin_month <= $end_month || $begin_year < $end_year ) { + while ( $begin_year <= $end_year && ( $begin_year != $end_year || $begin_month <= $end_month ) ) { push( @month_headings, $column_headings_formatting -- 2.39.5