Bug 7919: FIX the "all" categories method

The C4::Category->all method must return fields from the categories
table only.
Without this patch, there is 2 "categorycode" values, the second one is
sometimes undef (if no branch limitation).

same for the GetBorrowercategoryList routine (some category codes are
undefined)

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
Signed off for also fixing problems with patron searching noted by Katrin.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Problems fixed by this patch include:
- on patron search result list the category description is shown again
- it's possible to limit a patron search to a patron category again

All tests pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Jonathan Druart 2012-12-17 11:04:07 +01:00 committed by Jared Camins-Esakov
parent 3eec0e96ec
commit 7dacc32501
2 changed files with 2 additions and 2 deletions

View file

@ -79,7 +79,7 @@ sub all {
my $dbh = C4::Context->dbh;
# The categories table is small enough for
# `SELECT *` to be harmless.
my $query = "SELECT * FROM categories";
my $query = "SELECT categories.* FROM categories";
$query .= qq{
LEFT JOIN categories_branches ON categories_branches.categorycode = categories.categorycode
WHERE categories_branches.branchcode = ? OR categories_branches.branchcode IS NULL

View file

@ -1475,7 +1475,7 @@ sub GetBorrowercategoryList {
? 0
: C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
my $dbh = C4::Context->dbh;
my $query = "SELECT * FROM categories";
my $query = "SELECT categories.* FROM categories";
$query .= qq{
LEFT JOIN categories_branches ON categories.categorycode = categories_branches.categorycode
WHERE branchcode = ? OR branchcode IS NULL GROUP BY description