From d4edef97c9a742aee5c4b5ccc5eb0f5b72a3e1ae Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sun, 5 Oct 2008 20:40:24 -0500 Subject: [PATCH] bug 2659: fix crash in OAI-PMH interface When retrieving a record via the OAI-PMH interface, if one of the fields used to prepare the DC metadata is not defined in the MARC framework (e.g., biblioitems.publicationyear in the default MARC21 framework), an OAI GetRecord can fail with the following error: > Can't call method "as_string" on an undefined value at > /usr/share/koha/opac/cgi-bin/opac/oai.pl line 59. Signed-off-by: Galen Charlton --- opac/oai.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/opac/oai.pl b/opac/oai.pl index 44b7367f2a..532c3b883b 100755 --- a/opac/oai.pl +++ b/opac/oai.pl @@ -56,6 +56,7 @@ my @result = (); foreach my $kohafield ( @_ ) { my ( $field, $subfield ) = ::GetMarcFromKohaField( $kohafield, '' ); + next unless defined $field; # $kohafield not defined in framework push( @result, $field < 10 ? $marc->field( $field )->as_string() : $marc->subfield( $field, $subfield ) ); } # @result>1 ? \@result : $result[0]; -- 2.39.5