From c6ff05a0849bd802893d08c42a39aae03d7d26d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@helsinki.fi>
Date: Fri, 12 Feb 2021 12:16:04 +0200
Subject: [PATCH] Bug 20447: Don't use GROUP by when fetching authorised values
 for editor

The syntax is invalid SQL. The original intent was probably to remove
duplicates from the holdings record marc editor but it would have
actually removed then the other instances of the wanted authorised
values from the list. Now we show all the authorised values that
should be possible to select and yes, if you set the same
description (lib field) for two different authorised values in the
same category then you cannot distinguish them from each other.
---
 cataloguing/addholding.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cataloguing/addholding.pl b/cataloguing/addholding.pl
index fdd592abd8..69eb695cd5 100755
--- a/cataloguing/addholding.pl
+++ b/cataloguing/addholding.pl
@@ -372,7 +372,7 @@ sub build_tabs {
     $query .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id )} if $branch_limit;
     $query .= " WHERE category = ?";
     $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
-    $query .= " GROUP BY lib ORDER BY lib, lib_opac";
+    $query .= " ORDER BY lib, lib_opac";
     my $authorised_values_sth = $dbh->prepare( $query );
 
     # in this array, we will push all the 10 tabs
-- 
2.11.0