Bug 42637: Check if biblio exists before checking if it is fast add
This patch reorders code to make sure the biblio record exists before checking if the framework is a fast add framework. To test: 1. Go to a non existing biblio record like: http://localhost:8081/cgi-bin/koha/catalogue/detail.pl?biblionumber=99999999 2. See a 500 error or in ktd: Can't call method "frameworkcode" on an undefined value 3. Apply patch and restart_all 4. Repeat step 1 5. Now you get the nice error message: The record you requested does not exist (99999999). Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
ee01f1746c
commit
fef2a118e2
|
|
@ -90,18 +90,7 @@ if ( C4::Context->config('enable_plugins') ) {
|
|||
my $activetab = $query->param('activetab');
|
||||
my $biblionumber = $query->param('biblionumber');
|
||||
$biblionumber = HTML::Entities::encode($biblionumber);
|
||||
my $biblio = Koha::Biblios->find($biblionumber);
|
||||
my $frameworkcode = $biblio->frameworkcode;
|
||||
my $is_fast_add =
|
||||
$frameworkcode eq ''
|
||||
? 0
|
||||
: Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add;
|
||||
|
||||
$template->param(
|
||||
biblio => $biblio,
|
||||
activetab => $activetab,
|
||||
is_fast_add => $is_fast_add,
|
||||
);
|
||||
my $biblio = Koha::Biblios->find($biblionumber);
|
||||
|
||||
unless ($biblio) {
|
||||
|
||||
|
|
@ -114,6 +103,18 @@ unless ($biblio) {
|
|||
exit;
|
||||
}
|
||||
|
||||
my $frameworkcode = $biblio->frameworkcode;
|
||||
my $is_fast_add =
|
||||
$frameworkcode eq ''
|
||||
? 0
|
||||
: Koha::BiblioFrameworks->find($frameworkcode)->is_fast_add;
|
||||
|
||||
$template->param(
|
||||
biblio => $biblio,
|
||||
activetab => $activetab,
|
||||
is_fast_add => $is_fast_add,
|
||||
);
|
||||
|
||||
my $marc_record = eval { $biblio->metadata->record };
|
||||
my $invalid_marc_record = $@ || !$marc_record;
|
||||
if ($invalid_marc_record) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue