From d516303b0e1ffd9e03531987fe5953073ead5acc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Dec 2012 11:04:07 +0100 Subject: [PATCH] [SIGNED-OFF] 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 Signed-off-by: Liz Rea Signed off for also fixing problems with patron searching noted by Katrin. Signed-off-by: Katrin Fischer 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. --- C4/Category.pm | 2 +- C4/Members.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Category.pm b/C4/Category.pm index fcb3ed8..255db2b 100644 --- a/C4/Category.pm +++ b/C4/Category.pm @@ -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 diff --git a/C4/Members.pm b/C4/Members.pm index 81b014b..90b3f73 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1491,7 +1491,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 -- 1.7.9.5