Bug 14363: OAI-PMH: Handle records without marcxml

Test plan:

1/ git checkout 3.18.x
2/ GET http://OPAC/cgi-bin/koha/oai.pl?verb=ListRecords&metadataPrefix=marcxml
3/ Take the first biblionumber from the results ($biblionumber)
4/ mysql> update biblioitems set marcxml=null where biblionumber=$biblionumber
5/ Repeat step 2 => XML error
6/ Apply patch
7/ Repeat step 2 => no errors

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
  Works on 3.20.x

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Fix works for 3.18.x and 3.20.x
3.22 is not impacted

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Julian Maurice 2015-09-01 09:46:35 +02:00 committed by Frédéric Demians
parent 77589b549c
commit 13239b15a5
1 changed files with 9 additions and 1 deletions

View File

@ -225,7 +225,15 @@ sub new {
}
my $parser = XML::LibXML->new();
my $record_dom = $parser->parse_string( $marcxml );
my $record_dom;
eval {
$record_dom = $parser->parse_string( $marcxml );
};
if ($@) {
warn "OAI-PMH: No marcxml for record " . $args{identifier};
return $self;
}
my $format = $args{metadataPrefix};
if ( $format ne 'marcxml' ) {
my %args = (