From 45dadcf442c3128d347bc7dfe3ac8f0a683dabf2 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Thu, 23 Jul 2020 08:58:04 +0200
Subject: [PATCH] Bug 24488: Fix reserve.reserve_id' isn't in GROUP BY

---
 circ/pendingreserves.pl | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl
index b8123e94c0..bf7e70c2fb 100755
--- a/circ/pendingreserves.pl
+++ b/circ/pendingreserves.pl
@@ -20,6 +20,7 @@
 use Modern::Perl;
 
 use constant PULL_INTERVAL => 2;
+use List::MoreUtils qw( uniq );
 
 use C4::Context;
 use C4::Output;
@@ -183,16 +184,15 @@ if ( C4::Context->preference('IndependentBranches') ){
 }
 
 # get all distinct unfulfilled reserves
-my @distinct_holds = Koha::Holds->search(
+my $distinct_holds = Koha::Holds->search(
     { %where },
-    { join => 'itembib', group_by => 'reserve.biblionumber', alias => 'reserve' }
+    { join => 'itembib', alias => 'reserve' }
 );
+my @biblionumbers = uniq $distinct_holds->get_column('biblionumber');
 
 # make final reserves hash and fill with info
 my $reserves;
-foreach my $dh ( @distinct_holds ){
-
-    my $bibnum = $dh->biblionumber;
+foreach my $bibnum ( @biblionumbers ){
 
     my @items = Koha::Items->search({ biblionumber => $bibnum });
     foreach my $i ( @items ){
-- 
2.20.1