@@ -, +, @@ --- C4/Calendar.pm | 14 +++++++------- Koha/Calendar.pm | 7 ++++--- t/Calendar.t | 2 -- 3 files changed, 11 insertions(+), 12 deletions(-) --- a/C4/Calendar.pm +++ a/C4/Calendar.pm @@ -278,7 +278,7 @@ sub insert_single_holiday { # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; return $self; @@ -323,7 +323,7 @@ sub insert_exception_holiday { # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; return $self; } @@ -424,7 +424,7 @@ UPDATE special_holidays SET title = ?, description = ? # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; return $self; } @@ -467,7 +467,7 @@ UPDATE special_holidays SET title = ?, description = ? # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; return $self; } @@ -548,7 +548,7 @@ sub delete_holiday { # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; return $self; } @@ -579,7 +579,7 @@ sub delete_holiday_range { # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; } @@ -633,7 +633,7 @@ sub delete_exception_holiday_range { # changed the 'single_holidays' table, lets force/reset its cache my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays') ; - $cache->clear_from_cache( 'exception_holidays') ; + $cache->clear_from_cache( 'exception_holidays_'.$self->{branchcode}) ; } =head2 isHoliday --- a/Koha/Calendar.pm +++ a/Koha/Calendar.pm @@ -55,12 +55,13 @@ sub _init { sub exception_holidays { my ( $self ) = @_; + my $branch = $self->{branchcode}; my $cache = Koha::Caches->get_instance(); - my $cached = $cache->get_from_cache('exception_holidays'); + my $key = 'exception_holidays_'.$branch; + my $cached = $cache->get_from_cache($key); return $cached if $cached; my $dbh = C4::Context->dbh; - my $branch = $self->{branchcode}; my $exception_holidays_sth = $dbh->prepare( 'SELECT day, month, year FROM special_holidays WHERE branchcode = ? AND isexception = 1' ); @@ -77,7 +78,7 @@ sub exception_holidays { } $self->{exception_holidays} = DateTime::Set->from_datetimes( dates => $dates ); - $cache->set_in_cache( 'exception_holidays', $self->{exception_holidays} ); + $cache->set_in_cache( $key, $self->{exception_holidays} ); return $self->{exception_holidays}; } --- a/t/Calendar.t +++ a/t/Calendar.t @@ -78,7 +78,6 @@ fixtures_ok [ my $cache = Koha::Caches->get_instance(); $cache->clear_from_cache( 'single_holidays' ) ; -$cache->clear_from_cache( 'exception_holidays' ) ; # 'MPL' branch is arbitrary, is not used at all but is needed for initialization my $cal = Koha::Calendar->new( branchcode => 'MPL' ); @@ -336,5 +335,4 @@ subtest 'days_mode parameter' => sub { END { $cache->clear_from_cache( 'single_holidays' ) ; - $cache->clear_from_cache( 'exception_holidays' ) ; }; --