From 9ac93b0e18be7f030a89771025d74ef38d005a66 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 bc0002370c4..7b6172c8c9c 100755 --- a/opac/opac-illrequests.pl +++ b/opac/opac-illrequests.pl @@ -50,11 +50,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 + ) } ); @@ -64,8 +74,6 @@ my $backends = Koha::ILL::Backends->opac_available_backends($patron); 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