From 8c0ea55a1b4469316ddc2c67093d96edd728f372 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Aug 2018 11:58:12 -0300 Subject: [PATCH] Bug 21226: Remove xISBN services OCLC has decided to retire all xISBN services: https://www.oclc.org/developer/news/2018/xid-decommission.en.html The code for related features has to be removed from Koha. Test plan: You need to be familiar with the different sysprefs (I am not): - FRBRizeEditions - SyndeticsEnabled - SyndeticsEditions - ThingISBN Make sure there are no regressions introduced by this patchset. QA Note: C4/XISBN.pm should be renammed --- C4/UsageStats.pm | 1 - C4/XISBN.pm | 18 ++---------------- t/db_dependent/UsageStats.t | 1 - t/db_dependent/XISBN.t | 17 +---------------- 4 files changed, 3 insertions(+), 34 deletions(-) diff --git a/C4/UsageStats.pm b/C4/UsageStats.pm index 18ae59384b..4f66111cd2 100644 --- a/C4/UsageStats.pm +++ b/C4/UsageStats.pm @@ -216,7 +216,6 @@ sub BuildReport { LocalCoverImages OPACLocalCoverImages NovelistSelectEnabled - XISBN OpenLibraryCovers OpenLibrarySearch UseKohaPlugins diff --git a/C4/XISBN.pm b/C4/XISBN.pm index 884d772a41..7562d68eb9 100644 --- a/C4/XISBN.pm +++ b/C4/XISBN.pm @@ -80,7 +80,7 @@ sub _get_biblio_from_xisbn { sub get_xisbns { my ( $isbn ) = @_; - my ($response,$thing_response,$xisbn_response,$syndetics_response,$errors); + my ($response,$thing_response,$syndetics_response,$errors); # THINGISBN if ( C4::Context->preference('ThingISBN') ) { my $url = "http://www.librarything.com/api/thingISBN/".$isbn; @@ -96,21 +96,7 @@ sub get_xisbns { $syndetics_response = {isbn => \@syndetics_response}; } - # XISBN - if ( C4::Context->preference('XISBN') ) { - my $affiliate_id=C4::Context->preference('OCLCAffiliateID'); - my $limit = C4::Context->preference('XISBNDailyLimit') || 999; - my $reached_limit = _service_throttle('xisbn',$limit); - my $url = "http://xisbn.worldcat.org/webservices/xid/isbn/".$isbn."?method=getEditions&format=xml&fl=form,year,lang,ed"; - $url.="&ai=".$affiliate_id if $affiliate_id; - unless ($reached_limit) { - $xisbn_response = _get_url($url,'xisbn'); - } - $errors->{xisbn} = $xisbn_response->{ stat } - if $xisbn_response->{ stat } ne 'ok'; - } - - $response->{isbn} = [ @{ $xisbn_response->{isbn} or [] }, @{ $syndetics_response->{isbn} or [] }, @{ $thing_response->{isbn} or [] } ]; + $response->{isbn} = [ @{ $syndetics_response->{isbn} or [] }, @{ $thing_response->{isbn} or [] } ]; my @xisbns; my $unique_xisbns; # a hashref diff --git a/t/db_dependent/UsageStats.t b/t/db_dependent/UsageStats.t index f2770f7ccc..9d11af1674 100644 --- a/t/db_dependent/UsageStats.t +++ b/t/db_dependent/UsageStats.t @@ -469,7 +469,6 @@ sub mocking_systempreferences_to_a_set_value { LocalCoverImages OPACLocalCoverImages NovelistSelectEnabled - XISBN OpenLibraryCovers OpenLibrarySearch UseKohaPlugins diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t index 23fea72f8a..c1b0f1d718 100755 --- a/t/db_dependent/XISBN.t +++ b/t/db_dependent/XISBN.t @@ -5,7 +5,7 @@ use Modern::Perl; -use Test::More tests => 4; +use Test::More tests => 3; use MARC::Record; use C4::Biblio; use C4::XISBN; @@ -51,7 +51,6 @@ is( $trial->{biblionumber}, ## Test ThingISBN t::lib::Mocks::mock_preference( 'ThingISBN', 1 ); -t::lib::Mocks::mock_preference( 'XISBN', 0 ); my $results_thingisbn; eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1); }; @@ -63,20 +62,6 @@ SKIP: { "Gets correct biblionumber from a book with a similar isbn using ThingISBN." ); } -## Test XISBN -t::lib::Mocks::mock_preference( 'ThingISBN', 0 ); -t::lib::Mocks::mock_preference( 'XISBN', 1 ); - -my $results_xisbn; -eval { ($results_xisbn, $errors) = C4::XISBN::get_xisbns($isbn1); }; -SKIP: { - skip "Problem retrieving XISBN (" . $errors->{xisbn} . ")", 1 - if $errors->{xisbn}; - is( $results_xisbn->[0]->{biblionumber}, - $biblionumber3, - "Gets correct biblionumber from a book with a similar isbn using XISBN." ); -} - $dbh->rollback; # Util subs -- 2.11.0