Bugzilla – Attachment 86485 Details for
Bug 8995
Show OpenURL links in OPAC search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8995: Fix URL generation when the URL in syspref has a query part
Bug-8995-Fix-URL-generation-when-the-URL-in-syspre.patch (text/plain), 8.54 KB, created by
Josef Moravec
on 2019-03-11 21:30:17 UTC
(
hide
)
Description:
Bug 8995: Fix URL generation when the URL in syspref has a query part
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-11 21:30:17 UTC
Size:
8.54 KB
patch
obsolete
>From f48ef1527a0c900ef151da9702967621f602b186 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Fri, 2 Sep 2016 15:55:11 +0200 >Subject: [PATCH] Bug 8995: Fix URL generation when the URL in syspref has a > query part > >Signed-off-by: Magnus Enger <magnus@libriotech.no> >--- > C4/Biblio.pm | 21 +++++++++++++++++++++ > C4/XSLT.pm | 3 ++- > .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 7 ++----- > .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 7 ++----- > .../bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl | 7 ++----- > .../bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl | 7 ++----- > 6 files changed, 31 insertions(+), 21 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index c4821ba..9b61d27 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -88,6 +88,7 @@ use MARC::File::USMARC; > use MARC::File::XML; > use POSIX qw(strftime); > use Module::Load::Conditional qw(can_load); >+use URI; > use URI::Escape; # GetCOinSBiblio > > use C4::Koha; >@@ -1396,6 +1397,26 @@ sub GetCOinSBiblio { > return $coins_value; > } > >+sub GetOpenURLResolverURL { >+ my ($record) = @_; >+ >+ my $coins = GetCOinSBiblio($record); >+ my $OpenURLResolverURL = C4::Context->preference('OpenURLResolverURL'); >+ >+ if ($OpenURLResolverURL) { >+ my $uri = URI->new($OpenURLResolverURL); >+ >+ if (not defined $uri->query) { >+ $OpenURLResolverURL .= '?'; >+ } else { >+ $OpenURLResolverURL .= '&'; >+ } >+ $OpenURLResolverURL .= $coins; >+ } >+ >+ return $OpenURLResolverURL; >+} >+ > > =head2 GetMarcPrice > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 87b9067..a8e7725 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -250,7 +250,8 @@ sub XSLTParse4Display { > my ($biblio) = GetBiblioItemByBiblioNumber($biblionumber); > my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') ); > if (grep /^$biblio->{itemtype}$/, @itypes) { >- $variables->{COinS} = C4::Biblio::GetCOinSBiblio($orig_record); >+ $variables->{OpenURLResolverURL} = >+ C4::Biblio::GetOpenURLResolverURL($orig_record); > } > } > my $varxml = "<variables>\n"; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index 83dbb0d..9e66444 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1315,12 +1315,11 @@ > > <!-- OpenURL --> > <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" /> >- <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" /> > <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" /> > <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" /> >- <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" /> >+ <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" /> > >- <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''"> >+ <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''"> > <xsl:variable name="openurltext"> > <xsl:choose> > <xsl:when test="$OpenURLText != ''"> >@@ -1347,8 +1346,6 @@ > <span class="results_summary"><a> > <xsl:attribute name="href"> > <xsl:value-of select="$OpenURLResolverURL" /> >- <xsl:text>?</xsl:text> >- <xsl:value-of select="$COinS" /> > </xsl:attribute> > <xsl:attribute name="title"> > <xsl:value-of select="$openurltext" /> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index 9f749c5..2e0eced 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -447,12 +447,11 @@ > > <!-- OpenURL --> > <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" /> >- <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" /> > <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" /> > <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" /> >- <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" /> >+ <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" /> > >- <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''"> >+ <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''"> > <xsl:variable name="openurltext"> > <xsl:choose> > <xsl:when test="$OpenURLText != ''"> >@@ -479,8 +478,6 @@ > <span class="results_summary"><a> > <xsl:attribute name="href"> > <xsl:value-of select="$OpenURLResolverURL" /> >- <xsl:text>?</xsl:text> >- <xsl:value-of select="$COinS" /> > </xsl:attribute> > <xsl:attribute name="title"> > <xsl:value-of select="$openurltext" /> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >index 6fc39b4..2e327a0 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl >@@ -446,12 +446,11 @@ > > <!-- OpenURL --> > <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" /> >- <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" /> > <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" /> > <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" /> >- <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" /> >+ <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" /> > >- <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''"> >+ <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''"> > <xsl:variable name="openurltext"> > <xsl:choose> > <xsl:when test="$OpenURLText != ''"> >@@ -478,8 +477,6 @@ > <span class="results_summary"><a> > <xsl:attribute name="href"> > <xsl:value-of select="$OpenURLResolverURL" /> >- <xsl:text>?</xsl:text> >- <xsl:value-of select="$COinS" /> > </xsl:attribute> > <xsl:attribute name="title"> > <xsl:value-of select="$openurltext" /> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl >index 409dd8b..b016bb7 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl >@@ -87,12 +87,11 @@ > > <!-- OpenURL --> > <xsl:variable name="OPACShowOpenURL" select="marc:sysprefs/marc:syspref[@name='OPACShowOpenURL']" /> >- <xsl:variable name="OpenURLResolverURL" select="marc:sysprefs/marc:syspref[@name='OpenURLResolverURL']" /> > <xsl:variable name="OpenURLImageLocation" select="marc:sysprefs/marc:syspref[@name='OpenURLImageLocation']" /> > <xsl:variable name="OpenURLText" select="marc:sysprefs/marc:syspref[@name='OpenURLText']" /> >- <xsl:variable name="COinS" select="marc:variables/marc:variable[@name='COinS']" /> >+ <xsl:variable name="OpenURLResolverURL" select="marc:variables/marc:variable[@name='OpenURLResolverURL']" /> > >- <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != '' and $COinS != ''"> >+ <xsl:if test="$OPACShowOpenURL = 1 and $OpenURLResolverURL != ''"> > <xsl:variable name="openurltext"> > <xsl:choose> > <xsl:when test="$OpenURLText != ''"> >@@ -119,8 +118,6 @@ > <span class="results_summary"><a> > <xsl:attribute name="href"> > <xsl:value-of select="$OpenURLResolverURL" /> >- <xsl:text>?</xsl:text> >- <xsl:value-of select="$COinS" /> > </xsl:attribute> > <xsl:attribute name="title"> > <xsl:value-of select="$openurltext" /> >-- >2.1.4
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 8995
:
13141
|
22753
|
23625
|
23626
|
23627
|
24087
|
24088
|
24089
|
26899
|
26900
|
26901
|
29357
|
29358
|
29359
|
30385
|
30386
|
30387
|
30388
|
30389
|
30390
|
35747
|
35916
|
40647
|
44639
|
48371
|
48372
|
55131
|
55132
|
55133
|
55134
|
55135
|
55136
|
55882
|
64513
|
64514
|
64515
|
64516
|
64517
|
64518
|
64519
|
64532
|
64533
|
64534
|
64535
|
64536
|
64537
|
64538
|
86483
|
86484
|
86485
|
86486
|
86487
|
86488
|
86489
|
86490
|
86491
|
86492
|
86541
|
86542
|
86557
|
86558
|
86559
|
86601
|
86602
|
86603
|
86604
|
86605
|
86606
|
86607
|
86608
|
86609
|
86610
|
88665
|
88666
|
88667
|
88668
|
88669
|
88670
|
88671
|
88672
|
88673
|
88735
|
88736
|
88737
|
88738
|
88739
|
88740
|
88741
|
88742
|
88743
|
88744
|
89012
|
89013
|
89014
|
89015
|
89120