From b261c11d477d559ce9dcfae119b6a53ea47a62be Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Wed, 2 Apr 2014 17:47:33 +0300 Subject: [PATCH] Bug 11175 - Rebased to parse XML result from SimpleSearch instead of the ISO2709-version which it used to be. --- C4/XSLT.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index c18612a..a02e83e 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -34,6 +34,7 @@ use Encode; use XML::LibXML; use XML::LibXSLT; use LWP::Simple; +use MARC::File::XML; use vars qw($VERSION @ISA @EXPORT); @@ -350,16 +351,16 @@ sub _prepareComponentPartRecords { my $field001Data = shift; my $componentPartRecordsXML; - my ($error, $componentPartRecordISOs, $resultSetSize) = C4::Search::SimpleSearch("rcn=$field001Data"); + my ($error, $componentPartRecordXMLs, $resultSetSize) = C4::Search::SimpleSearch("rcn=$field001Data"); if ($resultSetSize && !$error) { #Collect the XML elements to a array instead of continuously concatenating a string. # There might be dozens of component part records and in such a case string concatenation is extremely slow. my @componentPartRecordXML = (''); #@@componentPartRecordXML vs $componentPartRecordsXML is a nice Perl curiosity! - for my $cr ( @{$componentPartRecordISOs} ) { + for my $cr ( @{$componentPartRecordXMLs} ) { push @componentPartRecordXML, ' '; - my $marcrecord = MARC::File::USMARC::decode($cr); + my $marcrecord = MARC::Record->new_from_xml($cr, 'UTF-8', 'MARC21'); my $componentPartBiblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,q{}); push @componentPartRecordXML, " $componentPartBiblio->{'title'}" if $componentPartBiblio->{'title'}; -- 1.8.1.2