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 <galen.charlton@liblime.com>
This commit is contained in:
Galen Charlton 2008-10-05 20:40:24 -05:00
parent 5076ee4251
commit d4edef97c9
1 changed files with 1 additions and 0 deletions

View File

@ -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];