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

(-)a/catalogue/detail.pl (-2 / +5 lines)
Lines 138-144 if ( $xslfile ) { Link Here
138
    my $query =
138
    my $query =
139
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
139
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
140
      ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
140
      ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
141
      : "Host-item:($cleaned_title)";
141
      : "Host-item:(\"$cleaned_title\")";
142
    my ( $err, $result, $count );
142
    my ( $err, $result, $count );
143
    eval {
143
    eval {
144
        ( $err, $result, $count ) =
144
        ( $err, $result, $count ) =
Lines 153-160 if ( $xslfile ) { Link Here
153
        $template->param( analytics_error => 1 );
153
        $template->param( analytics_error => 1 );
154
    }
154
    }
155
155
156
    my $show_analytics_link = defined $count && $count > 0 ? 1 : 0;
157
156
    my $variables = {
158
    my $variables = {
157
        show_analytics_link => defined $count && $count > 0 ? 1 : 0
159
        show_analytics_link => $show_analytics_link,
160
        ( $show_analytics_link ? ( analytics_query => $cleaned_title ) : () )
158
    };
161
    };
159
162
160
    $template->param(
163
    $template->param(
(-)a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl (-1 / +2 lines)
Lines 213-218 Link Here
213
213
214
        <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
214
        <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
215
        <xsl:if test="$show_analytics_link='1'">
215
        <xsl:if test="$show_analytics_link='1'">
216
            <xsl:variable name="analytics_query" select="marc:variables/marc:variable[@name='analytics_query']" />
216
            <xsl:element name="span">
217
            <xsl:element name="span">
217
                <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
218
                <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
218
                <span class="label">Analytics: </span>
219
                <span class="label">Analytics: </span>
Lines 222-228 Link Here
222
                        <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>
223
                        <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>
223
                    </xsl:when>
224
                    </xsl:when>
224
                    <xsl:otherwise>
225
                    <xsl:otherwise>
225
                        <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>
226
                        <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Host-item:("<xsl:value-of select="$analytics_query"/>")</xsl:attribute>
226
                    </xsl:otherwise>
227
                    </xsl:otherwise>
227
                </xsl:choose>
228
                </xsl:choose>
228
                <xsl:text>Show analytics</xsl:text>
229
                <xsl:text>Show analytics</xsl:text>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl (-1 / +2 lines)
Lines 248-253 Link Here
248
248
249
        <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
249
        <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" />
250
        <xsl:if test="$show_analytics_link='1'">
250
        <xsl:if test="$show_analytics_link='1'">
251
            <xsl:variable name="analytics_query" select="marc:variables/marc:variable[@name='analytics_query']" />
251
            <xsl:element name="span">
252
            <xsl:element name="span">
252
                <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
253
                <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute>
253
                <span class="label">Analytics: </span>
254
                <span class="label">Analytics: </span>
Lines 257-263 Link Here
257
                        <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>
258
                        <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>
258
                    </xsl:when>
259
                    </xsl:when>
259
                    <xsl:otherwise>
260
                    <xsl:otherwise>
260
                        <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>
261
                        <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Host-item:("<xsl:value-of select="$analytics_query"/>")</xsl:attribute>
261
                    </xsl:otherwise>
262
                    </xsl:otherwise>
262
                </xsl:choose>
263
                </xsl:choose>
263
                <xsl:text>Show analytics</xsl:text>
264
                <xsl:text>Show analytics</xsl:text>
(-)a/opac/opac-detail.pl (-3 / +5 lines)
Lines 195-201 if ( $xslfile ) { Link Here
195
    my $query =
195
    my $query =
196
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
196
      ( C4::Context->preference('UseControlNumber') and $record->field('001') )
197
      ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
197
      ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
198
      : "Host-item:($cleaned_title)";
198
      : "Host-item:(\"$cleaned_title\")";
199
    my ( $err, $result, $count );
199
    my ( $err, $result, $count );
200
    eval {
200
    eval {
201
        ( $err, $result, $count ) =
201
        ( $err, $result, $count ) =
Lines 208-216 if ( $xslfile ) { Link Here
208
        warn "Warning from simple_search_compat: $error";
208
        warn "Warning from simple_search_compat: $error";
209
    }
209
    }
210
210
211
    my $show_analytics_link = defined $count && $count > 0 ? 1 : 0;
212
211
    my $variables = {
213
    my $variables = {
212
        anonymous_session   => ($borrowernumber) ? 0 : 1,
214
        anonymous_session   => ($borrowernumber) ? 0 : 1,
213
        show_analytics_link => defined $count && $count > 0 ? 1 : 0
215
        show_analytics_link => $show_analytics_link,
216
        ( $show_analytics_link ? ( analytics_query => $cleaned_title ) : () )
214
    };
217
    };
215
218
216
    my @plugin_responses = Koha::Plugins->call(
219
    my @plugin_responses = Koha::Plugins->call(
217
- 

Return to bug 29418