Bugzilla – Attachment 31075 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]
[SIGNED-OFF] Bug 12801: Use the branchcode to cache holidays
SIGNED-OFF-Bug-12801-Use-the-branchcode-to-cache-h.patch (text/plain), 2.40 KB, created by
Kyle M Hall (khall)
on 2014-08-22 11:14:06 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 12801: Use the branchcode to cache holidays
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-08-22 11:14:06 UTC
Size:
2.40 KB
patch
obsolete
>From fa26667425d107548561208bc71c64feb936cba3 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] [SIGNED-OFF] Bug 12801: Use the branchcode to cache holidays > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Calendar.pm | 21 +++++++++++---------- > 1 files 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.2.5
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