Bugzilla – Attachment 48425 Details for
Bug 15632
Move the messages related code to Koha::Patron::Messages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15632 [QA Followup] - Get rid of use of uninitialized value errors for unit tests
Bug-15632-QA-Followup---Get-rid-of-use-of-uninitia.patch (text/plain), 3.41 KB, created by
Jonathan Druart
on 2016-02-29 07:17:38 UTC
(
hide
)
Description:
Bug 15632 [QA Followup] - Get rid of use of uninitialized value errors for unit tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-29 07:17:38 UTC
Size:
3.41 KB
patch
obsolete
>From 7d2b331fad081918206f660929fad5e58e617f7b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 11 Feb 2016 08:09:03 +0000 >Subject: [PATCH] Bug 15632 [QA Followup] - Get rid of use of uninitialized > value errors for unit tests > >* Set $user to "" if not passed >* Tidy sub >--- > C4/Log.pm | 62 ++++++++++++++++++++++++++++++++++++-------------------------- > 1 file changed, 36 insertions(+), 26 deletions(-) > >diff --git a/C4/Log.pm b/C4/Log.pm >index c18794e..3d3f7cf 100644 >--- a/C4/Log.pm >+++ b/C4/Log.pm >@@ -215,15 +215,20 @@ sub GetLogs { > my $datefrom = shift; > my $dateto = shift; > my $user = shift; >- my $modules = shift; >+ my $modules = shift; > my $action = shift; > my $object = shift; > my $info = shift; >- >- my $iso_datefrom = output_pref({ dt => dt_from_string( $datefrom ), dateformat => 'iso', dateonly => 1 }); >- my $iso_dateto = output_pref({ dt => dt_from_string( $dateto ), dateformat => 'iso', dateonly => 1 }); > >- my $dbh = C4::Context->dbh; >+ $user ||= q{}; >+ >+ my $iso_datefrom = output_pref( >+ { dt => dt_from_string($datefrom), dateformat => 'iso', dateonly => 1 } >+ ); >+ my $iso_dateto = output_pref( >+ { dt => dt_from_string($dateto), dateformat => 'iso', dateonly => 1 } ); >+ >+ my $dbh = C4::Context->dbh; > my $query = " > SELECT * > FROM action_logs >@@ -231,35 +236,40 @@ sub GetLogs { > "; > > my @parameters; >- $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"".$iso_datefrom."\" " if $iso_datefrom; #fix me - mysql specific >- $query .= " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"".$iso_dateto."\" " if $iso_dateto; >- if($user ne "") { >- $query .= " AND user = ? "; >- push(@parameters,$user); >+ $query .= >+ " AND DATE_FORMAT(timestamp, '%Y-%m-%d') >= \"" . $iso_datefrom . "\" " >+ if $iso_datefrom; #fix me - mysql specific >+ $query .= >+ " AND DATE_FORMAT(timestamp, '%Y-%m-%d') <= \"" . $iso_dateto . "\" " >+ if $iso_dateto; >+ if ( $user ne q{} ) { >+ $query .= " AND user = ? "; >+ push( @parameters, $user ); > } >- if($modules && scalar(@$modules)) { >- $query .= " AND module IN (".join(",",map {"?"} @$modules).") "; >- push(@parameters,@$modules); >+ if ( $modules && scalar(@$modules) ) { >+ $query .= >+ " AND module IN (" . join( ",", map { "?" } @$modules ) . ") "; >+ push( @parameters, @$modules ); > } >- if($action && scalar(@$action)) { >- $query .= " AND action IN (".join(",",map {"?"} @$action).") "; >- push(@parameters,@$action); >+ if ( $action && scalar(@$action) ) { >+ $query .= " AND action IN (" . join( ",", map { "?" } @$action ) . ") "; >+ push( @parameters, @$action ); > } >- if($object) { >- $query .= " AND object = ? "; >- push(@parameters,$object); >+ if ($object) { >+ $query .= " AND object = ? "; >+ push( @parameters, $object ); > } >- if($info) { >- $query .= " AND info LIKE ? "; >- push(@parameters,"%".$info."%"); >+ if ($info) { >+ $query .= " AND info LIKE ? "; >+ push( @parameters, "%" . $info . "%" ); > } >- >+ > my $sth = $dbh->prepare($query); > $sth->execute(@parameters); >- >+ > my @logs; >- while( my $row = $sth->fetchrow_hashref ) { >- push @logs , $row; >+ while ( my $row = $sth->fetchrow_hashref ) { >+ push @logs, $row; > } > return \@logs; > } >-- >2.7.0
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 15632
:
47091
|
47092
|
47093
|
47094
|
47095
|
47096
|
47097
|
47515
|
47516
|
47525
|
47571
|
47572
|
47573
|
47574
|
47575
|
47580
|
47581
|
47582
|
47583
|
47584
|
47585
|
47586
|
47587
|
48004
|
48009
|
48010
|
48011
|
48012
|
48013
|
48014
|
48015
|
48016
|
48017
|
48018
|
48020
|
48422
|
48423
|
48424
|
48425
|
48426
|
48427
|
48591
|
48592
|
48593