View | Details | Raw Unified | Return to bug 38633
Collapse All | Expand All

(-)a/C4/Calendar.pm (-1 / +3 lines)
Lines 688-694 sub delete_exception_holiday_range { Link Here
688
688
689
=head2 isHoliday
689
=head2 isHoliday
690
690
691
    $isHoliday = isHoliday($day, $month $year);
691
    $isHoliday = isHoliday($day, $month $year, $is_range_holiday_creation);
692
692
693
C<$day> Is the day to check whether if is a holiday or not.
693
C<$day> Is the day to check whether if is a holiday or not.
694
694
Lines 696-701 C<$month> Is the month to check whether if is a holiday or not. Link Here
696
696
697
C<$year> Is the year to check whether if is a holiday or not.
697
C<$year> Is the year to check whether if is a holiday or not.
698
698
699
C<$is_range_holiday_creation> When set to 1, skips checks for existing holidays, ensuring the range includes all applicable holidays
700
699
=cut
701
=cut
700
702
701
sub isHoliday {
703
sub isHoliday {
(-)a/t/db_dependent/Holidays.t (-4 / +7 lines)
Lines 234-251 subtest 'copy_to_branch' => sub { Link Here
234
    my $calendar2  = C4::Calendar->new( branchcode => $branch2 );
234
    my $calendar2  = C4::Calendar->new( branchcode => $branch2 );
235
    my $exceptions = $calendar2->get_exception_holidays;
235
    my $exceptions = $calendar2->get_exception_holidays;
236
236
237
    is( $calendar2->isHoliday( $sunday->day, $sunday->month, $sunday->year ), 1, "Weekday holiday copied to branch 2" );
238
    is(
237
    is(
239
        $calendar2->isHoliday( $day_month->day, $day_month->month, $day_month->year ), 1,
238
        $calendar2->isHoliday( $sunday->day, $sunday->month, $sunday->year, 0 ), 1,
239
        "Weekday holiday copied to branch 2"
240
    );
241
    is(
242
        $calendar2->isHoliday( $day_month->day, $day_month->month, $day_month->year, 0 ), 1,
240
        "Day/month holiday copied to branch 2"
243
        "Day/month holiday copied to branch 2"
241
    );
244
    );
242
    is(
245
    is(
243
        $calendar2->isHoliday( $future_date->day, $future_date->month, $future_date->year ), 1,
246
        $calendar2->isHoliday( $future_date->day, $future_date->month, $future_date->year, 0 ), 1,
244
        "Single holiday copied to branch 2"
247
        "Single holiday copied to branch 2"
245
    );
248
    );
246
    is( ( grep { $_->{date} eq "9999-12-30" } values %$exceptions ), 1, "Exception holiday copied to branch 2" );
249
    is( ( grep { $_->{date} eq "9999-12-30" } values %$exceptions ), 1, "Exception holiday copied to branch 2" );
247
    is(
250
    is(
248
        $calendar2->isHoliday( $past_date->day, $past_date->month, $past_date->year ), 0,
251
        $calendar2->isHoliday( $past_date->day, $past_date->month, $past_date->year, 0 ), 0,
249
        "Don't copy past single holidays"
252
        "Don't copy past single holidays"
250
    );
253
    );
251
    is( ( grep { $_->{date} eq "2020-03-09" } values %$exceptions ), 0, "Don't copy past exception holidays " );
254
    is( ( grep { $_->{date} eq "2020-03-09" } values %$exceptions ), 0, "Don't copy past exception holidays " );
(-)a/tools/newHolidays.pl (-14 / +6 lines)
Lines 138-156 sub add_holiday { Link Here
138
    } elsif ( $newoperation eq 'holidayrangerepeat' ) {
138
    } elsif ( $newoperation eq 'holidayrangerepeat' ) {
139
        if (@holiday_list) {
139
        if (@holiday_list) {
140
            foreach my $date (@holiday_list) {
140
            foreach my $date (@holiday_list) {
141
                unless (
141
                $calendar->insert_day_month_holiday(
142
                    $calendar->isHoliday(
142
                    day         => $date->{local_c}->{day},
143
                        $date->{local_c}->{day}, $date->{local_c}->{month}, $date->{local_c}->{year}
143
                    month       => $date->{local_c}->{month},
144
                    )
144
                    title       => $title,
145
                    )
145
                    description => $description
146
                {
146
                );
147
                    $calendar->insert_day_month_holiday(
148
                        day         => $date->{local_c}->{day},
149
                        month       => $date->{local_c}->{month},
150
                        title       => $title,
151
                        description => $description
152
                    );
153
                }
154
            }
147
            }
155
        }
148
        }
156
    }
149
    }
157
- 

Return to bug 38633