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

(-)a/C4/Calendar.pm (-7 / +7 lines)
Lines 278-284 sub insert_single_holiday { Link Here
278
    # changed the 'single_holidays' table, lets force/reset its cache
278
    # changed the 'single_holidays' table, lets force/reset its cache
279
    my $cache = Koha::Caches->get_instance();
279
    my $cache = Koha::Caches->get_instance();
280
    $cache->clear_from_cache( 'single_holidays') ;
280
    $cache->clear_from_cache( 'single_holidays') ;
281
    $cache->clear_from_cache( 'exception_holidays') ;
281
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
282
282
283
    return $self;
283
    return $self;
284
284
Lines 323-329 sub insert_exception_holiday { Link Here
323
    # changed the 'single_holidays' table, lets force/reset its cache
323
    # changed the 'single_holidays' table, lets force/reset its cache
324
    my $cache = Koha::Caches->get_instance();
324
    my $cache = Koha::Caches->get_instance();
325
    $cache->clear_from_cache( 'single_holidays') ;
325
    $cache->clear_from_cache( 'single_holidays') ;
326
    $cache->clear_from_cache( 'exception_holidays') ;
326
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
327
327
328
    return $self;
328
    return $self;
329
}
329
}
Lines 424-430 UPDATE special_holidays SET title = ?, description = ? Link Here
424
    # changed the 'single_holidays' table, lets force/reset its cache
424
    # changed the 'single_holidays' table, lets force/reset its cache
425
    my $cache = Koha::Caches->get_instance();
425
    my $cache = Koha::Caches->get_instance();
426
    $cache->clear_from_cache( 'single_holidays') ;
426
    $cache->clear_from_cache( 'single_holidays') ;
427
    $cache->clear_from_cache( 'exception_holidays') ;
427
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
428
428
429
    return $self;
429
    return $self;
430
}
430
}
Lines 467-473 UPDATE special_holidays SET title = ?, description = ? Link Here
467
    # changed the 'single_holidays' table, lets force/reset its cache
467
    # changed the 'single_holidays' table, lets force/reset its cache
468
    my $cache = Koha::Caches->get_instance();
468
    my $cache = Koha::Caches->get_instance();
469
    $cache->clear_from_cache( 'single_holidays') ;
469
    $cache->clear_from_cache( 'single_holidays') ;
470
    $cache->clear_from_cache( 'exception_holidays') ;
470
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
471
471
472
    return $self;
472
    return $self;
473
}
473
}
Lines 548-554 sub delete_holiday { Link Here
548
    # changed the 'single_holidays' table, lets force/reset its cache
548
    # changed the 'single_holidays' table, lets force/reset its cache
549
    my $cache = Koha::Caches->get_instance();
549
    my $cache = Koha::Caches->get_instance();
550
    $cache->clear_from_cache( 'single_holidays') ;
550
    $cache->clear_from_cache( 'single_holidays') ;
551
    $cache->clear_from_cache( 'exception_holidays') ;
551
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
552
552
553
    return $self;
553
    return $self;
554
}
554
}
Lines 579-585 sub delete_holiday_range { Link Here
579
    # changed the 'single_holidays' table, lets force/reset its cache
579
    # changed the 'single_holidays' table, lets force/reset its cache
580
    my $cache = Koha::Caches->get_instance();
580
    my $cache = Koha::Caches->get_instance();
581
    $cache->clear_from_cache( 'single_holidays') ;
581
    $cache->clear_from_cache( 'single_holidays') ;
582
    $cache->clear_from_cache( 'exception_holidays') ;
582
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
583
583
584
}
584
}
585
585
Lines 633-639 sub delete_exception_holiday_range { Link Here
633
    # changed the 'single_holidays' table, lets force/reset its cache
633
    # changed the 'single_holidays' table, lets force/reset its cache
634
    my $cache = Koha::Caches->get_instance();
634
    my $cache = Koha::Caches->get_instance();
635
    $cache->clear_from_cache( 'single_holidays') ;
635
    $cache->clear_from_cache( 'single_holidays') ;
636
    $cache->clear_from_cache( 'exception_holidays') ;
636
    $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ;
637
}
637
}
638
638
639
=head2 isHoliday
639
=head2 isHoliday
(-)a/Koha/Calendar.pm (-3 / +4 lines)
Lines 55-66 sub _init { Link Here
55
sub exception_holidays {
55
sub exception_holidays {
56
    my ( $self ) = @_;
56
    my ( $self ) = @_;
57
57
58
    my $branch = $self->{branchcode};
58
    my $cache  = Koha::Caches->get_instance();
59
    my $cache  = Koha::Caches->get_instance();
59
    my $cached = $cache->get_from_cache('exception_holidays');
60
    my $key = 'exception_holidays_'.$branch;
61
    my $cached = $cache->get_from_cache($key);
60
    return $cached if $cached;
62
    return $cached if $cached;
61
63
62
    my $dbh = C4::Context->dbh;
64
    my $dbh = C4::Context->dbh;
63
    my $branch = $self->{branchcode};
64
    my $exception_holidays_sth = $dbh->prepare(
65
    my $exception_holidays_sth = $dbh->prepare(
65
'SELECT day, month, year FROM special_holidays WHERE branchcode = ? AND isexception = 1'
66
'SELECT day, month, year FROM special_holidays WHERE branchcode = ? AND isexception = 1'
66
    );
67
    );
Lines 77-83 sub exception_holidays { Link Here
77
    }
78
    }
78
    $self->{exception_holidays} =
79
    $self->{exception_holidays} =
79
      DateTime::Set->from_datetimes( dates => $dates );
80
      DateTime::Set->from_datetimes( dates => $dates );
80
    $cache->set_in_cache( 'exception_holidays', $self->{exception_holidays} );
81
    $cache->set_in_cache( $key, $self->{exception_holidays} );
81
    return $self->{exception_holidays};
82
    return $self->{exception_holidays};
82
}
83
}
83
84
(-)a/t/Calendar.t (-3 lines)
Lines 78-84 fixtures_ok [ Link Here
78
78
79
my $cache = Koha::Caches->get_instance();
79
my $cache = Koha::Caches->get_instance();
80
$cache->clear_from_cache( 'single_holidays' ) ;
80
$cache->clear_from_cache( 'single_holidays' ) ;
81
$cache->clear_from_cache( 'exception_holidays' ) ;
82
81
83
# 'MPL' branch is arbitrary, is not used at all but is needed for initialization
82
# 'MPL' branch is arbitrary, is not used at all but is needed for initialization
84
my $cal = Koha::Calendar->new( branchcode => 'MPL' );
83
my $cal = Koha::Calendar->new( branchcode => 'MPL' );
Lines 336-340 subtest 'days_mode parameter' => sub { Link Here
336
335
337
END {
336
END {
338
    $cache->clear_from_cache( 'single_holidays' ) ;
337
    $cache->clear_from_cache( 'single_holidays' ) ;
339
    $cache->clear_from_cache( 'exception_holidays' ) ;
340
};
338
};
341
- 

Return to bug 26000