From 616c55dc8534b3e31c86459f86c362e27431a9f6 Mon Sep 17 00:00:00 2001 From: Andrew Isherwood Date: Mon, 17 Sep 2018 15:04:56 +0100 Subject: [PATCH] Bug 20639: (follow-up) Fix variable not passed available_backends expects a variable declaring the contents of the ILLopacbackends syspref. This wasn't being passed in all calls to it, so I've removed the requirement for it being passed, we now check the contents of the syspref in available_backends itselfBug --- Koha/Illrequest/Config.pm | 5 +++-- opac/opac-illrequests.pl | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Koha/Illrequest/Config.pm b/Koha/Illrequest/Config.pm index 6c0b9dc2b5..91a4356d1c 100644 --- a/Koha/Illrequest/Config.pm +++ b/Koha/Illrequest/Config.pm @@ -113,12 +113,13 @@ will filter those backends down to only those present in the list. =cut sub available_backends { - my ( $self, $reduce ) = @_; + my ( $self ) = @_; + my $reduced = C4::Context->preference('ILLOpacbackends'); my $backend_dir = $self->backend_dir; my @backends = (); @backends = glob "$backend_dir/*" if ( $backend_dir ); @backends = map { basename($_) } @backends; - @backends = grep { $_ =~ /$reduce/ } @backends if $reduce; + @backends = grep { $_ =~ /$reduced/ } @backends if $reduced; return \@backends; } diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl index 329dc24792..e5df0300e6 100755 --- a/opac/opac-illrequests.pl +++ b/opac/opac-illrequests.pl @@ -50,8 +50,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ }); # Are we able to actually work? -my $reduced = C4::Context->preference('ILLOpacbackends'); -my $backends = Koha::Illrequest::Config->new->available_backends($reduced); +my $backends = Koha::Illrequest::Config->new->available_backends; my $backends_available = ( scalar @{$backends} > 0 ); $template->param( backends_available => $backends_available ); @@ -65,7 +64,7 @@ if ( $op eq 'list' ) { my $req = Koha::Illrequest->new; $template->param( requests => $requests, - backends => $req->available_backends + backends => $backends ); } elsif ( $op eq 'view') { @@ -105,7 +104,7 @@ if ( $op eq 'list' ) { if (!$params->{backend}) { my $req = Koha::Illrequest->new; $template->param( - backends => $req->available_backends + backends => $backends ); } else { my $request = Koha::Illrequest->new -- 2.11.0