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

(-)a/catalogue/detail.pl (-4 / +25 lines)
Lines 48-53 use Koha::ItemTypes; Link Here
48
use Koha::Patrons;
48
use Koha::Patrons;
49
use Koha::Virtualshelves;
49
use Koha::Virtualshelves;
50
use Koha::Plugins;
50
use Koha::Plugins;
51
use Koha::SearchEngine::Search;
51
52
52
my $query = CGI->new();
53
my $query = CGI->new();
53
54
Lines 143-154 my $lang = $xslfile ? C4::Languages::getlanguage() : undef; Link Here
143
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
144
my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
144
145
145
if ( $xslfile ) {
146
if ( $xslfile ) {
147
148
    my $searcher = Koha::SearchEngine::Search->new(
149
        { index => $Koha::SearchEngine::BIBLIOS_INDEX }
150
    );
151
    my $cleaned_title = $biblio->title;
152
    $cleaned_title =~ tr|/||;
153
    my $query =
154
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
155
      ? 'rcn:'. $record->field('001')->data . ' and (bib-level:a or bib-level:b)'
156
      : "Host-item:$cleaned_title";
157
    my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
158
159
    warn "Warning from simple_search_compat: $err"
160
        if $err;
161
162
    my $variables = {
163
        show_analytics_link => $count > 0 ? 1 : 0
164
    };
165
146
    $template->param(
166
    $template->param(
147
        XSLTDetailsDisplay => '1',
167
        XSLTDetailsDisplay => '1',
148
        XSLTBloc => XSLTParse4Display(
168
        XSLTBloc           => XSLTParse4Display(
149
                        $biblionumber, $record, "XSLTDetailsDisplay",
169
            $biblionumber, $record, "XSLTDetailsDisplay", 1,
150
                        1, undef, $sysxml, $xslfile, $lang
170
            undef,         $sysxml, $xslfile,             $lang,
151
                    )
171
            $variables
172
        )
152
    );
173
    );
153
}
174
}
154
175
(-)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