Bugzilla – Attachment 13583 Details for
Bug 9078
is_holiday should honour holiday exceptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9078 - is_holiday should honour holiday exceptions
Bug-9078---isholiday-should-honour-holiday-excepti.patch (text/plain), 1.73 KB, created by
Tomás Cohen Arazi (tcohen)
on 2012-11-21 13:50:06 UTC
(
hide
)
Description:
Bug 9078 - is_holiday should honour holiday exceptions
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2012-11-21 13:50:06 UTC
Size:
1.73 KB
patch
obsolete
>From 48b7f958302210662cdbd28b20b9fccd62628ded Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Wed, 21 Nov 2012 10:43:11 -0300 >Subject: [PATCH] Bug 9078 - is_holiday should honour holiday exceptions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Make is_holiday return 0 for holiday exceptions. > >Note: This patch makes several current ok tests fail. My first guess is test data is not >constructed ok. More on this later. > >Sponsored-by: Universidad Nacional de Córdoba >--- > Koha/Calendar.pm | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index 3986038..ee63e73 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -177,22 +177,31 @@ sub addDays { > sub is_holiday { > my ( $self, $dt ) = @_; > my $localdt = $dt->clone(); >+ my $day = $localdt->day; >+ my $month = $localdt->month; >+ >+ $localdt->truncate( to => 'day' ); >+ >+ if ( $self->{exception_holidays}->contains($localdt) ) { >+ # exceptions are not holidays >+ return 0; >+ } >+ > my $dow = $localdt->day_of_week; >+ # Representation fix >+ # TODO: Shouldn't we shift the rest of the $dow also? > if ( $dow == 7 ) { > $dow = 0; > } >+ > if ( $self->{weekly_closed_days}->[$dow] == 1 ) { > return 1; > } >- $localdt->truncate( to => 'day' ); >- my $day = $localdt->day; >- my $month = $localdt->month; >+ > if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) { > return 1; > } >- if ( $self->{exception_holidays}->contains($localdt) ) { >- return 1; >- } >+ > if ( $self->{single_holidays}->contains($localdt) ) { > return 1; > } >-- >1.7.9.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 9078
:
13583
|
13588
|
13599
|
13606
|
13607
|
13621
|
13622