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 <oleonard@myacpl.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2022-01-10 14:02:49 +01:00 committed by Fridolin Somers
parent 53b693bae4
commit db07ca09cc

View file

@ -168,6 +168,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;