Bugzilla – Attachment 24525 Details for
Bug 11254
breeding search must normalize ISBN
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 11254 - breeding search must normalize ISBN
SIGNED-OFF-Bug-11254---breeding-search-must-normal.patch (text/plain), 4.13 KB, created by
Mark Tompsett
on 2014-01-17 16:31:43 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 11254 - breeding search must normalize ISBN
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2014-01-17 16:31:43 UTC
Size:
4.13 KB
patch
obsolete
>From 151db2e9afea788c750d433342bd495162e58436 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Fri, 15 Nov 2013 10:43:21 +0100 >Subject: [PATCH] [SIGNED OFF] Bug 11254 - breeding search must normalize ISBN > >When importing records, the ISBN is normalized and stored >into database (see C4::Breeding::ImportBreeding). But when >searching with ISBN into reservoir, it is not normalized >(see C4::Breeding::BreedingSearch). So search does not match. > >This patch adds the normalisation to breeding search. Also >replaces call private method _isbn_cleanup by GetNormalizedISBN, >the correct public method. Also allows the breeding search >on ISBN with hyphens. > >This is intended to fix only reservoir searches. > >Revised Test plan >----------------- > 1) Back up DB > 2) Save copy of attached example somewhere findable > 2) Home -> Tools -> Stage MARC records for import > 3) Click Browse and select the example MARC file > 4) Click Upload file > 5) Tweak as desired then click Stage for import > 6) Click Manage staged records > 7) Click Import this batch into the catalog > 8) Home -> Cataloging > 9) In the Cataloging search text box type 978-0-691-14289-0 and > click Submit > -- ISBN13 with hypens not found in reservoir >10) In the Cataloging search text box type 9780691142890 and > click Submit > -- ISBN13 without hypens not found in reservoir >11) In the Cataloging search text box type 0-691-14289-0 and > click Submit > -- ISBN10 with hypens not found in reservoir >12) In the Cataloging search text box type 0691142890 and > click Submit > -- ISBN10 without hypens found in reservoir >13) Apply patch >14) Repeat steps 9-12, this time it is always found! :) > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > C4/Breeding.pm | 5 ++++- > C4/ImportBatch.pm | 2 +- > cataloguing/addbooks.pl | 4 +++- > 3 files changed, 8 insertions(+), 3 deletions(-) > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index 69adcf4..f7ad472 100644 >--- a/C4/Breeding.pm >+++ b/C4/Breeding.pm >@@ -110,7 +110,7 @@ sub ImportBreeding { > # if isbn found and biblio does not exist, add it. If isbn found and biblio exists, > # overwrite or ignore depending on user choice > # drop every "special" char : spaces, - ... >- $oldbiblio->{isbn} = C4::Koha::_isbn_cleanup($oldbiblio->{isbn}); # FIXME C4::Koha::_isbn_cleanup should be public >+ $oldbiblio->{isbn} = C4::Koha::GetNormalizedISBN($oldbiblio->{isbn}); > # search if biblio exists > my $biblioitemnumber; > if ($oldbiblio->{isbn}) { >@@ -175,6 +175,9 @@ sub BreedingSearch { > my $sth; > my @results; > >+ # normalise ISBN like at import >+ $isbn = C4::Koha::GetNormalizedISBN($isbn); >+ > $query = "SELECT import_record_id, file_name, isbn, title, author > FROM import_biblios > JOIN import_records USING (import_record_id) >diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm >index c045878..9439986 100644 >--- a/C4/ImportBatch.pm >+++ b/C4/ImportBatch.pm >@@ -1437,7 +1437,7 @@ sub _add_biblio_fields { > my ($title, $author, $isbn, $issn) = _parse_biblio_fields($marc_record); > my $dbh = C4::Context->dbh; > # FIXME no controlnumber, originalsource >- $isbn = C4::Koha::_isbn_cleanup($isbn); # FIXME C4::Koha::_isbn_cleanup should be made public >+ $isbn = C4::Koha::GetNormalizedISBN($isbn); > my $sth = $dbh->prepare("INSERT INTO import_biblios (import_record_id, title, author, isbn, issn) VALUES (?, ?, ?, ?, ?)"); > $sth->execute($import_record_id, $title, $author, $isbn, $issn); > $sth->finish(); >diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl >index 35cfa2c..0cfd7e8 100755 >--- a/cataloguing/addbooks.pl >+++ b/cataloguing/addbooks.pl >@@ -116,7 +116,9 @@ if ($query) { > #check is on isbn legnth 13 for new isbn and 10 for old isbn > my ( $title, $isbn ); > if ($query=~/\d/) { >- my $querylength = length $query; >+ my $clean_query = $query; >+ $clean_query =~ s/-//g; # remove hyphens >+ my $querylength = length $clean_query; > if ( $querylength == 13 || $querylength == 10 ) { > $isbn = $query; > } >-- >1.7.9.5
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 11254
:
22956
|
24443
|
24525
|
24527