Bugzilla – Attachment 180489 Details for
Bug 38633
Calendar - Weekly closures are ignored when setting a yearly repeating holiday
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38633: Prevent holidays from being ignored
Bug-38633-Prevent-holidays-from-being-ignored.patch (text/plain), 7.98 KB, created by
Alexander Blanchard
on 2025-04-03 10:41:45 UTC
(
hide
)
Description:
Bug 38633: Prevent holidays from being ignored
Filename:
MIME Type:
Creator:
Alexander Blanchard
Created:
2025-04-03 10:41:45 UTC
Size:
7.98 KB
patch
obsolete
>From cf218e56bce65053e862963104dfd7352760973c Mon Sep 17 00:00:00 2001 >From: Alexander Blanchard <alexander.blanchard@openfifth.co.uk> >Date: Thu, 3 Apr 2025 10:15:18 +0000 >Subject: [PATCH] Bug 38633: Prevent holidays from being ignored > >If weekly repeatable holidays are set, Koha ignores these days when other holidays are set using the Holidays repeated yearly on a range option. > >To test: >1) Navigate to Tools > Calendar >2) Click on a weekend date on the calendar to open the Add New Holiday option >3) Give your holiday a title and select Holiday repeated every same day of the week >4) Click on the calendar again and set a holiday from 20 December 2021 to 06 January 2022 >5) Give your holiday a title >6) Select Holidays repeated yearly on a range and click save >7) Using the calendar, navigate forwards to December 2024 and note that there are days that should be highlighted in the holdiay period that are not highlighted >8) Apply Patch >9) Run the reset_all command >10) Repeat the steps above >11) Notice that now when you click forwards through the calendar, all of the dates for your holidays repeated yearly on a range are still selected >--- > C4/Calendar.pm | 4 +++- > misc/cronjobs/staticfines.pl | 2 +- > t/db_dependent/Holidays.t | 11 +++++++---- > tools/exceptionHolidays.pl | 8 ++++---- > tools/newHolidays.pl | 10 +++++----- > 5 files changed, 20 insertions(+), 15 deletions(-) > >diff --git a/C4/Calendar.pm b/C4/Calendar.pm >index e8b75a25d0..633a666dbf 100644 >--- a/C4/Calendar.pm >+++ b/C4/Calendar.pm >@@ -699,7 +699,9 @@ C<$year> Is the year to check whether if is a holiday or not. > =cut > > sub isHoliday { >- my ( $self, $day, $month, $year ) = @_; >+ my ( $self, $day, $month, $year, $is_range_holiday_creation ) = @_; >+ >+ return 0 if $is_range_holiday_creation; > > # FIXME - date strings are stored in non-padded metric format. should change to iso. > $month = $month + 0; >diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl >index 2d1895c251..599ce0b100 100755 >--- a/misc/cronjobs/staticfines.pl >+++ b/misc/cronjobs/staticfines.pl >@@ -181,7 +181,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > $calendars{$branchcode} = C4::Calendar->new( branchcode => $branchcode ); > } > $calendar = $calendars{$branchcode}; >- my $isHoliday = $calendar->isHoliday( $tday, $tmonth, $tyear ); >+ my $isHoliday = $calendar->isHoliday( $tday, $tmonth, $tyear, 0 ); > > # Reassing datedue_days if -delay specified in commandline > $bigdebug and warn "Using commandline supplied delay : $delay" if ($delay); >diff --git a/t/db_dependent/Holidays.t b/t/db_dependent/Holidays.t >index 3095475fed..8118438c99 100755 >--- a/t/db_dependent/Holidays.t >+++ b/t/db_dependent/Holidays.t >@@ -234,18 +234,21 @@ subtest 'copy_to_branch' => sub { > my $calendar2 = C4::Calendar->new( branchcode => $branch2 ); > my $exceptions = $calendar2->get_exception_holidays; > >- is( $calendar2->isHoliday( $sunday->day, $sunday->month, $sunday->year ), 1, "Weekday holiday copied to branch 2" ); > is( >- $calendar2->isHoliday( $day_month->day, $day_month->month, $day_month->year ), 1, >+ $calendar2->isHoliday( $sunday->day, $sunday->month, $sunday->year, 0 ), 1, >+ "Weekday holiday copied to branch 2" >+ ); >+ is( >+ $calendar2->isHoliday( $day_month->day, $day_month->month, $day_month->year, 0 ), 1, > "Day/month holiday copied to branch 2" > ); > is( >- $calendar2->isHoliday( $future_date->day, $future_date->month, $future_date->year ), 1, >+ $calendar2->isHoliday( $future_date->day, $future_date->month, $future_date->year, 0 ), 1, > "Single holiday copied to branch 2" > ); > is( ( grep { $_->{date} eq "9999-12-30" } values %$exceptions ), 1, "Exception holiday copied to branch 2" ); > is( >- $calendar2->isHoliday( $past_date->day, $past_date->month, $past_date->year ), 0, >+ $calendar2->isHoliday( $past_date->day, $past_date->month, $past_date->year, 0 ), 0, > "Don't copy past single holidays" > ); > is( ( grep { $_->{date} eq "2020-03-09" } values %$exceptions ), 0, "Don't copy past exception holidays " ); >diff --git a/tools/exceptionHolidays.pl b/tools/exceptionHolidays.pl >index e00b26bc8d..7a2340a38e 100755 >--- a/tools/exceptionHolidays.pl >+++ b/tools/exceptionHolidays.pl >@@ -93,7 +93,7 @@ sub edit_holiday { > } > } elsif ( $showoperation eq 'cud-edit' ) { > if ( $holidaytype eq 'weekday' ) { >- my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year, 0 ); > if ($isHoliday) { > $calendar->ModWeekdayholiday( > weekday => $weekday, >@@ -108,7 +108,7 @@ sub edit_holiday { > ); > } > } elsif ( $holidaytype eq 'daymonth' ) { >- my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year, 0 ); > if ($isHoliday) { > $calendar->ModDaymonthholiday( > day => $day, >@@ -125,7 +125,7 @@ sub edit_holiday { > ); > } > } elsif ( $holidaytype eq 'ymd' ) { >- my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year, 0 ); > if ($isHoliday) { > $calendar->ModSingleholiday( > day => $day, >@@ -144,7 +144,7 @@ sub edit_holiday { > ); > } > } elsif ( $holidaytype eq 'exception' ) { >- my $isHoliday = $calendar->isHoliday( $day, $month, $year ); >+ my $isHoliday = $calendar->isHoliday( $day, $month, $year, 0 ); > if ($isHoliday) { > $calendar->ModExceptionholiday( > day => $day, >diff --git a/tools/newHolidays.pl b/tools/newHolidays.pl >index 9cca4a9bc9..7a55be7387 100755 >--- a/tools/newHolidays.pl >+++ b/tools/newHolidays.pl >@@ -89,7 +89,7 @@ sub add_holiday { > # if not, we need it. > $weekday = &Date::Calc::Day_of_Week( $year, $month, $day ) % 7 unless ($weekday); > } >- unless ( $calendar->isHoliday( $day, $month, $year ) ) { >+ unless ( $calendar->isHoliday( $day, $month, $year, 0 ) ) { > $calendar->insert_week_day_holiday( > weekday => $weekday, > title => $title, >@@ -97,7 +97,7 @@ sub add_holiday { > ); > } > } elsif ( $newoperation eq 'repeatable' ) { >- unless ( $calendar->isHoliday( $day, $month, $year ) ) { >+ unless ( $calendar->isHoliday( $day, $month, $year, 0 ) ) { > $calendar->insert_day_month_holiday( > day => $day, > month => $month, >@@ -106,7 +106,7 @@ sub add_holiday { > ); > } > } elsif ( $newoperation eq 'holiday' ) { >- unless ( $calendar->isHoliday( $day, $month, $year ) ) { >+ unless ( $calendar->isHoliday( $day, $month, $year, 0 ) ) { > $calendar->insert_single_holiday( > day => $day, > month => $month, >@@ -121,7 +121,7 @@ sub add_holiday { > foreach my $date (@holiday_list) { > unless ( > $calendar->isHoliday( >- $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year} >+ $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year}, 0 > ) > ) > { >@@ -140,7 +140,7 @@ sub add_holiday { > foreach my $date (@holiday_list) { > unless ( > $calendar->isHoliday( >- $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year} >+ $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year}, 1 > ) > ) > { >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38633
:
180489
|
180533
|
180728