Bugzilla – Attachment 180853 Details for
Bug 36197
Allow unauthenticated ILL requests in the OPAC
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.29 KB, created by
Pedro Amorim
on 2025-04-11 14:22:56 UTC
(
hide
)
Description:
Bug 36197: Refactor -> opac_available_backends method
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-04-11 14:22:56 UTC
Size:
2.29 KB
patch
obsolete
>From c1d05a7c730eb430f0d564b754caba1e7a3ee3b8 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Thu, 10 Apr 2025 13:50:58 +0000 >Subject: [PATCH] Bug 36197: Refactor -> opac_available_backends method > >Signed-off-by: David Nind <david@davidnind.com> >--- > Koha/ILL/Request/Config.pm | 20 ++++++++++++++++++++ > opac/opac-illrequests.pl | 5 ++--- > 2 files changed, 22 insertions(+), 3 deletions(-) > >diff --git a/Koha/ILL/Request/Config.pm b/Koha/ILL/Request/Config.pm >index 0b14ec76d58..26df6630d33 100644 >--- a/Koha/ILL/Request/Config.pm >+++ b/Koha/ILL/Request/Config.pm >@@ -171,6 +171,26 @@ sub installed_backends { > return [ grep { !/Standard/ } @{ $self->available_backends } ]; > } > >+=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 = $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 ); >+ } >+ } >+ return $backends; >+} >+ > =head3 has_branch > > Return whether a 'branch' block is defined >diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl >index 741442b0fee..3e3d5c025d7 100755 >--- a/opac/opac-illrequests.pl >+++ b/opac/opac-illrequests.pl >@@ -58,11 +58,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::Request::Config->new->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
|
179764
|
179765
|
179766
|
179767
|
179769
|
179770
|
179771
|
179772
|
179773
|
179774
|
179775
|
179776
|
179777
|
179778
|
179779
|
179780
|
179781
|
179782
|
179783
|
179784
|
179785
|
180850
|
180851
|
180852
|
180853
|
180854
|
180855
|
180856
|
180857
|
180858
|
180859
|
180860
|
180861
|
180862
|
180863
|
180864
|
180865
|
180866
|
180867
|
180868
|
180869
|
180870
|
180871
|
180872
|
180873
|
181073
|
181074
|
181075
|
181076
|
181077
|
181078
|
181079
|
181080
|
181081
|
181082
|
181083
|
181084
|
181085
|
181086
|
181087
|
181088
|
181089
|
181090
|
181091
|
181092
|
181093
|
181094
|
181095
|
181096
|
181097
|
181098
|
181592