View | Details | Raw Unified | Return to bug 15851
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (-15 / +18 lines)
Lines 353-373 Link Here
353
            </xsl:choose>
353
            </xsl:choose>
354
        </xsl:variable>
354
        </xsl:variable>
355
355
356
        <xsl:element name="span">
356
        <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
357
            <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
357
        <xsl:if test="$show_analytics_link='1'">
358
            <span class="label">Analytics: </span>
358
            <xsl:element name="span">
359
            <a>
359
                <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
360
            <xsl:choose>
360
                <span class="label">Analytics: </span>
361
                <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
361
                <a>
362
                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute>
362
                <xsl:choose>
363
                </xsl:when>
363
                    <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
364
                <xsl:otherwise>
364
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=rcn:<xsl:value-of select="str:encode-uri(marc:controlfield[@tag=001], true())"/>+AND+(bib-level:a+OR+bib-level:b)</xsl:attribute>
365
                    <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
365
                    </xsl:when>
366
                </xsl:otherwise>
366
                    <xsl:otherwise>
367
            </xsl:choose>
367
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
368
            <xsl:text>Show analytics</xsl:text>
368
                    </xsl:otherwise>
369
            </a>
369
                </xsl:choose>
370
        </xsl:element>
370
                <xsl:text>Show analytics</xsl:text>
371
                </a>
372
            </xsl:element>
373
        </xsl:if>
371
374
372
        <!-- Volumes of sets and traced series -->
375
        <!-- Volumes of sets and traced series -->
373
        <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
376
        <xsl:if test="$materialTypeCode='ST' or substring($controlField008,22,1)='m'">
(-)a/opac/opac-detail.pl (-2 / +17 lines)
Lines 62-67 use Koha::Patrons; Link Here
62
use Koha::Plugins;
62
use Koha::Plugins;
63
use Koha::Ratings;
63
use Koha::Ratings;
64
use Koha::Reviews;
64
use Koha::Reviews;
65
use Koha::SearchEngine::Search;
65
66
66
use Try::Tiny;
67
use Try::Tiny;
67
68
Lines 181-188 my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef; Link Here
181
182
182
if ( $xslfile ) {
183
if ( $xslfile ) {
183
184
185
    my $searcher = Koha::SearchEngine::Search->new(
186
        { index => $Koha::SearchEngine::BIBLIOS_INDEX }
187
    );
188
    my $cleaned_title = $biblio->title;
189
    $cleaned_title =~ tr|/||;
190
    my $query =
191
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
192
      ? 'rcn:'. $record->field('001')->data . ' and (bib-level:a or bib-level:b)'
193
      : "Host-item:$cleaned_title";
194
    my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
195
196
    warn "Warning from simple_search_compat: $err"
197
        if $err;
198
184
    my $variables = {
199
    my $variables = {
185
        anonymous_session => ($borrowernumber) ? 0 : 1
200
        anonymous_session   => ($borrowernumber) ? 0 : 1,
201
        show_analytics_link => $count > 0 ? 1 : 0
186
    };
202
    };
187
203
188
    my @plugin_responses = Koha::Plugins->call(
204
    my @plugin_responses = Koha::Plugins->call(
189
- 

Return to bug 15851