From 27347e3bec3d572ce033969004a44f3ab7426c49 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. Signed-off-by: Tomas Cohen Arazi --- Koha/ILL/Request/Config.pm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Koha/ILL/Request/Config.pm b/Koha/ILL/Request/Config.pm index 2605516547a..288685b43b0 100644 --- a/Koha/ILL/Request/Config.pm +++ b/Koha/ILL/Request/Config.pm @@ -178,11 +178,12 @@ sub opac_available_backends { my $reduced = C4::Context->preference('ILLOpacbackends'); my $backends = $self->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.49.0