Bugzilla – Attachment 174498 Details for
Bug 36197
Allow for OPAC unauthenticated ILL request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36197: Refactor -> opac_available_backends method
Bug-36197-Refactor---opacavailablebackends-method.patch (text/plain), 2.56 KB, created by
Pedro Amorim
on 2024-11-14 11:37:21 UTC
(
hide
)
Description:
Bug 36197: Refactor -> opac_available_backends method
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-11-14 11:37:21 UTC
Size:
2.56 KB
patch
obsolete
>From a151ce9b1a2f4afd99f420a3ead594cd26e97d94 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Wed, 28 Feb 2024 16:48:28 +0000 >Subject: [PATCH] Bug 36197: Refactor -> opac_available_backends method > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/ILL/Backends.pm | 23 +++++++++++++++++++++++ > opac/opac-illrequests.pl | 6 +++--- > 2 files changed, 26 insertions(+), 3 deletions(-) > >diff --git a/Koha/ILL/Backends.pm b/Koha/ILL/Backends.pm >index eec8d27863..4b469a017a 100644 >--- a/Koha/ILL/Backends.pm >+++ b/Koha/ILL/Backends.pm >@@ -19,6 +19,8 @@ package Koha::ILL::Backends; > > use Modern::Perl; > >+use Koha::ILL::Request::Config; >+ > use base qw(Koha::Objects); > > =head1 NAME >@@ -51,6 +53,27 @@ sub installed_backends { > return \@installed; > } > >+=head3 opac_available_backends >+ >+Return a list of backends available in the OPAC >+ >+=cut >+ >+sub opac_available_backends { >+ my ( $self, $loggedinuser ) = @_; >+ my $reduced = C4::Context->preference('ILLOpacbackends'); >+ 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 ); >+ } >+ } >+ return $backends; >+} >+ > =head2 Internal methods > > =head3 _type >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 906a7262eb..ae28f4ed29 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -30,6 +30,7 @@ use POSIX qw( strftime ); > use Koha::ILL::Request::Config; > use Koha::ILL::Requests; > use Koha::ILL::Request; >+use Koha::ILL::Backends; > use Koha::Libraries; > use Koha::Patrons; > use Koha::ILL::Request::Workflow::Availability; >@@ -56,11 +57,10 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ > }); > > # Are we able to actually work? >-my $reduced = C4::Context->preference('ILLOpacbackends'); >-my $backends = Koha::ILL::Request::Config->new->available_backends($reduced); >+my $patron = Koha::Patrons->find($loggedinuser); >+my $backends = Koha::ILL::Backends->opac_available_backends($patron); > my $backends_available = ( scalar @{$backends} > 0 ); > $template->param( backends_available => $backends_available ); >-my $patron = Koha::Patrons->find($loggedinuser); > > my $op = Koha::ILL::Request->get_op_param_deprecation( 'opac', $params ); > >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36197
:
171358
|
171359
|
171360
|
171361
|
171362
|
171363
|
171364
|
171365
|
171366
|
171367
|
171368
|
171369
|
171370
|
171371
|
174495
|
174496
|
174497
| 174498 |
174499
|
174500
|
174501
|
174502
|
174503
|
174504
|
174505
|
174506
|
174507
|
174508
|
176564
|
176565
|
176680
|
176723
|
176724
|
176726
|
176727