From 1f0e3d7a4ba5265e586c0f940c46a63d04ab1e3f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 8 Jul 2011 11:13:41 +0200 Subject: [PATCH] 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 Signed-off-by: Chris Cormack --- acqui/basketgroup.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl index 5dbae17963..fbcad0f531 100755 --- a/acqui/basketgroup.pl +++ b/acqui/basketgroup.pl @@ -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); -- 2.39.5