Bug 24488: Fix reserve.reserve_id' isn't in GROUP BY
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 23 Jul 2020 06:58:04 +0000 (08:58 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 8 Feb 2021 13:55:59 +0000 (14:55 +0100)
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
circ/pendingreserves.pl

index 3f35ddb..2500160 100755 (executable)
@@ -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 ){