Bugzilla – Attachment 186432 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), 4.76 KB, created by
Alexander Blanchard
on 2025-09-15 14:44:17 UTC
(
hide
)
Description:
Bug 38633: Prevent holidays from being ignored
Filename:
MIME Type:
Creator:
Alexander Blanchard
Created:
2025-09-15 14:44:17 UTC
Size:
4.76 KB
patch
obsolete
>From 1fa9b305cd0dc89a30addecd0f74954c602dc6af 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 +++- > t/db_dependent/Holidays.t | 11 +++++++---- > tools/newHolidays.pl | 19 ++++++------------- > 3 files changed, 16 insertions(+), 18 deletions(-) > >diff --git a/C4/Calendar.pm b/C4/Calendar.pm >index e8b75a25d08..b3639585c0c 100644 >--- a/C4/Calendar.pm >+++ b/C4/Calendar.pm >@@ -688,7 +688,7 @@ sub delete_exception_holiday_range { > > =head2 isHoliday > >- $isHoliday = isHoliday($day, $month $year); >+ $isHoliday = isHoliday($day, $month $year, $is_range_holiday_creation); > > C<$day> Is the day to check whether if is a holiday or not. > >@@ -696,6 +696,8 @@ C<$month> Is the month to check whether if is a holiday or not. > > C<$year> Is the year to check whether if is a holiday or not. > >+C<$is_range_holiday_creation> When set to 1, skips checks for existing holidays, ensuring the range includes all applicable holidays >+ > =cut > > sub isHoliday { >diff --git a/t/db_dependent/Holidays.t b/t/db_dependent/Holidays.t >index 3095475fed5..8118438c99f 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/newHolidays.pl b/tools/newHolidays.pl >index 9cca4a9bc97..226328f975b 100755 >--- a/tools/newHolidays.pl >+++ b/tools/newHolidays.pl >@@ -138,19 +138,12 @@ sub add_holiday { > } elsif ( $newoperation eq 'holidayrangerepeat' ) { > if (@holiday_list) { > foreach my $date (@holiday_list) { >- unless ( >- $calendar->isHoliday( >- $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year} >- ) >- ) >- { >- $calendar->insert_day_month_holiday( >- day => $date->{local_c}->{day}, >- month => $date->{local_c}->{month}, >- title => $title, >- description => $description >- ); >- } >+ $calendar->insert_day_month_holiday( >+ day => $date->{local_c}->{day}, >+ month => $date->{local_c}->{month}, >+ title => $title, >+ description => $description >+ ); > } > } > } >-- >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
|
186432
|
186435