Bug 9367: Followup finalizing QA

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
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 <jcamins@cpbibliography.com>
This commit is contained in:
Marcel de Rooy 2013-03-11 12:13:29 +01:00 committed by Jared Camins-Esakov
parent 37b6ac0b14
commit c9e81d4840
1 changed files with 10 additions and 7 deletions

View File

@ -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