From 0f3b17420851aaa7f9038e6bdbc0a5dc73e8cf42 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 5 Mar 2024 17:09:03 +0000 Subject: [PATCH] Bug 36197: Make authentication not required if conditions are met /cgi-bin/koha/opac-illrequests.pl was an authrequired page Now, its authnotrequired if creating or viewing an unauthenticated request Signed-off-by: David Nind --- opac/opac-illrequests.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl index 1a36ded151a..420ea6066a7 100755 --- a/opac/opac-illrequests.pl +++ b/opac/opac-illrequests.pl @@ -49,11 +49,21 @@ if ( !C4::Context->preference('ILLModule') ) { exit; } +my $op = Koha::ILL::Request->get_op_param_deprecation( 'opac', $params ); + my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { - template_name => "opac-illrequests.tt", - query => $query, - type => "opac", + template_name => "opac-illrequests.tt", + query => $query, + type => "opac", + authnotrequired => ( + ( + C4::Context->preference("ILLOpacUnauthenticatedRequest") + && ( $op eq 'cud-create' || $op eq 'unauth_view' ) + ) + ? 1 + : 0 + ) } ); @@ -63,8 +73,6 @@ my $backends = Koha::ILL::Request::Config->new->opac_available_backend my $backends_available = ( scalar @{$backends} > 0 ); $template->param( backends_available => $backends_available ); -my $op = Koha::ILL::Request->get_op_param_deprecation( 'opac', $params ); - my ( $illrequest_id, $request ); if ( $illrequest_id = $params->{illrequest_id} ) { $request = Koha::ILL::Requests->find($illrequest_id); -- 2.39.5