Bugzilla – Attachment 109461 Details for
Bug 15851
Only display "Analytics: Show analytics" when records have linked analytics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15851: (follow-up) Only display the analytics link when required (staff)
Bug-15851-follow-up-Only-display-the-analytics-lin.patch (text/plain), 5.52 KB, created by
Katrin Fischer
on 2020-09-01 20:14:15 UTC
(
hide
)
Description:
Bug 15851: (follow-up) Only display the analytics link when required (staff)
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-09-01 20:14:15 UTC
Size:
5.52 KB
patch
obsolete
>From 040e5c7deb7b218280c2b90fb346fbbc31270572 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 17 Jul 2020 09:44:46 -0300 >Subject: [PATCH] Bug 15851: (follow-up) Only display the analytics link when > required (staff) > >This patch replicates the introduced behaviour, for the admin interface. >To test, follow the test plan from the OPAC, but on the intranet. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > catalogue/detail.pl | 29 ++++++++++++--- > .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 42 +++++++++++++++------- > 2 files changed, 54 insertions(+), 17 deletions(-) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index f865ddb28d..baab67bf62 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -49,6 +49,7 @@ use Koha::ItemTypes; > use Koha::Patrons; > use Koha::Virtualshelves; > use Koha::Plugins; >+use Koha::SearchEngine::Search; > > my $query = CGI->new(); > >@@ -144,12 +145,32 @@ my $lang = $xslfile ? C4::Languages::getlanguage() : undef; > 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 = { >+ show_analytics_link => $count > 0 ? 1 : 0 >+ }; >+ > $template->param( > XSLTDetailsDisplay => '1', >- XSLTBloc => XSLTParse4Display( >- $biblionumber, $record, "XSLTDetailsDisplay", >- 1, undef, $sysxml, $xslfile, $lang >- ) >+ XSLTBloc => XSLTParse4Display( >+ $biblionumber, $record, "XSLTDetailsDisplay", 1, >+ undef, $sysxml, $xslfile, $lang, >+ $variables >+ ) > ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index fc88cec6fd..16f727a0e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -320,21 +320,37 @@ > </span> > </xsl:if> > >- <!-- Analytics --> >- <xsl:if test="$leader7='s'"> >- <span class="results_summary analytics"><span class="label">Analytics: </span> >- <a> >+ <!-- Analytics information --> >+ <xsl:variable name="leader7_class"> > <xsl:choose> >- <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]"> >- <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> >- </xsl:when> >- <xsl:otherwise> >- <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> >- </xsl:otherwise> >+ <!--xsl:when test="$leader7='a'">analytic_mcp</xsl:when--> >+ <!--xsl:when test="$leader7='b'">analytic_scp</xsl:when--> >+ <xsl:when test="$leader7='c'">analytic_collection</xsl:when> >+ <xsl:when test="$leader7='d'">analytic_subunit</xsl:when> >+ <xsl:when test="$leader7='i'">analytic_ires</xsl:when> >+ <xsl:when test="$leader7='m'">analytic_monograph</xsl:when> >+ <xsl:when test="$leader7='s'">analytic_serial</xsl:when> >+ <xsl:otherwise>analytic_undefined</xsl:otherwise> > </xsl:choose> >- <xsl:text>Show analytics</xsl:text> >- </a> >- </span> >+ </xsl:variable> >+ >+ <xsl:variable name="show_analytics_link" select="marc:variables/marc:variable[@name='show_analytics_link']" /> >+ <xsl:if test="$show_analytics_link='1'"> >+ <xsl:element name="span"> >+ <xsl:attribute name="class">results_summary analytics <xsl:value-of select="$leader7_class"/></xsl:attribute> >+ <span class="label">Analytics: </span> >+ <a> >+ <xsl:choose> >+ <xsl:when test="$UseControlNumber = '1' and marc:controlfield[@tag=001]"> >+ <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> >+ </xsl:when> >+ <xsl:otherwise> >+ <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> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:text>Show analytics</xsl:text> >+ </a> >+ </xsl:element> > </xsl:if> > > <!-- Volumes of sets and traced series --> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15851
:
66593
|
106260
|
106261
|
106821
|
106822
|
106988
|
106989
|
106990
|
108049
|
108050
|
108051
|
109267
|
109268
|
109269
|
109459
|
109460
| 109461 |
109462