kohabug 2141 - avoid carp on display of details of deleted bib

When displaying details of bib in staff interface, check
that bib actually exists and display 404 page if not.  Avoids
following fatal error:

Can't call method "field" on an undefined value at /home/gmc/koha/dev/C4/Biblio.pm line 944.

This situtation can arise when running Zebra; if a bib is deleted,
Zebra will not necessarily be reindexed instantly, allowing a link
from a search result list to point to a missing record.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Galen Charlton 2008-05-19 14:28:36 -05:00 committed by Joshua Ferraro
parent 35ff682f6f
commit 144378a198

View file

@ -53,6 +53,12 @@ my $fw = GetFrameworkCode($biblionumber);
## get notes and subjects from MARC record
my $marcflavour = C4::Context->preference("marcflavour");
my $record = GetMarcBiblio($biblionumber);
unless (defined($record)) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
my $marcnotesarray = GetMarcNotes( $record, $marcflavour );
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
@ -70,11 +76,6 @@ my $dbh = C4::Context->dbh;
my @items = &GetItemsInfo( $biblionumber, 'intra' );
my $dat = &GetBiblioData($biblionumber);
if (!$dat) {
print $query->redirect("/cgi-bin/koha/koha-tmpl/errors/404.pl");
exit;
}
#coping with subscriptions
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
my @subscriptions = GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );