Bug 8223 - Properly format SQL query in C4::Bookseller::GetBookSeller

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Kyle M Hall 2012-06-11 04:45:57 -04:00 committed by Paul Poulain
parent cc02d468c3
commit 9dc42e9ec4
1 changed files with 6 additions and 3 deletions

View File

@ -63,9 +63,12 @@ aqbooksellers table in the Koha database.
sub GetBookSeller {
my $searchstring = shift;
$searchstring = q{%} . $searchstring . q{%};
my $query =
'select aqbooksellers.*, count(*) as basketcount from aqbooksellers left join aqbasket '
. 'on aqbasket.booksellerid = aqbooksellers.id where name like ? group by aqbooksellers.id order by name';
my $query = "
SELECT aqbooksellers.*, count(*) AS basketcount
FROM aqbooksellers
LEFT JOIN aqbasket ON aqbasket.booksellerid = aqbooksellers.id
WHERE name LIKE ? GROUP BY aqbooksellers.id ORDER BY name
";
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare($query);