Bug 39875: Dont show history check

Unless there is a cardnumber or an authenticated user

Test plan:
1) Apply only the the tests file highlighting the issue:
prove t/db_dependent/Koha/ILL/Request/Workflow/HistoryCheck.t
2) Notice it fails.
3) Apply this patch.
4) Run tests again. Notice it passes.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Lin Wei Li <lin-wei.li@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2025-05-12 13:30:12 +00:00 committed by Lucas Gass
parent ae2e9e23de
commit 6a0fcefa22
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 4 additions and 2 deletions

View File

@ -193,9 +193,11 @@ sub _find_matching_requests {
@existing_id_fields = grep { $_ eq 'pubmedid' } @existing_id_fields;
}
my $patron = Koha::Patrons->find(
{ cardnumber => $self->{metadata}->{cardnumber} || C4::Context->userenv->{'cardnumber'} } );
my $cardnumber =
$self->{metadata}->{cardnumber} || ( C4::Context->userenv && C4::Context->userenv->{'cardnumber'} );
return 0 unless $cardnumber;
my $patron = Koha::Patrons->find( { cardnumber => $cardnumber } );
return 0 unless $patron;
my $query;