Lines 34-39
use Encode;
Link Here
|
34 |
use XML::LibXML; |
34 |
use XML::LibXML; |
35 |
use XML::LibXSLT; |
35 |
use XML::LibXSLT; |
36 |
use LWP::Simple; |
36 |
use LWP::Simple; |
|
|
37 |
use MARC::File::XML; |
37 |
|
38 |
|
38 |
use vars qw($VERSION @ISA @EXPORT); |
39 |
use vars qw($VERSION @ISA @EXPORT); |
39 |
|
40 |
|
Lines 350-365
sub _prepareComponentPartRecords {
Link Here
|
350 |
|
351 |
|
351 |
my $field001Data = shift; |
352 |
my $field001Data = shift; |
352 |
my $componentPartRecordsXML; |
353 |
my $componentPartRecordsXML; |
353 |
my ($error, $componentPartRecordISOs, $resultSetSize) = C4::Search::SimpleSearch("rcn=$field001Data"); |
354 |
my ($error, $componentPartRecordXMLs, $resultSetSize) = C4::Search::SimpleSearch("rcn=$field001Data"); |
354 |
|
355 |
|
355 |
if ($resultSetSize && !$error) { |
356 |
if ($resultSetSize && !$error) { |
356 |
|
357 |
|
357 |
#Collect the XML elements to a array instead of continuously concatenating a string. |
358 |
#Collect the XML elements to a array instead of continuously concatenating a string. |
358 |
# There might be dozens of component part records and in such a case string concatenation is extremely slow. |
359 |
# There might be dozens of component part records and in such a case string concatenation is extremely slow. |
359 |
my @componentPartRecordXML = ('<componentPartRecords>'); #@@componentPartRecordXML vs $componentPartRecordsXML is a nice Perl curiosity! |
360 |
my @componentPartRecordXML = ('<componentPartRecords>'); #@@componentPartRecordXML vs $componentPartRecordsXML is a nice Perl curiosity! |
360 |
for my $cr ( @{$componentPartRecordISOs} ) { |
361 |
for my $cr ( @{$componentPartRecordXMLs} ) { |
361 |
push @componentPartRecordXML, ' <componentPart>'; |
362 |
push @componentPartRecordXML, ' <componentPart>'; |
362 |
my $marcrecord = MARC::File::USMARC::decode($cr); |
363 |
my $marcrecord = MARC::Record->new_from_xml($cr, 'UTF-8', 'MARC21'); |
363 |
my $componentPartBiblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,q{}); |
364 |
my $componentPartBiblio = TransformMarcToKoha(C4::Context->dbh,$marcrecord,q{}); |
364 |
|
365 |
|
365 |
push @componentPartRecordXML, " <title>$componentPartBiblio->{'title'}</title>" if $componentPartBiblio->{'title'}; |
366 |
push @componentPartRecordXML, " <title>$componentPartBiblio->{'title'}</title>" if $componentPartBiblio->{'title'}; |
366 |
- |
|
|