Bug 33702: (QA follow-up) Do not crash on borrowernumber

Resolve:
Can't call method "borrowernumber" on an undefined value at /usr/share/koha/opac/opac-illrequests.pl line 66

Test plan:
Put an unexisting illrequest_id in the URL parameter.
You should see a 404, not a crash.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2023-05-12 06:56:07 +00:00 committed by Lucas Gass
parent 68877fc0f5
commit 3151a90a23
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ my ( $illrequest_id, $request );
if ( $illrequest_id = $params->{illrequest_id} ) {
$request = Koha::Illrequests->find($illrequest_id);
# Make sure the request belongs to the logged in user
unless ( $request->borrowernumber == $loggedinuser ) {
if( !$request || $request->borrowernumber != $loggedinuser ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}