From 894b887b95b4cbc66ed31fcb74f8f73e30be5292 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 22 Oct 2021 09:27:46 +0000 Subject: [PATCH] Bug 11175: (QA follow-up) Simplify block in XSLT Content-Type: text/plain; charset=utf-8 Signed-off-by: Marcel de Rooy --- C4/XSLT.pm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index d133cdf675..926a64ceba 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -282,21 +282,14 @@ sub XSLTParse4Display { } # possibly show analytics link in Detail views - if ( $xslsyspref eq "OPACXSLTDetailsDisplay" || $xslsyspref eq "XSLTDetailsDisplay" ) { + my $show_components = C4::Context->preference('ShowComponentRecords') // q{}; + $variables->{show_analytics_link} = 0; + if( ( $show_components =~ /both|opac/ && $xslsyspref eq "OPACXSLTDetailsDisplay" ) || + ( $show_components =~ /both|staff/ && $xslsyspref eq "XSLTDetailsDisplay" )) + { $biblio //= Koha::Biblios->find( $biblionumber ); my $components = $biblio->get_marc_components(); - $variables->{show_analytics_link} = ( scalar @{$components} == 0 ) ? 0 : 1; - - my $showcomp = C4::Context->preference('ShowComponentRecords'); - if ( - $variables->{show_analytics_link} - && ( $showcomp eq 'both' - || ( $showcomp eq 'staff' && $xslsyspref !~ m/OPAC/ ) - || ( $showcomp eq 'opac' && $xslsyspref =~ m/OPAC/ ) ) - ) - { - $variables->{show_analytics_link} = 0; - } + $variables->{show_analytics_link} = 1 if @$components; } my $varxml = "\n"; -- 2.20.1