Bugzilla – Attachment 38577 Details for
Bug 14066
Koha code does not really use Readonly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14066: Correct and optimize
Bug-14066-Correct-and-optimize.patch (text/plain), 1.84 KB, created by
Mark Tompsett
on 2015-04-27 22:39:26 UTC
(
hide
)
Description:
Bug 14066: Correct and optimize
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-04-27 22:39:26 UTC
Size:
1.84 KB
patch
obsolete
>From d6bb4cc512faad6fc32c38298a7e6b738415da8e Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Mon, 27 Apr 2015 18:03:55 -0400 >Subject: [PATCH] Bug 14066: Correct and optimize > >As far as I can tell $sunday is never used. And it seemed to be >scoped to only _init. > >The remaining hashiness was cleaned up for the $return_by_hour. > >TEST PLAN >--------- >1) Apply both patches >2) prove -v t/db_dependent/Calendar.t >3) prove -v t/db_dependent/Holidays.t >4) prove -v t/Calendar.t >5) perlcritic -3 Koha/Calendar.pm > -- the message corresponds to a comment in the code already > and not this change. >6) run koha qa test tools >--- > Koha/Calendar.pm | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index 451c6a3..1cbd57c 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -33,7 +33,6 @@ sub _init { > ); > $weekly_closed_days_sth->execute( $branch ); > $self->{weekly_closed_days} = [ 0, 0, 0, 0, 0, 0, 0 ]; >- my $sunday => 7; > while ( my $tuple = $weekly_closed_days_sth->fetchrow_hashref ) { > $self->{weekly_closed_days}->[ $tuple->{weekday} ] = 1; > } >@@ -126,7 +125,7 @@ sub addDate { > > if ( $unit eq 'hours' ) { > # Fixed for legacy support. Should be set as a branch parameter >- my $return_by_hour => 10; >+ my $return_by_hour = 10; > > $dt = $self->addHours($startdate, $add_duration, $return_by_hour); > } else { >@@ -221,10 +220,9 @@ sub is_holiday { > > my $dow = $localdt->day_of_week; > # Representation fix >- # TODO: Shouldn't we shift the rest of the $dow also? >- if ( $dow == 7 ) { >- $dow = 0; >- } >+ # DateTime object dow (1-7) where Monday is 1 >+ # Arrays are 0-based where 0 = Sunday. >+ $dow = $dow % 7; > > if ( $self->{weekly_closed_days}->[$dow] == 1 ) { > return 1; >-- >2.1.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 14066
:
38546
|
38577
|
38578
|
38579
|
38580
|
38591
|
38592
|
38593
|
38787
|
38788
|
38789