Lines 281-291
sub XSLTParse4Display {
Link Here
|
281 |
} |
281 |
} |
282 |
} |
282 |
} |
283 |
|
283 |
|
284 |
my $partsxml = ''; |
284 |
# possibly show analytics link in Detail views |
285 |
# possibly insert component records into Detail views |
|
|
286 |
if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) { |
285 |
if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) { |
287 |
my $biblio //= Koha::Biblios->find( $biblionumber ); |
286 |
$biblio //= Koha::Biblios->find( $biblionumber ); |
288 |
my $components = $biblio->get_marc_components(300); |
287 |
my $components = $biblio->get_marc_components(); |
289 |
$variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1; |
288 |
$variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1; |
290 |
|
289 |
|
291 |
my $showcomp = C4::Context->preference('ShowComponentRecords'); |
290 |
my $showcomp = C4::Context->preference('ShowComponentRecords'); |
Lines 296-320
sub XSLTParse4Display {
Link Here
|
296 |
|| ( $showcomp eq 'opac' && $xslsyspref =~ m/OPAC/ ) ) |
295 |
|| ( $showcomp eq 'opac' && $xslsyspref =~ m/OPAC/ ) ) |
297 |
) |
296 |
) |
298 |
{ |
297 |
{ |
299 |
|
|
|
300 |
$variables->{show_analytics_link} = 0; |
298 |
$variables->{show_analytics_link} = 0; |
301 |
|
|
|
302 |
my $search_query = $biblio->get_analytics_query; |
303 |
$variables->{ComponentPartQuery} = $search_query; |
304 |
|
305 |
my @componentPartRecordXML = ('<componentPartRecords>'); |
306 |
for my $cb ( @{ $components } ) { |
307 |
if( ref $cb eq 'MARC::Record'){ |
308 |
$cb = $cb->as_xml_record(); |
309 |
} else { |
310 |
$cb = decode('utf8', $cb); |
311 |
} |
312 |
# Remove the xml header |
313 |
$cb =~ s/^<\?xml.*?\?>//; |
314 |
push @componentPartRecordXML,$cb; |
315 |
} |
316 |
push @componentPartRecordXML, '</componentPartRecords>'; |
317 |
$partsxml = join "\n", @componentPartRecordXML; |
318 |
} |
299 |
} |
319 |
} |
300 |
} |
320 |
|
301 |
|
Lines 325-331
sub XSLTParse4Display {
Link Here
|
325 |
$varxml .= "</variables>\n"; |
306 |
$varxml .= "</variables>\n"; |
326 |
|
307 |
|
327 |
my $sysxml = get_xslt_sysprefs(); |
308 |
my $sysxml = get_xslt_sysprefs(); |
328 |
$xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml$partsxml\<\/record\>/; |
309 |
$xmlrecord =~ s/\<\/record\>/$itemsxml$sysxml$varxml\<\/record\>/; |
329 |
if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs |
310 |
if ($fixamps) { # We need to correct the ampersand entities that Zebra outputs |
330 |
$xmlrecord =~ s/\&amp;/\&/g; |
311 |
$xmlrecord =~ s/\&amp;/\&/g; |
331 |
$xmlrecord =~ s/\&\;lt\;/\<\;/g; |
312 |
$xmlrecord =~ s/\&\;lt\;/\<\;/g; |