Bugzilla – Attachment 32516 Details for
Bug 12801
Koha::Calendar is caching holidays for the wrong branch!
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12801: Use the branchcode to cache holidays
Bug-12801-Use-the-branchcode-to-cache-holidays.patch (text/plain), 2.45 KB, created by
Brendan Gallagher
on 2014-10-17 15:48:43 UTC
(
hide
)
Description:
Bug 12801: Use the branchcode to cache holidays
Filename:
MIME Type:
Creator:
Brendan Gallagher
Created:
2014-10-17 15:48:43 UTC
Size:
2.45 KB
patch
obsolete
>From 7b8b354c08d2ff1eca121eb95a7922b025d1ccf7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Thu, 21 Aug 2014 17:23:30 +0200 >Subject: [PATCH] Bug 12801: Use the branchcode to cache holidays > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> >--- > Koha/Calendar.pm | 21 +++++++++++---------- > 1 file changed, 11 insertions(+), 10 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index 276c7ce..f982ff4 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -91,15 +91,15 @@ sub exception_holidays { > sub single_holidays { > my ( $self ) = @_; > my $dbh = C4::Context->dbh; >- my $branch = $self->{branchcode}; >- if ( $single_holidays ) { >- $self->{single_holidays} = $single_holidays; >- return $single_holidays; >+ my $branchcode = $self->{branchcode}; >+ if ( $single_holidays->{$branchcode} ) { >+ $self->{single_holidays}{$branchcode} = $single_holidays->{$branchcode}; >+ return $single_holidays->{$branchcode}; > } > my $single_holidays_sth = $dbh->prepare( > 'SELECT day, month, year FROM special_holidays WHERE branchcode = ? AND isexception = 0' > ); >- $single_holidays_sth->execute( $branch ); >+ $single_holidays_sth->execute( $branchcode ); > my $dates = []; > while ( my ( $day, $month, $year ) = $single_holidays_sth->fetchrow ) { > push @{$dates}, >@@ -110,9 +110,9 @@ sub single_holidays { > time_zone => C4::Context->tz() > )->truncate( to => 'day' ); > } >- $self->{single_holidays} = DateTime::Set->from_datetimes( dates => $dates ); >- $single_holidays = $self->{single_holidays}; >- return $single_holidays; >+ $self->{single_holidays}{$branchcode} = DateTime::Set->from_datetimes( dates => $dates ); >+ $single_holidays->{$branchcode} = $self->{single_holidays}{$branchcode}; >+ return $single_holidays->{$branchcode}; > } > sub addDate { > my ( $self, $startdate, $add_duration, $unit ) = @_; >@@ -344,9 +344,10 @@ sub add_holiday { > my $new_dt = shift; > my @dt = $self->single_holidays->as_list; > push @dt, $new_dt; >- $self->{single_holidays} = >+ my $branchcode = $self->{branchcode}; >+ $self->{single_holidays}{$branchcode} = > DateTime::Set->from_datetimes( dates => \@dt ); >- $single_holidays = $self->{single_holidays}; >+ $single_holidays->{$branchcode} = $self->{single_holidays}{$branchcode}; > > return; > } >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12801
:
31052
|
31053
|
31056
|
31075
|
32514
|
32515
| 32516