Bug 6076: acqui pdf error when marcxml wrong

when marcxml is wrong the PDF is not generated. There is a Perl error
because
the biblio can't be retrieved.
This can be workarounded with a eval when decoding the marc

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
(cherry picked from commit 1f0e3d7a4b)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Jonathan Druart 2011-07-08 11:13:41 +02:00 committed by Chris Nighswonger
parent 41a1b6ba6a
commit 6715bc3672
1 changed files with 7 additions and 4 deletions

View File

@ -251,10 +251,13 @@ sub printbasketgrouppdf{
push(@ba_orders, \@ba_order);
# Editor Number
my $en;
if (C4::Context->preference("marcflavour") eq 'UNIMARC') {
$en = MARC::Record::new_from_xml($ord->{marcxml},'UTF-8')->subfield('345',"b");
} elsif (C4::Context->preference("marcflavour") eq 'MARC21') {
$en = MARC::Record::new_from_xml($ord->{marcxml},'UTF-8')->subfield('037',"a");
my $marcrecord=eval{MARC::Record::new_from_xml( $ord->{marcxml},'UTF-8' )};
if ($marcrecord){
if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) {
$en = $marcrecord->subfield( '345', "b" );
} elsif ( C4::Context->preference("marcflavour") eq 'MARC21' ) {
$en = $marcrecord->subfield( '037', "a" );
}
}
if($en){
push(@ba_order, $en);