Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allows for search by equivalent ISBN-10 and ISBN-13

numbers.

* rebuild_zebra.pl now inserts 999$e subfields into
  bib records containing the ISBN-10 and ISBN-13
  forms off all ISBNs in the original MARC record.
* added 999$e to ISBN index
* Adds dependency on Business::ISBN

This work was sponsored by the Plano Independent School
District.
  • Loading branch information...
commit a438d9594426c0a5620107243365bbd71d30a731 1 parent 0ec5d05
@dlbptfs dlbptfs authored J. David Bavousett committed
View
1  Makefile.PL
@@ -538,6 +538,7 @@ WriteMakefile(
PREREQ_PM => {
'Algorithm::CheckDigits' => 0.50,
'Biblio::EndnoteStyle' => 0.05,
+ 'Business::ISBN' => 2.05,
'CGI' => 3.15,
'CGI::Carp' => 1.29,
'CGI::Session' => 4.20,
View
1  about.pl
@@ -64,6 +64,7 @@
qw/
Algorithm::CheckDigits
Biblio::EndnoteStyle
+Business::ISBN
CGI
CGI::Carp
CGI::Session
View
7 etc/zebradb/marc_defs/marc21/biblios/record.abs
@@ -52,9 +52,10 @@ melm 015 BNB-card-number,BGF-number,Number-db,Number-natl-biblio,Identifi
melm 017 Number-legal-deposit,Identifier-standard
melm 018 Identifier-standard
melm 020$a ISBN:w,Identifier-standard:w
-melm 020 Identifier-standard
-melm 022$a ISSN:w,Identifier-standard:w
-melm 022 Identifier-standard
+melm 999$e ISBN:w,Identifier-standard:w
+melm 020 ISBN,Identifier-standard
+melm 022$a ISSN:w,ISBN:w
+melm 022 ISSN,Identifier-standard
melm 023 Identifier-standard
melm 024$a Identifier-other
melm 024 Identifier-standard
View
33 misc/migration_tools/rebuild_zebra.pl
@@ -8,6 +8,7 @@
use File::Path;
use C4::Biblio;
use C4::AuthoritiesMarc;
+use Business::ISBN;
#
# script that checks zebradir structure & create directories & mandatory files if needed
@@ -380,6 +381,7 @@ sub get_corrected_marc_record {
if ($record_type eq 'biblio') {
my $succeeded = fix_biblio_ids($marc, $record_number);
return unless $succeeded;
+ add_isbn13s($marc);
} else {
fix_authority_id($marc, $record_number);
}
@@ -477,6 +479,37 @@ sub fix_biblio_ids {
return 1;
}
+sub add_isbn13s {
+ my $marc = shift;
+
+ my ($isbntag, $isbnsubfield) = GetMarcFromKohaField('biblioitems.isbn', '');
+ return unless $isbntag and $isbnsubfield;
+ my %isbns =();
+ foreach my $field ($marc->field($isbntag)) {
+ my $sfa = $field->subfield('a');
+ next unless $sfa;
+ my ($isbn_str) = $sfa =~ /^([0-9-]+[0-9xX])/;
+ next unless defined $isbn_str;
+ $isbn_str =~ s/-//;
+ $isbns{$isbn_str}++;
+ my $isbn = Business::ISBN->new($isbn_str);
+ next unless defined $isbn;
+ next unless $isbn->is_valid();
+ next unless $isbn->is_valid();
+ my $isbn13_str = $isbn->as_isbn13()->as_string([]);
+ $isbns{$isbn13_str}++;
+ my $isbn10 = $isbn->as_isbn10();
+ next unless defined $isbn10;
+ $isbns{$isbn10->as_string([])}++;
+ }
+ return unless %isbns;
+ if (my $f999 = $marc->field('999')) {
+ $f999->add_subfields(map { ('e' => $_) } keys %isbns);
+ } else {
+ $marc->append_field(MARC::Field->new('999', ' ', ' ', map { ('e' => $_) } keys %isbns));
+ }
+}
+
sub fix_authority_id {
# FIXME - as with fix_biblio_ids, the authid must be present
# for Zebra's sake. However, this really belongs
Please sign in to comment.
Something went wrong with that request. Please try again.