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