Bugzilla – Attachment 90464 Details for
Bug 12537
Editions tab showing on bibs with more than one ISBN
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12537: Don't retrieve XISBN results for the same biblionumber
Bug-12537-Dont-retrieve-XISBN-results-for-the-same.patch (text/plain), 4.16 KB, created by
Nick Clemens (kidclamp)
on 2019-06-10 18:58:40 UTC
(
hide
)
Description:
Bug 12537: Don't retrieve XISBN results for the same biblionumber
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-06-10 18:58:40 UTC
Size:
4.16 KB
patch
obsolete
>From d4e275f49c38729685faf6867b2f106579363e87 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 10 Jun 2019 18:54:30 +0000 >Subject: [PATCH] Bug 12537: Don't retrieve XISBN results for the same > biblionumber > >For a biblio with multiple ISBNS we sometimes get our own record back when >check XISBN, we should test for this > >To test: >1 - Edit a record in the catalogue, add two isbns: > 0521240670 > 0521284198 >2 - Enable ThingISBN and FRBRizeEditions and OPACFRBRizeEditions >3 - View the record in staff and OPAC >4 - You should see editions tab pointing to the same record >5 - Apply patch >6 - Reload the record details, you should no longer see editions tab >7 - Add the second ISBN to another record >8 - Reload details for original record, you shoudl see editions linking to the record with second ISBN >9 - prove -v t/db_dependent/XISBN.t > >NOTE: Current tests don't work under elasticsearch, but the code does, tests should be rewritten on another bug >--- > C4/XISBN.pm | 6 +++--- > catalogue/detail.pl | 2 +- > opac/opac-detail.pl | 2 +- > t/db_dependent/XISBN.t | 20 +++++++++++++++++++- > 4 files changed, 24 insertions(+), 6 deletions(-) > >diff --git a/C4/XISBN.pm b/C4/XISBN.pm >index 22b450255b..1b3a3bbbd6 100644 >--- a/C4/XISBN.pm >+++ b/C4/XISBN.pm >@@ -72,14 +72,14 @@ sub _get_biblio_from_xisbn { > return $biblio; > } > >-=head1 get_xisbns($isbn); >+=head1 get_xisbns($isbn, $biblionumber); > > =head2 $isbn is an ISBN string > > =cut > > sub get_xisbns { >- my ( $isbn ) = @_; >+ my ( $isbn, $biblionumber ) = @_; > my ($response,$thing_response,$syndetics_response,$errors); > # THINGISBN > if ( C4::Context->preference('ThingISBN') ) { >@@ -107,7 +107,7 @@ sub get_xisbns { > next if $unique_xisbns->{ $response_data->{content} }; > $unique_xisbns->{ $response_data->{content} }++; > my $xbiblio= _get_biblio_from_xisbn($response_data->{content}); >- push @xisbns, $xbiblio if $xbiblio; >+ push @xisbns, $xbiblio if $xbiblio && $xbiblio->{biblionumber} ne $biblionumber; > } > if ( wantarray ) { > return (\@xisbns, $errors); >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index 027ca5253a..b7e4d6eced 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -461,7 +461,7 @@ if (C4::Context->preference("virtualshelves") ) { > if (C4::Context->preference("FRBRizeEditions")==1) { > eval { > $template->param( >- XISBNS => scalar get_xisbns($isbn) >+ XISBNS => scalar get_xisbns($isbn, $biblionumber) > ); > }; > if ($@) { warn "XISBN Failed $@"; } >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index c859771590..11491182c8 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -919,7 +919,7 @@ if (C4::Context->preference("virtualshelves") ) { > if (C4::Context->preference("OPACFRBRizeEditions")==1) { > eval { > $template->param( >- XISBNS => scalar get_xisbns($isbn) >+ XISBNS => scalar get_xisbns($isbn, $biblionumber) > ); > }; > if ($@) { warn "XISBN Failed $@"; } >diff --git a/t/db_dependent/XISBN.t b/t/db_dependent/XISBN.t >index 803743a787..500bb6df3a 100755 >--- a/t/db_dependent/XISBN.t >+++ b/t/db_dependent/XISBN.t >@@ -5,7 +5,7 @@ > > use Modern::Perl; > >-use Test::More tests => 3; >+use Test::More tests => 5; > use MARC::Record; > use C4::Biblio; > use C4::XISBN; >@@ -62,6 +62,24 @@ SKIP: { > "Gets correct biblionumber from a book with a similar isbn using ThingISBN." ); > } > >+eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1,$biblionumber1); }; >+SKIP: { >+ skip "Problem retrieving ThingISBN", 1 >+ unless $@ eq ''; >+ is( $results_thingisbn->[0]->{biblionumber}, >+ $biblionumber3, >+ "Gets correct biblionumber from a different book with a similar isbn using ThingISBN." ); >+} >+ >+eval { $results_thingisbn = C4::XISBN::get_xisbns($isbn1,$biblionumber3); }; >+SKIP: { >+ skip "Problem retrieving ThingISBN", 1 >+ unless $@ eq ''; >+ is( $results_thingisbn->[0]->{biblionumber}, >+ undef, >+ "Doesn't get biblionumber if the biblionumber matches the one passed to the sub." ); >+} >+ > # Util subs > > # Add new biblio with isbn and return biblionumber >-- >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 12537
:
29549
|
90464
|
90468
|
90629
|
91125
|
91393