From 16b97e21d0ed13e5f38987c64db55ae15d944dc3 Mon Sep 17 00:00:00 2001 From: Srdjan Date: Mon, 13 Jun 2016 15:35:56 +1200 Subject: [PATCH] Bug 16716: Replaced wrong GROUP BY with DISTINCT MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Mark Tompsett Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit 52ac9a1ca3990102c3c635e3d9af06aae29f73e1) Signed-off-by: Frédéric Demians --- C4/Koha.pm | 5 ++--- C4/Members.pm | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 7fe07f1050..bb3581123d 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -1024,8 +1024,8 @@ sub GetAuthorisedValues { my @results; my $dbh = C4::Context->dbh; my $query = qq{ - SELECT * - FROM authorised_values + SELECT DISTINCT av.* + FROM authorised_values av }; $query .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id ) @@ -1043,7 +1043,6 @@ sub GetAuthorisedValues { if(@where_strings > 0) { $query .= " WHERE " . join(" AND ", @where_strings); } - $query .= " GROUP BY lib"; $query .= ' ORDER BY category, ' . ( $opac ? 'COALESCE(lib_opac, lib)' : 'lib, lib_opac' diff --git a/C4/Members.pm b/C4/Members.pm index 2ba69a3be2..c5303483a0 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1424,7 +1424,7 @@ sub GetborCatFromCatType { my $dbh = C4::Context->dbh; my $request = qq{ - SELECT categories.categorycode, categories.description + SELECT DISTINCT categories.categorycode, categories.description FROM categories }; $request .= qq{ @@ -1432,9 +1432,9 @@ sub GetborCatFromCatType { } if $branch_limit; if($action) { $request .= " $action "; - $request .= " AND (branchcode = ? OR branchcode IS NULL) GROUP BY description" if $branch_limit; + $request .= " AND (branchcode = ? OR branchcode IS NULL)" if $branch_limit; } else { - $request .= " WHERE branchcode = ? OR branchcode IS NULL GROUP BY description" if $branch_limit; + $request .= " WHERE branchcode = ? OR branchcode IS NULL" if $branch_limit; } $request .= " ORDER BY categorycode"; -- 2.39.5