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

(-)a/Koha/Calendar.pm (-4 / +5 lines)
Lines 140-155 sub addDate { Link Here
140
140
141
sub is_holiday {
141
sub is_holiday {
142
    my ( $self, $dt ) = @_;
142
    my ( $self, $dt ) = @_;
143
    my $dow = $dt->day_of_week;
143
    my $localdt = $dt->clone();
144
    my $dow = $localdt->day_of_week;
144
    if ( $dow == 7 ) {
145
    if ( $dow == 7 ) {
145
        $dow = 0;
146
        $dow = 0;
146
    }
147
    }
147
    if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
148
    if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
148
        return 1;
149
        return 1;
149
    }
150
    }
150
    $dt->truncate( to => 'day' );
151
    $localdt->truncate( to => 'day' );
151
    my $day   = $dt->day;
152
    my $day   = $localdt->day;
152
    my $month = $dt->month;
153
    my $month = $localdt->month;
153
    if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) {
154
    if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) {
154
        return 1;
155
        return 1;
155
    }
156
    }
(-)a/t/Calendar.t (-2 / +5 lines)
Lines 3-9 Link Here
3
use strict;
3
use strict;
4
use warnings;
4
use warnings;
5
use DateTime;
5
use DateTime;
6
use Test::More tests => 21;
6
use Test::More tests => 23;
7
use Koha::DateUtils;
7
use Koha::DateUtils;
8
8
9
BEGIN {
9
BEGIN {
Lines 103-108 $ret = $cal->addDate( $test_dt, 7, 'days' ); Link Here
103
cmp_ok( $ret->ymd(), 'eq', '2012-07-30', 'Add 7 days Days mode' );
103
cmp_ok( $ret->ymd(), 'eq', '2012-07-30', 'Add 7 days Days mode' );
104
$cal->set_daysmode('Calendar');
104
$cal->set_daysmode('Calendar');
105
105
106
# see bugzilla #8966
107
is( $cal->is_holiday($later_dt), 0, 'is holiday for the next test' );
108
cmp_ok( $later_dt, 'eq', '2012-09-17T17:30:00', 'Date should be the same after is_holiday' );
109
106
# example tests for bug report
110
# example tests for bug report
107
$cal->clear_weekly_closed_days();
111
$cal->clear_weekly_closed_days();
108
112
109
- 

Return to bug 8966