Bug 23248: Avoid opac-ISBDdetail.pl breaking on invalid biblionumber

This patch makes opac-ISBDdetail.pl redirect to a 404 page (as it
should) in the event of a bad biblionumber passed.

To test:
- Open your browser on a known record detail page (OPAC)
- Switch to the ISBD view
=> SUCCESS: It shows
- Alter the biblionumber on the URL into an obviously non-existent
biblionumber (e.g. very high value)
=> FAIL: Internal errors are shown
- Apply this patch
- Reload the bad biblionumber ISBD view
=> SUCCESS: Browser is redirected to the 404 page as it should
- Sign off :-=> FAIL: Internal errors are shown
- Apply this patch
- Reload the bad biblionumber ISBD view
=> SUCCESS: Browser is redirected to the 404 page as it should
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2019-07-01 15:52:02 -03:00 committed by Martin Renvoize
parent e4ee363630
commit c3f0732eb7
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -76,8 +76,12 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
}
);
my $biblio = Koha::Biblios->find( $biblionumber, { prefetch => [ 'metadata', 'items' ] } );
unless ( $biblio ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
my $patron = Koha::Patrons->find($loggedinuser);
my $opachiddenitems_rules;