From 298043edb73f2f18b93a91135bc348aeffc428c9 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 23 Aug 2023 14:45:27 +0000 Subject: [PATCH] Bug 34598: Improve handling of not found ILL request 1) Enable ILLmodule and install FreeForm, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) Visit a request that doesn't exist (assuming empty illrequests table): INTRA/cgi-bin/koha/ill/ill-requests.pl?method=illview&illrequest_id=1 3) Verify an error 500 is returned with message "Can't call method "backend_illview"" 4) Apply patch 5) Repeat steps 1-3. Verify that a "ILL request not found." message is now displayed Signed-off-by: Owen Leonard Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- ill/ill-requests.pl | 4 +++- koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc | 2 ++ koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index fc7da41710..058774321a 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -22,7 +22,7 @@ use Modern::Perl; use CGI; use C4::Auth qw( get_template_and_user ); -use C4::Output qw( output_html_with_http_headers ); +use C4::Output qw( output_and_exit output_html_with_http_headers ); use Koha::Notice::Templates; use Koha::AuthorisedValues; use Koha::Illcomment; @@ -97,6 +97,8 @@ if ( $backends_available ) { ( tran_success => $params->{tran_success} ) : () ), ); + output_and_exit( $cgi, $cookie, $template, 'unknown_ill_request' ) if !$request; + my $backend_result = $request->backend_illview($params); $template->param( whole => $backend_result, diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc index b596390fd5..1f48630b39 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/blocking_errors.inc @@ -13,6 +13,8 @@
Basket not found.
[% CASE 'unknown_vendor' %]
Vendor not found.
+ [% CASE 'unknown_ill_request' %] +
ILL request not found.
[% CASE 'order_cannot_be_edited' %]
This order cannot be edited, the basket is closed or the order was already received.
[% CASE 'wrong_csrf_token' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc index 03fec59ce1..cf90149ee0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill-toolbar.inc @@ -1,3 +1,4 @@ +[% INCLUDE 'blocking_errors.inc' %] [% USE Koha %] [% IF Koha.Preference('ILLModule ') && CAN_user_ill %]
-- 2.39.5