[Koha-bugs] [Bug 8418] Koha::Calendar is_holiday ignores all user data

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Sep 6 06:15:55 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8418

L. Bareño <leonardobareno at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |leonardobareno at gmail.com

--- Comment #24 from L. Bareño <leonardobareno at gmail.com> ---
1) Current code in ./Koha/Calendar.pm is ignoring single holidays (those whose
special_holidays.isexception == 0)

(line numbers and code from master at this message's date)

./Koha/Calendar.pm

line 68:
- $special->execute( $branch, 1 );
+ $special->execute( $branch, 0 );


2) exception_holidays are not holidays, and (please you people tell me if the
following interpretation I'm doing is correct) these must disable any other
repeatable or single holiday.

lines 141-165 (suggested code):
sub is_holiday {
    my ( $self, $dt ) = @_;
    if ( $self->{exception_holidays}->contains($dt) ) {
        return 0;
    }
    my $dow = $dt->day_of_week;
    if ( $dow == 7 ) {
        $dow = 0;
    }
    if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
        return 1;
    }
    $dt->truncate( to => 'day' );
    my $day   = $dt->day;
    my $month = $dt->month;
    if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) {
        return 1;
    }
    if ( $self->{single_holidays}->contains($dt) ) {
        return 1;
    }

    # damn have to go to work after all
    return 0;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list