From c9e81d48407d9da23bbb77ad9bf3068fa5ce8d44 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 11 Mar 2013 12:13:29 +0100 Subject: [PATCH] Bug 9367: Followup finalizing QA Signed-off-by: Marcel de Rooy Keeping fetchrow close to its execute worked even better in GetReserveStatus. Instead of returning undef, I return empty string. I checked all calls; this value is mostly not checked for undef. So we eliminate a lot of warnings in log. Signed-off-by: Jared Camins-Esakov --- C4/Reserves.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index ded88c8826..ba12cf57da 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -749,23 +749,26 @@ sub GetReserveStatus { my $dbh = C4::Context->dbh; - my ($sth, $found, $priority) = (undef, q{}, 0); + my ($sth, $found, $priority); if ( $itemnumber ) { $sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE itemnumber = ? order by priority LIMIT 1"); $sth->execute($itemnumber); + ($found, $priority) = $sth->fetchrow_array; } if ( $biblionumber and not defined $found and not defined $priority ) { $sth = $dbh->prepare("SELECT found, priority FROM reserves WHERE biblionumber = ? order by priority LIMIT 1"); $sth->execute($biblionumber); + ($found, $priority) = $sth->fetchrow_array; } - ($found, $priority) = $sth->fetchrow_array; - return unless defined $found; - return 'Waiting' if $found eq 'W' and $priority == 0; - return 'Finished' if $found eq 'F'; - return 'Reserved' if $priority > 0; - return; + if(defined $found) { + return 'Waiting' if $found eq 'W' and $priority == 0; + return 'Finished' if $found eq 'F'; + return 'Reserved' if $priority > 0; + } + return ''; + #empty string here will remove need for checking undef, or less log lines } =head2 CheckReserves -- 2.39.5