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

(-)a/C4/Calendar.pm (+7 lines)
Lines 278-283 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::Cache->get_instance();
279
    my $cache = Koha::Cache->get_instance();
280
    $cache->clear_from_cache( 'single_holidays') ;
280
    $cache->clear_from_cache( 'single_holidays') ;
281
    $cache->clear_from_cache( 'exception_holidays') ;
281
282
282
    return $self;
283
    return $self;
283
284
Lines 322-327 sub insert_exception_holiday { Link Here
322
    # changed the 'single_holidays' table, lets force/reset its cache
323
    # changed the 'single_holidays' table, lets force/reset its cache
323
    my $cache = Koha::Cache->get_instance();
324
    my $cache = Koha::Cache->get_instance();
324
    $cache->clear_from_cache( 'single_holidays') ;
325
    $cache->clear_from_cache( 'single_holidays') ;
326
    $cache->clear_from_cache( 'exception_holidays') ;
325
327
326
    return $self;
328
    return $self;
327
}
329
}
Lines 422-427 UPDATE special_holidays SET title = ?, description = ? Link Here
422
    # changed the 'single_holidays' table, lets force/reset its cache
424
    # changed the 'single_holidays' table, lets force/reset its cache
423
    my $cache = Koha::Cache->get_instance();
425
    my $cache = Koha::Cache->get_instance();
424
    $cache->clear_from_cache( 'single_holidays') ;
426
    $cache->clear_from_cache( 'single_holidays') ;
427
    $cache->clear_from_cache( 'exception_holidays') ;
425
428
426
    return $self;
429
    return $self;
427
}
430
}
Lines 464-469 UPDATE special_holidays SET title = ?, description = ? Link Here
464
    # changed the 'single_holidays' table, lets force/reset its cache
467
    # changed the 'single_holidays' table, lets force/reset its cache
465
    my $cache = Koha::Cache->get_instance();
468
    my $cache = Koha::Cache->get_instance();
466
    $cache->clear_from_cache( 'single_holidays') ;
469
    $cache->clear_from_cache( 'single_holidays') ;
470
    $cache->clear_from_cache( 'exception_holidays') ;
467
471
468
    return $self;
472
    return $self;
469
}
473
}
Lines 544-549 sub delete_holiday { Link Here
544
    # changed the 'single_holidays' table, lets force/reset its cache
548
    # changed the 'single_holidays' table, lets force/reset its cache
545
    my $cache = Koha::Cache->get_instance();
549
    my $cache = Koha::Cache->get_instance();
546
    $cache->clear_from_cache( 'single_holidays') ;
550
    $cache->clear_from_cache( 'single_holidays') ;
551
    $cache->clear_from_cache( 'exception_holidays') ;
547
552
548
    return $self;
553
    return $self;
549
}
554
}
Lines 574-579 sub delete_holiday_range { Link Here
574
    # changed the 'single_holidays' table, lets force/reset its cache
579
    # changed the 'single_holidays' table, lets force/reset its cache
575
    my $cache = Koha::Cache->get_instance();
580
    my $cache = Koha::Cache->get_instance();
576
    $cache->clear_from_cache( 'single_holidays') ;
581
    $cache->clear_from_cache( 'single_holidays') ;
582
    $cache->clear_from_cache( 'exception_holidays') ;
577
583
578
}
584
}
579
585
Lines 627-632 sub delete_exception_holiday_range { Link Here
627
    # changed the 'single_holidays' table, lets force/reset its cache
633
    # changed the 'single_holidays' table, lets force/reset its cache
628
    my $cache = Koha::Cache->get_instance();
634
    my $cache = Koha::Cache->get_instance();
629
    $cache->clear_from_cache( 'single_holidays') ;
635
    $cache->clear_from_cache( 'single_holidays') ;
636
    $cache->clear_from_cache( 'exception_holidays') ;
630
}
637
}
631
638
632
=head2 isHoliday
639
=head2 isHoliday
(-)a/Koha/Calendar.pm (-16 / +6 lines)
Lines 52-74 sub _init { Link Here
52
    return;
52
    return;
53
}
53
}
54
54
55
56
# FIXME: use of package-level variables for caching the holiday
57
# lists breaks persistance engines.  As of 2013-12-10, the RM
58
# is allowing this with the expectation that prior to release of
59
# 3.16, bug 8089 will be fixed and we can switch the caching over
60
# to Koha::Cache.
61
62
our $exception_holidays;
63
64
sub exception_holidays {
55
sub exception_holidays {
65
    my ( $self ) = @_;
56
    my ( $self ) = @_;
66
    my $dbh = C4::Context->dbh;
57
    my $dbh = C4::Context->dbh;
67
    my $branch = $self->{branchcode};
58
    my $branch = $self->{branchcode};
68
    if ( $exception_holidays ) {
59
    my $cache  = Koha::Cache->get_instance();
69
        $self->{exception_holidays} = $exception_holidays;
60
    my $cached = $cache->get_from_cache('exception_holidays');
70
        return $exception_holidays;
61
    return $cached if $cached;
71
    }
62
72
    my $exception_holidays_sth = $dbh->prepare(
63
    my $exception_holidays_sth = $dbh->prepare(
73
'SELECT day, month, year FROM special_holidays WHERE branchcode = ? AND isexception = 1'
64
'SELECT day, month, year FROM special_holidays WHERE branchcode = ? AND isexception = 1'
74
    );
65
    );
Lines 85-92 sub exception_holidays { Link Here
85
    }
76
    }
86
    $self->{exception_holidays} =
77
    $self->{exception_holidays} =
87
      DateTime::Set->from_datetimes( dates => $dates );
78
      DateTime::Set->from_datetimes( dates => $dates );
88
    $exception_holidays = $self->{exception_holidays};
79
    $cache->set_in_cache( 'exception_holidays', $self->{exception_holidays} );
89
    return $exception_holidays;
80
    return $self->{exception_holidays};
90
}
81
}
91
82
92
sub single_holidays {
83
sub single_holidays {
93
- 

Return to bug 15333