From 1c09ea2963a6711d4334ee316aac201f3dce7fba Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 15 Jan 2025 11:33:38 +0000 Subject: [PATCH] Bug 38441: (QA follow-up): Handle undef userenv C4::Context->userenv may be undef (after a reset_all, trying to place an unauthenticated request without being logged). This change prevents a nasty 500 error trying use undefined as hash --- Koha/ILL/Request/Workflow/HistoryCheck.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/ILL/Request/Workflow/HistoryCheck.pm b/Koha/ILL/Request/Workflow/HistoryCheck.pm index 455b02cf45e..421fd01f184 100644 --- a/Koha/ILL/Request/Workflow/HistoryCheck.pm +++ b/Koha/ILL/Request/Workflow/HistoryCheck.pm @@ -54,7 +54,7 @@ sub show_history_check { my $opac_no_matching_requests_for_patron = 0; if ( $self->{ui_context} eq 'opac' ) { - my $patron_cardnumber = C4::Context->userenv->{'cardnumber'} || 0; + my $patron_cardnumber = C4::Context->userenv ? C4::Context->userenv->{'cardnumber'} || 0 : 0; my ( $matching_requests_for_patron, $remaining_matching_requests ) = $self->_get_split_matching_requests($patron_cardnumber); $opac_no_matching_requests_for_patron = 1 -- 2.39.5