From 3e80fc031339c6b3ee40509f8c15e72802e8fc01 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Fri, 17 Jan 2025 11:01:39 -0100 Subject: [PATCH] Bug 36197: (QA follow-up): Fix backends filtering in opac_available_backends This was incorrectly keeping backends that don't support unauthenticated ILL requests if more than one existed. --- Koha/ILL/Backends.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Koha/ILL/Backends.pm b/Koha/ILL/Backends.pm index ef503a38759..79e8f8aefd3 100644 --- a/Koha/ILL/Backends.pm +++ b/Koha/ILL/Backends.pm @@ -65,12 +65,14 @@ sub opac_available_backends { my $backends = Koha::ILL::Request::Config->new->available_backends($reduced); if ( !$loggedinuser && C4::Context->preference('ILLOpacUnauthenticatedRequest') ) { - foreach my $backend ( @{$backends} ) { - my $loaded_b = Koha::ILL::Request->new->load_backend($backend); - @$backends = grep { !/$backend/ } @$backends - if ( $loaded_b->_backend_capability('opac_unauthenticated_ill_requests') == 0 ); - } + $backends = [ + grep { + my $loaded_b = Koha::ILL::Request->new->load_backend($_); + $loaded_b->_backend_capability('opac_unauthenticated_ill_requests') + } @$backends + ]; } + return $backends; } -- 2.39.5