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

(-)a/catalogue/detail.pl (-4 / +25 lines)
Lines 49-54 use Koha::ItemTypes; Link Here
49
use Koha::Patrons;
49
use Koha::Patrons;
50
use Koha::Virtualshelves;
50
use Koha::Virtualshelves;
51
use Koha::Plugins;
51
use Koha::Plugins;
52
use Koha::SearchEngine::Search;
52
53
53
my $query = CGI->new();
54
my $query = CGI->new();
54
55
Lines 144-155 my $lang = $xslfile ? C4::Languages::getlanguage() : undef; Link Here
144
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
145
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
145
146
146
if ( $xslfile ) {
147
if ( $xslfile ) {
148
149
    my $searcher = Koha::SearchEngine::Search->new(
150
        { index => $Koha::SearchEngine::BIBLIOS_INDEX }
151
    );
152
    my $cleaned_title = $biblio->title;
153
    $cleaned_title =~ tr|/||;
154
    my $query =
155
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
156
      ? 'rcn:'. $record->field('001')->data . ' and (bib-level:a or bib-level:b)'
157
      : "Host-item:$cleaned_title";
158
    my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
159
160
    warn "Warning from simple_search_compat: $err"
161
        if $err;
162
163
    my $variables = {
164
        show_analytics_link => $count > 0 ? 1 : 0
165
    };
166
147
    $template->param(
167
    $template->param(
148
        XSLTDetailsDisplay => '1',
168
        XSLTDetailsDisplay => '1',
149
        XSLTBloc => XSLTParse4Display(
169
        XSLTBloc           => XSLTParse4Display(
150
                        $biblionumber, $record, "XSLTDetailsDisplay",
170
            $biblionumber, $record, "XSLTDetailsDisplay", 1,
151
                        1, undef, $sysxml, $xslfile, $lang
171
            undef,         $sysxml, $xslfile,             $lang,
152
                    )
172
            $variables
173
        )
153
    );
174
    );
154
}
175
}
155
176
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-14 / +29 lines)
Lines 320-340 Link Here
320
        </span>
320
        </span>
321
        </xsl:if>
321
        </xsl:if>
322
322
323
        <!-- Analytics -->
323
        <!-- Analytics information -->
324
        <xsl:if test="$leader7='s'">
324
        <xsl:variable name="leader7_class">
325
        <span class="results_summary analytics"><span class="label">Analytics: </span>
326
            <a>
327
            <xsl:choose>
325
            <xsl:choose>
328
            <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
326
                <!--xsl:when test="$leader7='a'">analytic_mcp</xsl:when-->
329
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
327
                <!--xsl:when test="$leader7='b'">analytic_scp</xsl:when-->
330
            </xsl:when>
328
                <xsl:when test="$leader7='c'">analytic_collection</xsl:when>
331
            <xsl:otherwise>
329
                <xsl:when test="$leader7='d'">analytic_subunit</xsl:when>
332
                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
330
                <xsl:when test="$leader7='i'">analytic_ires</xsl:when>
333
            </xsl:otherwise>
331
                <xsl:when test="$leader7='m'">analytic_monograph</xsl:when>
332
                <xsl:when test="$leader7='s'">analytic_serial</xsl:when>
333
                <xsl:otherwise>analytic_undefined</xsl:otherwise>
334
            </xsl:choose>
334
            </xsl:choose>
335
            <xsl:text>Show analytics</xsl:text>
335
        </xsl:variable>
336
            </a>
336
337
        </span>
337
        <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
338
        <xsl:if test="$show_analytics_link='1'">
339
            <xsl:element name="span">
340
                <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
341
                <span class="label">Analytics: </span>
342
                <a>
343
                <xsl:choose>
344
                    <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]">
345
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/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>
346
                    </xsl:when>
347
                    <xsl:otherwise>
348
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:<xsl:value-of select="str:encode-uri(translate(marc:datafield[@tag=245]/marc:subfield[@code='a'], '/', ''), true())"/></xsl:attribute>
349
                    </xsl:otherwise>
350
                </xsl:choose>
351
                <xsl:text>Show analytics</xsl:text>
352
                </a>
353
            </xsl:element>
338
        </xsl:if>
354
        </xsl:if>
339
355
340
        <!-- Volumes of sets and traced series -->
356
        <!-- Volumes of sets and traced series -->
341
- 

Return to bug 15851