[Koha-patches] [PATCH] Adding some Error proof on GetAuthority
Henri-Damien LAURENT
henridamien.laurent at biblibre.com
Wed Nov 19 14:58:20 CET 2008
return undef if there is a problem
---
C4/AuthoritiesMarc.pm | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index deda42a..17857f7 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -679,8 +679,9 @@ sub GetAuthority {
my $sth=$dbh->prepare("select authtypecode, marcxml from auth_header where authid=?");
$sth->execute($authid);
my ($authtypecode, $marcxml) = $sth->fetchrow;
- my $record=MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
- (C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")));
+ my $record=eval {MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
+ (C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")))};
+ return undef if ($@);
$record->encoding('UTF-8');
if (C4::Context->preference("marcflavour") eq "MARC21") {
my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode);
--
1.6.0.2
More information about the Koha-patches
mailing list