From 290b0c344463e324b92c7e40650a55d214943698 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 10 Jan 2022 14:02:49 +0100 Subject: [PATCH] Bug 29840: Deal with non-existing biblionumber in opac-reserve We should not explode if the biblionumber passed in not in DB. Test plan: Hit /cgi-bin/koha/opac-reserve.pl?biblionumber=42424 and notice the error message. Without this patch you got Can't call method "holds" on an undefined value at /kohadevbox/koha/opac/opac-reserve.pl line 172 Signed-off-by: Owen Leonard Signed-off-by: Tomas Cohen Arazi Signed-off-by: Fridolin Somers Signed-off-by: Kyle M Hall (cherry picked from commit 89be96b35d0556c54aece53cf4bc46956138150a) Signed-off-by: Andrew Fuerste-Henry --- opac/opac-reserve.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 6fad383113..a80c7e0aed 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -171,6 +171,8 @@ foreach my $biblioNumber (@biblionumbers) { # Compute the priority rank. my $biblio = Koha::Biblios->find( $biblioNumber ); + next unless $biblio; + $biblioData->{object} = $biblio; my $holds = $biblio->holds; my $rank = $holds->count; -- 2.39.5