@@ -, +, @@ tab --- .../en/xslt/MARC21slim2OPACDetail.xsl | 33 ++++++++++--------- opac/opac-detail.pl | 18 +++++++++- 2 files changed, 35 insertions(+), 16 deletions(-) --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl +++ a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl @@ -353,21 +353,24 @@ - - results_summary analytics - Analytics: - - - - /cgi-bin/koha/opac-search.pl?q=rcn:+and+(bib-level:a+or+bib-level:b) - - - /cgi-bin/koha/opac-search.pl?q=Host-item: - - - Show analytics - - + + + + results_summary analytics + Analytics: + + + + /cgi-bin/koha/opac-search.pl?q=rcn:+and+(bib-level:a+or+bib-level:b) + + + /cgi-bin/koha/opac-search.pl?q=Host-item: + + + Show analytics + + + --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -61,6 +61,7 @@ use Koha::Virtualshelves; use Koha::Patrons; use Koha::Ratings; use Koha::Reviews; +use Koha::SearchEngine::Search; my $query = CGI->new(); @@ -171,8 +172,23 @@ my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef; if ( $xslfile ) { + my $searcher = Koha::SearchEngine::Search->new( + { index => $Koha::SearchEngine::BIBLIOS_INDEX } + ); + my $cleaned_title = $biblio->title; + $cleaned_title =~ tr|/||; + my $query = + ( C4::Context->preference('UseControlNumber') and $record->field('001') ) + ? 'rcn:'. $record->field('001')->data . ' and (bib-level:a or bib-level:b)' + : "Host-item:$cleaned_title"; + my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 ); + + warn "Warning from simple_search_compat: $err" + if $err; + my $variables = { - anonymous_session => ($borrowernumber) ? 0 : 1 + anonymous_session => ($borrowernumber) ? 0 : 1, + show_analytics_link => $count > 0 ? 1 : 0 }; $template->param( --