bug_5245 Fix SQL syntax in GetItems

Routine never executed query due to syntax error
and returned undef
made the call to fetchrow_array explicit as the old fetchrow alias
is no longer documented in perldoc DBI

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
This commit is contained in:
Colin Campbell 2010-09-23 17:04:28 +01:00 committed by Galen Charlton
parent 1705820ed4
commit c19a56f9cd

View file

@ -2082,15 +2082,15 @@ returns a count of items from serial matching the subscriptionid
sub HasItems { sub HasItems {
my ($subscriptionid) = @_; my ($subscriptionid) = @_;
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;
my $query = qq| my $query = q|
SELECT COUNT(serialitems.itemnumber) SELECT COUNT(serialitems.itemnumber)
FROM serial FROM serial
LEFT JOIN serialitems USING(serialid) LEFT JOIN serialitems USING(serialid)
WHERE subscriptionid=? AND serialitems.serialid NOT NULL WHERE subscriptionid=? AND serialitems.serialid IS NOT NULL
|; |;
my $sth=$dbh->prepare($query); my $sth=$dbh->prepare($query);
$sth->execute($subscriptionid); $sth->execute($subscriptionid);
my ($countitems)=$sth->fetchrow; my ($countitems)=$sth->fetchrow_array();
return $countitems; return $countitems;
} }