my $authority_types = Koha::Authority::Types->search( {}, { order_by => ['authtypetext'] } );
+my $type = $authority_types->find($authtypecode);
$template->param(
authority_types => $authority_types,
authtypecode => $authtypecode,
authid => $authid,
linkid => $linkid,
- authtypetext => $authority_types->find($authtypecode)->authtypetext,
+ authtypetext => $type ? $type->authtypetext : "",
hide_marc => C4::Context->preference('hide_marc'),
);
output_html_with_http_headers $input, $cookie, $template->output;
my $authid = $query->param('authid');
-my $authtypecode = Koha::Authorities->find($authid)->authtypecode;
+my $authobj = Koha::Authorities->find($authid);
+my $authtypecode = $authobj ? $authobj->authtypecode : q{};
$tagslib = &GetTagsLabels(1,$authtypecode);
# Build list of authtypes for showing them
while (my ($tagfield) = $sth->fetchrow) {
$biblio_fields.= $tagfield."9,";
}
-chop $biblio_fields;
+chop $biblio_fields if $biblio_fields;
build_tabs ($template, $record, $dbh,"",$query);
+my $type = $authority_types->find($authtypecode);
$template->param(
authid => $authid,
count => $count,
biblio_fields => $biblio_fields,
- authtypetext => $authority_types->find($authtypecode)->authtypetext,
+ authtypetext => $type ? $type->authtypetext: "",
authtypecode => $authtypecode,
authority_types => $authority_types,
csrf_token => Koha::Token->new->generate_csrf({ session_id => scalar $query->cookie('CGISESSID') }),