Bugzilla – Attachment 86607 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: (follow-up) Move GetOpenURLResolverURL to Koha::Biblio->get_openurl
Bug-8995-follow-up-Move-GetOpenURLResolverURL-to-K.patch (text/plain), 4.00 KB, created by
Magnus Enger
on 2019-03-14 13:37:35 UTC
(
hide
)
Description:
Bug 8995: (follow-up) Move GetOpenURLResolverURL to Koha::Biblio->get_openurl
Filename:
MIME Type:
Creator:
Magnus Enger
Created:
2019-03-14 13:37:35 UTC
Size:
4.00 KB
patch
obsolete
>From d24b0ac335694b049d4e24dcc258e66a5c9508a9 Mon Sep 17 00:00:00 2001 >From: Josef Moravec <josef.moravec@gmail.com> >Date: Wed, 13 Mar 2019 07:10:13 +0000 >Subject: [PATCH] Bug 8995: (follow-up) Move GetOpenURLResolverURL to > Koha::Biblio->get_openurl > >Signed-off-by: Magnus Enger <magnus@libriotech.no> >--- > C4/Biblio.pm | 29 ----------------------------- > C4/XSLT.pm | 3 +-- > Koha/Biblio.pm | 29 +++++++++++++++++++++++++++++ > t/db_dependent/Biblio.t | 6 +++--- > 4 files changed, 33 insertions(+), 34 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 988f754378..2dc324c897 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1397,35 +1397,6 @@ sub GetCOinSBiblio { > return $coins_value; > } > >-=head2 GetOpenURLResolverURL >- >- my $url = C4::Biblio::GetOpenURLResolverURL($record); >- >- Takes MARC::Record and return url for OpenURL resolver set in OpenURLResolverURL >- >-=cut >- >-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 > > return the prices in accordance with the Marc format. >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index d4deee009b..b18ccda9a1 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -251,8 +251,7 @@ sub XSLTParse4Display { > my $biblio = $biblio_object->biblioitem->unblessed; > my @itypes = split( /\s/, C4::Context->preference('OPACOpenURLItemTypes') ); > if (grep /^$biblio->{itemtype}$/, @itypes) { >- $variables->{OpenURLResolverURL} = >- C4::Biblio::GetOpenURLResolverURL($orig_record); >+ $variables->{OpenURLResolverURL} = $biblio_object->get_openurl; > } > } > my $varxml = "<variables>\n"; >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index d2e4d4d321..4ec405c49a 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -442,6 +442,35 @@ sub has_items_waiting_or_intransit { > return 0; > } > >+=head2 get_openurl >+ >+ my $biblio = Koha::Biblios->find( $biblionumber ); >+ my $url = $biblio->get_openurl; >+ >+ Takes MARC::Record and return url for OpenURL resolver set in OpenURLResolverURL >+ >+=cut >+ >+sub get_openurl { >+ my ( $self ) = @_; >+ >+ my $coins = C4::Biblio::GetCOinSBiblio( $self->metadata->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; >+} >+ > =head3 type > > =cut >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index bf37fac840..82f14b2f7c 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -574,7 +574,7 @@ subtest 'MarcFieldForCreatorAndModifier' => sub { > Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); > $schema->storage->txn_rollback; > >-subtest 'GetCOinSBiblio and GetOpenURLResolverURL' => sub { >+subtest 'GetCOinSBiblio and get_openurl' => sub { > plan tests => 2; > > $schema->storage->txn_begin; >@@ -595,9 +595,9 @@ subtest 'GetCOinSBiblio and GetOpenURLResolverURL' => sub { > ); > > is( >- C4::Biblio::GetOpenURLResolverURL($record), >+ $biblio->get_openurl, > 'https://koha.example.com/?ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title%201&rft.au=Author%201', >- 'GetOpenURLResolverURL returned right URL' >+ 'Koha::Biblio->get_openurl returned right URL' > ); > > $schema->storage->txn_rollback; >-- >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 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