1st scripts for MARC-DB.
WARNING : YOU MUST DO THE FOLLOWING IF YOU EXPECT THE MAIN-BRANCH TO WORK. * install MARC::Record package, from cpan or sourceforge * OVERWRITE File.pm and USMARC.pm. The original misses 1 functionnality we absolutly need in koha (reading a MARC from a variable, not from a file). Thanks to Steve, who modified MARC::Record. * modify your DB by adding marcschema.sql tables * populate new tables by launching fill_usmarc.pl Then, it should work... What works exactly will come in the next commit, in a few minuts (hitchcock suspens...)
This commit is contained in:
parent
52e5f54401
commit
1da4e0ff2f
|
|
@ -0,0 +1,183 @@
|
|||
package MARC::File;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MARC::File - Base class for files of MARC records
|
||||
|
||||
=cut
|
||||
|
||||
use 5.6.0;
|
||||
use strict;
|
||||
use integer;
|
||||
use vars qw( $VERSION $ERROR );
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
Version 0.93
|
||||
|
||||
$Id$
|
||||
|
||||
=cut
|
||||
|
||||
our $VERSION = '0.93';
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MARC::File::USMARC;
|
||||
|
||||
my $file = MARC::File::USMARC->in( $filename );
|
||||
|
||||
while ( my $marc = $file->next() ) {
|
||||
# Do something
|
||||
}
|
||||
$file->close();
|
||||
undef $file;
|
||||
|
||||
=head1 EXPORT
|
||||
|
||||
None.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head2 in()
|
||||
|
||||
Opens a file for input.
|
||||
|
||||
=cut
|
||||
|
||||
sub in {
|
||||
my $class = shift;
|
||||
my $filename = shift;
|
||||
|
||||
my $self = {
|
||||
filename => $filename,
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
|
||||
if ( !open( $self->{fh}, "<", $filename ) ) {
|
||||
undef $self;
|
||||
$MARC::File::ERROR = "Couldn't open $filename: $!";
|
||||
}
|
||||
|
||||
return $self;
|
||||
} # new()
|
||||
|
||||
sub indata {
|
||||
my $class = shift;
|
||||
my $data = shift;
|
||||
|
||||
my $self = {
|
||||
fh => '',
|
||||
data => $data,
|
||||
pointer => 0,
|
||||
};
|
||||
|
||||
bless $self, $class;
|
||||
|
||||
# if ( !open( $self->{fh}, "<", $filename ) ) {
|
||||
# undef $self;
|
||||
# $MARC::File::ERROR = "Couldn't open $filename: $!";
|
||||
# }
|
||||
|
||||
return $self;
|
||||
} # new()
|
||||
|
||||
sub out {
|
||||
die "Not yet written";
|
||||
}
|
||||
|
||||
=head2 next()
|
||||
|
||||
Reads the next record from the file handle passed in.
|
||||
|
||||
=cut
|
||||
|
||||
sub next {
|
||||
my $self = shift;
|
||||
|
||||
my $rec = $self->_next();
|
||||
|
||||
return $rec ? $self->decode($rec) : undef;
|
||||
}
|
||||
|
||||
=head2 skip
|
||||
|
||||
Skips over the next record in the file. Same as C<next()>,
|
||||
without the overhead of parsing a record you're going to throw away
|
||||
anyway.
|
||||
|
||||
Returns 1 or undef.
|
||||
|
||||
=cut
|
||||
|
||||
sub skip {
|
||||
my $self = shift;
|
||||
|
||||
my $rec = $self->_next();
|
||||
|
||||
return $rec ? 1 : undef;
|
||||
}
|
||||
|
||||
sub close {
|
||||
my $self = shift;
|
||||
|
||||
close( $self->{fh} );
|
||||
delete $self->{fh};
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sub _unimplemented() {
|
||||
my $self = shift;
|
||||
my $method = shift;
|
||||
|
||||
warn "Method $method must be overridden";
|
||||
}
|
||||
|
||||
sub write { $_[0]->_unimplemented("write"); }
|
||||
sub decode { $_[0]->_unimplemented("decode"); }
|
||||
|
||||
# NOTE: _gripe can be called as an object method, or not. Your choice.
|
||||
sub _gripe(@) {
|
||||
if ( @_ ) {
|
||||
shift if ref($_[0]) =~ /^MARC::File/; # Skip first parm if it's a $self
|
||||
$ERROR = join( "", @_ );
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 RELATED MODULES
|
||||
|
||||
L<MARC::Record>
|
||||
|
||||
=head1 TODO
|
||||
|
||||
=over 4
|
||||
|
||||
=item * C<out()> method
|
||||
|
||||
We only handle files for input right now.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
This code may be distributed under the same terms as Perl itself.
|
||||
|
||||
Please note that these modules are not products of or supported by the
|
||||
employers of the various contributors to the code.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Andy Lester, E<lt>marc@petdance.comE<gt> or E<lt>alester@flr.follett.comE<gt>
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -0,0 +1,289 @@
|
|||
package MARC::File::USMARC;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
MARC::File::USMARC - USMARC-specific file handling
|
||||
|
||||
=cut
|
||||
|
||||
use 5.6.0;
|
||||
use strict;
|
||||
use integer;
|
||||
use vars qw( $VERSION $ERROR );
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
Version 0.93
|
||||
|
||||
$Id$
|
||||
|
||||
=cut
|
||||
|
||||
our $VERSION = '0.93';
|
||||
|
||||
use MARC::File;
|
||||
our @ISA = qw( MARC::File );
|
||||
|
||||
use MARC::Record qw( LEADER_LEN );
|
||||
use constant SUBFIELD_INDICATOR => "\x1F";
|
||||
use constant END_OF_FIELD => "\x1E";
|
||||
use constant END_OF_RECORD => "\x1D";
|
||||
use constant DIRECTORY_ENTRY_LEN => 12;
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use MARC::File::USMARC;
|
||||
|
||||
my $file = MARC::File::USMARC::in( $filename );
|
||||
|
||||
while ( my $marc = $file->next() ) {
|
||||
# Do something
|
||||
}
|
||||
$file->close();
|
||||
undef $file;
|
||||
|
||||
=head1 EXPORT
|
||||
|
||||
None.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=for internal
|
||||
|
||||
Internal function to get the next raw record out of a file.
|
||||
|
||||
=cut
|
||||
|
||||
sub _next {
|
||||
my $self = shift;
|
||||
|
||||
if ($self->{fh}) {
|
||||
my $fh = $self->{fh};
|
||||
|
||||
my $reclen;
|
||||
|
||||
read( $fh, $reclen, 5 )
|
||||
or return $self->_gripe( "Error reading record length: $!" );
|
||||
|
||||
$reclen =~ /^\d{5}$/
|
||||
or return $self->_gripe( "Invalid record length \"$reclen\"" );
|
||||
my $usmarc = $reclen;
|
||||
read( $fh, substr($usmarc,5), $reclen-5 )
|
||||
or return $self->_gripe( "Error reading $reclen byte record: $!" );
|
||||
|
||||
return $usmarc;
|
||||
} elsif (defined($self->{data})) {
|
||||
my $data=$self->{data};
|
||||
my $pointer=$self->{pointer};
|
||||
my $reclen;
|
||||
$reclen=substr($data,$pointer,5);
|
||||
$reclen=~/^\d{5}$/
|
||||
or return $self->_gripe( "Invalid record length \"$reclen\"" );
|
||||
my $usmarc=substr($data,$pointer,$reclen);
|
||||
$self->{pointer}=$pointer+$reclen;
|
||||
return $usmarc;
|
||||
}
|
||||
}
|
||||
|
||||
=head2 decode()
|
||||
|
||||
Constructor for handling data from a USMARC file. This function takes care of all
|
||||
the tag directory parsing & mangling.
|
||||
|
||||
Any warnings or coercions can be checked in the C<warnings()> function.
|
||||
|
||||
=cut
|
||||
|
||||
sub decode {
|
||||
my $text = shift;
|
||||
$text = shift if (ref($text)||$text) =~ /^MARC::File/;
|
||||
|
||||
my $marc = MARC::Record->new();
|
||||
|
||||
# Check for an all-numeric record length
|
||||
($text =~ /^(\d{5})/)
|
||||
or return $marc->_gripe( "Record length \"", substr( $text, 0, 5 ), "\" is not numeric" );
|
||||
|
||||
my $reclen = $1;
|
||||
($reclen == length($text))
|
||||
or return $marc->_gripe( "Invalid record length: Leader says $reclen bytes, but it's actually ", length( $text ) );
|
||||
|
||||
$marc->leader( substr( $text, 0, LEADER_LEN ) );
|
||||
my @fields = split( END_OF_FIELD, substr( $text, LEADER_LEN ) );
|
||||
my $dir = shift @fields or return _gripe( "No directory found" );
|
||||
|
||||
(length($dir) % 12 == 0)
|
||||
or return $marc->_gripe( "Invalid directory length" );
|
||||
my $nfields = length($dir)/12;
|
||||
|
||||
my $finalfield = pop @fields;
|
||||
# Check for the record terminator, and ignore it
|
||||
($finalfield eq END_OF_RECORD)
|
||||
or $marc->_warn( "Invalid record terminator: \"$finalfield\"" );
|
||||
|
||||
# Walk thru the directories, and shift off the fields while we're at it
|
||||
# Shouldn't be any non-digits anywhere in any directory entry
|
||||
my @directory = unpack( "A3 A4 A5" x $nfields, $dir );
|
||||
my @bad = grep /\D/, @directory;
|
||||
if ( @bad ) {
|
||||
return $marc->_gripe( "Non-numeric entries in the tag directory: ", join( ", ", map { "\"$_\"" } @bad ) );
|
||||
}
|
||||
|
||||
my $databytesused = 0;
|
||||
while ( @directory ) {
|
||||
my $tagno = shift @directory;
|
||||
my $len = shift @directory;
|
||||
my $offset = shift @directory;
|
||||
my $tagdata = shift @fields;
|
||||
|
||||
# Check directory validity
|
||||
($tagno =~ /^\d\d\d$/)
|
||||
or return $marc->_gripe( "Invalid field number in directory: \"$tagno\"" );
|
||||
|
||||
($len == length($tagdata) + 1)
|
||||
or $marc->_warn( "Invalid length in the directory for tag $tagno" );
|
||||
|
||||
($offset == $databytesused)
|
||||
or $marc->_warn( "Directory offsets are out of whack" );
|
||||
$databytesused += $len;
|
||||
|
||||
if ( $tagno < 10 ) {
|
||||
$marc->add_fields( $tagno, $tagdata )
|
||||
or return undef; # We're relying on add_fields() having set $MARC::Record::ERROR
|
||||
} else {
|
||||
my @subfields = split( SUBFIELD_INDICATOR, $tagdata );
|
||||
my $indicators = shift @subfields
|
||||
or return $marc->_gripe( "No subfields found." );
|
||||
my ($ind1,$ind2);
|
||||
if ( $indicators =~ /^([0-9 ])([0-9 ])$/ ) {
|
||||
($ind1,$ind2) = ($1,$2);
|
||||
} else {
|
||||
$marc->_warn( "Invalid indicators \"$indicators\" forced to blanks\n" );
|
||||
($ind1,$ind2) = (" "," ");
|
||||
}
|
||||
|
||||
# Split the subfield data into subfield name and data pairs
|
||||
my @subfield_data = map { (substr($_,0,1),substr($_,1)) } @subfields;
|
||||
$marc->add_fields( $tagno, $ind1, $ind2, @subfield_data )
|
||||
or return undef;
|
||||
}
|
||||
} # while
|
||||
|
||||
# Once we're done, there shouldn't be any fields left over: They should all have shifted off.
|
||||
(@fields == 0)
|
||||
or return $marc->_gripe( "I've got leftover fields that weren't in the directory" );
|
||||
|
||||
return $marc;
|
||||
}
|
||||
|
||||
=head2 update_leader()
|
||||
|
||||
If any changes get made to the MARC record, the first 5 bytes of the
|
||||
leader (the length) will be invalid. This function updates the
|
||||
leader with the correct length of the record as it would be if
|
||||
written out to a file.
|
||||
|
||||
=cut
|
||||
|
||||
sub update_leader() {
|
||||
my $self = shift;
|
||||
|
||||
my (undef,undef,$reclen,$baseaddress) = $self->_build_tag_directory();
|
||||
|
||||
$self->_set_leader_lengths( $reclen, $baseaddress );
|
||||
}
|
||||
|
||||
=head2 _build_tag_directory()
|
||||
|
||||
Function for internal use only: Builds the tag directory that gets
|
||||
put in front of the data in a MARC record.
|
||||
|
||||
Returns two array references, and two lengths: The tag directory, and the data fields themselves,
|
||||
the length of all data (including the Leader that we expect will be added),
|
||||
and the size of the Leader and tag directory.
|
||||
|
||||
=cut
|
||||
|
||||
sub _build_tag_directory {
|
||||
my $marc = shift;
|
||||
$marc = shift if (ref($marc)||$marc) =~ /^MARC::File/;
|
||||
die "Wanted a MARC::Record but got a ", ref($marc) unless ref($marc) eq "MARC::Record";
|
||||
|
||||
my @fields;
|
||||
my @directory;
|
||||
|
||||
my $dataend = 0;
|
||||
for my $field ( $marc->fields() ) {
|
||||
# Dump data into proper format
|
||||
my $str = $field->as_usmarc;
|
||||
push( @fields, $str );
|
||||
|
||||
# Create directory entry
|
||||
my $len = length $str;
|
||||
my $direntry = sprintf( "%03d%04d%05d", $field->tag, $len, $dataend );
|
||||
push( @directory, $direntry );
|
||||
$dataend += $len;
|
||||
}
|
||||
|
||||
my $baseaddress =
|
||||
LEADER_LEN + # better be 24
|
||||
( @directory * DIRECTORY_ENTRY_LEN ) +
|
||||
# all the directory entries
|
||||
1; # end-of-field marker
|
||||
|
||||
|
||||
my $total =
|
||||
$baseaddress + # stuff before first field
|
||||
$dataend + # Length of the fields
|
||||
1; # End-of-record marker
|
||||
|
||||
|
||||
|
||||
return (\@fields, \@directory, $total, $baseaddress);
|
||||
}
|
||||
|
||||
=head2 encode()
|
||||
|
||||
Returns a string of characters suitable for writing out to a USMARC file,
|
||||
including the leader, directory and all the fields.
|
||||
|
||||
=cut
|
||||
|
||||
sub encode() {
|
||||
my $marc = shift;
|
||||
$marc = shift if (ref($marc)||$marc) =~ /^MARC::File/;
|
||||
|
||||
my ($fields,$directory,$reclen,$baseaddress) = _build_tag_directory($marc);
|
||||
$marc->set_leader_lengths( $reclen, $baseaddress );
|
||||
|
||||
# Glomp it all together
|
||||
return join("",$marc->leader, @$directory, END_OF_FIELD, @$fields, END_OF_RECORD);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 RELATED MODULES
|
||||
|
||||
L<MARC::Record>
|
||||
|
||||
=head1 TODO
|
||||
|
||||
Make some sort of autodispatch so that you don't have to explicitly
|
||||
specify the MARC::File::X subclass, sort of like how DBI knows to
|
||||
use DBD::Oracle or DBD::Mysql.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
This code may be distributed under the same terms as Perl itself.
|
||||
|
||||
Please note that these modules are not products of or supported by the
|
||||
employers of the various contributors to the code.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Andy Lester, E<lt>marc@petdance.comE<gt> or E<lt>alester@flr.follett.comE<gt>
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -9,19 +9,86 @@ my $fields;
|
|||
marcdefs();
|
||||
my $tag;
|
||||
my $subfield;
|
||||
$dbh->do("delete from marc_tag_structure");
|
||||
$dbh->do("delete from marc_subfield_structure");
|
||||
my $reqtag=$dbh->prepare("insert into marc_tag_structure (tagfield,liblibrarian,repeatable) values (?,?,?)");
|
||||
my $reqsubfield=$dbh->prepare("insert into marc_subfield_structure (tagfield,tagsubfield,liblibrarian,repeatable) values (?,?,?,?)");
|
||||
my $description;
|
||||
foreach $tag (sort keys %$fields) {
|
||||
$reqtag->execute($tag,$fields->{$tag}->{"name"},$fields->{$tag}->{"repeating"});
|
||||
foreach $subfield (sort keys %{$fields->{$tag}->{"subfields"}}) {
|
||||
$reqsubfield->execute(
|
||||
$tag,
|
||||
$subfield,
|
||||
$fields->{$tag}->{"subfields"}->{$subfield}->{"description"}?$fields->{$tag}->{"subfields"}->{$subfield}->{"description"}:"Unknown",
|
||||
$fields->{$tag}->{"subfields"}->{$subfield}->{"repeating"}
|
||||
);
|
||||
if ($fields->{$tag}->{"subfields"}->{$subfield}->{"description"}) {
|
||||
$description=$fields->{$tag}->{"subfields"}->{$subfield}->{"description"};
|
||||
} else {
|
||||
$description=$fields->{$tag}->{"subfields"}->{$subfield}->{"name"};
|
||||
}
|
||||
$reqsubfield->execute(
|
||||
$tag,
|
||||
$subfield,
|
||||
$description?$description:"Unknown",
|
||||
$fields->{$tag}->{"subfields"}->{$subfield}->{"repeating"}
|
||||
);
|
||||
}
|
||||
}
|
||||
#---- now we populate the tables with the link between koha-DB and MARC-DB
|
||||
# items
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.title' where tagfield='245' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.subtitle' where tagfield='245' and tagsubfield='b'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.unititle' where tagfield='246' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.seriestitle' where tagfield='440' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.copyrightdate' where tagfield='245' and tagsubfield='f'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.copyrightdate' where tagfield='260' and tagsubfield='c'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.notes' where tagfield='504' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.author' where tagfield='100' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.author' where tagfield='100' and tagsubfield='b'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.author' where tagfield='100' and tagsubfield='c'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.author' where tagfield='100' and tagsubfield='d'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.subject' where tagfield='650' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblio.biblionumber' where tagfield='090' and tagsubfield='c'");
|
||||
# biblioitems
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.biblioitemnumber' where tagfield='090' and tagsubfield='d'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.volume' where tagfield='440' and tagsubfield='v'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.number' where tagfield='440' and tagsubfield='n'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.itemtype' where tagfield='852' and tagsubfield='k'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.isbn' where tagfield='020' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.issn' where tagfield='022' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.dewey' where tagfield='082' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.subclass' where tagfield='852' and tagsubfield='m'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.place' where tagfield='260' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.publishercode' where tagfield='260' and tagsubfield='b'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.publicationyear' where tagfield='260' and tagsubfield='c'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.pages' where tagfield='300' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.size' where tagfield='300' and tagsubfield='c'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.notes' where tagfield='500' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.lccn' where tagfield='010' and tagsubfield='a'");
|
||||
# items
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.itemnumber' where tagfield='890' and tagsubfield='c'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.multivolumepart' where tagfield='XXX' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.barcode' where tagfield='852' and tagsubfield='p'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.dateaccessioned' where tagfield='876' and tagsubfield='d'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.booksellerid' where tagfield='876' and tagsubfield='e'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.homebranch' where tagfield='876' and tagsubfield='b'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.replacementprice' where tagfield='876' and tagsubfield='c'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.price' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.replacementpricedate' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.datelastborrowed' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.datelastseen' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.multivolume' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.stack' where tagfield='XXX' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.notforloan' where tagfield='876' and tagsubfield='h'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.itemlost' where tagfield='876' and tagsubfield='j'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.wthdrawn' where tagfield='876' and tagsubfield='k'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.bulk' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.issues' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.renewals' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.reserves' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.restricted' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.binding' where tagfield='XXX' and tagsubfield='a'");
|
||||
$dbh->do("update marc_subfield_structure set kohafield='items.itemnotes' where tagfield='876' and tagsubfield='z'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.holdingbranch' where tagfield='XXX' and tagsubfield='a'");
|
||||
#$dbh->do("update marc_subfield_structure set kohafield='items.interim' where tagfield='XXX' and tagsubfield='a'");
|
||||
# additional authors
|
||||
$dbh->do("update marc_subfield_structure set kohafield='additionalauthors.additionalauthors' where tagfield='700' and tagsubfield='a'");
|
||||
|
||||
sub marcdefs {
|
||||
$fields->{'010'}->{"name"}="LIBRARY OF CONGRESS CONTROL NUMBER";
|
||||
|
|
@ -5249,13 +5316,13 @@ sub marcdefs {
|
|||
$fields->{'090'}->{'repeating'}=1;
|
||||
$fields->{'090'}->{'firstindicator'}="Undefined";
|
||||
$fields->{'090'}->{'secondindicator'}="Undefined";
|
||||
$fields->{'090'}->{'subfields'}->{"a"}->{'name'}="Itemtype (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"a"}->{'name'}="Koha Itemtype (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"a"}->{'repeating'}=0;
|
||||
$fields->{'090'}->{'subfields'}->{"b"}->{'name'}="Dewey Subclass (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"b"}->{'name'}="Koha Dewey Subclass (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"b"}->{'repeating'}=0;
|
||||
$fields->{'090'}->{'subfields'}->{"c"}->{'name'}="biblionumber (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"c"}->{'name'}="Koha biblionumber (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"c"}->{'repeating'}=0;
|
||||
$fields->{'090'}->{'subfields'}->{"d"}->{'name'}="biblioitemnumber (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"d"}->{'name'}="Koha biblioitemnumber (NR)";
|
||||
$fields->{'090'}->{'subfields'}->{"d"}->{'repeating'}=0;
|
||||
$fields->{'091'}->{'name'}="MICROFILM SHELF LOCATION (AM) [OBSOLETE]";
|
||||
$fields->{'091'}->{'repeating'}=1;
|
||||
|
|
@ -9812,6 +9879,8 @@ sub marcdefs {
|
|||
$fields->{'876'}->{'subfields'}->{"l"}->{'repeating'}=1;
|
||||
$fields->{'876'}->{'subfields'}->{"p"}->{'name'}="Piece designation (R)";
|
||||
$fields->{'876'}->{'subfields'}->{"p"}->{'repeating'}=1;
|
||||
$fields->{'876'}->{'subfields'}->{"z"}->{'name'}="Note (R)";
|
||||
$fields->{'876'}->{'subfields'}->{"z"}->{'repeating'}=1;
|
||||
$fields->{'876'}->{'subfields'}->{"8"}->{'name'}="Field link and sequence number (R)";
|
||||
$fields->{'876'}->{'subfields'}->{"8"}->{'repeating'}=1;
|
||||
$fields->{'877'}->{'name'}="ITEM INFORMATION--SUPPLEMENTARY MATERIAL (R)";
|
||||
|
|
@ -9841,6 +9910,12 @@ sub marcdefs {
|
|||
$fields->{'886'}->{'subfields'}->{"b"}->{'repeating'}=0;
|
||||
$fields->{'886'}->{'subfields'}->{"2"}->{'name'}="Source of data (NR) $a-z - Foreign MARC subfield (R) $0-9 - Foreign MARC subfield (R)";
|
||||
$fields->{'886'}->{'subfields'}->{"2"}->{'repeating'}=0;
|
||||
$fields->{'890'}->{'name'}="KOHA item number";
|
||||
$fields->{'890'}->{'repeating'}=1;
|
||||
$fields->{'890'}->{'firstindicator'}="Undefined";
|
||||
$fields->{'890'}->{'secondindicator'}="Undefined";
|
||||
$fields->{'890'}->{'subfields'}->{"c"}->{'name'}="Koha biblio number";
|
||||
$fields->{'890'}->{'subfields'}->{"c"}->{'repeating'}=1;
|
||||
;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,19 @@
|
|||
# $Id$
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.15 2002/07/24 15:52:53 tipaul
|
||||
# 1st scripts for MARC-DB.
|
||||
#
|
||||
# WARNING : YOU MUST DO THE FOLLOWING IF YOU EXPECT THE MAIN-BRANCH TO WORK.
|
||||
#
|
||||
# * install MARC::Record package, from cpan or sourceforge
|
||||
# * OVERWRITE File.pm and USMARC.pm. The original misses 1 functionnality we absolutly need in koha (reading a MARC from a variable, not from a file). Thanks to Steve, who modified MARC::Record.
|
||||
# * modify your DB by adding marcschema.sql tables
|
||||
# * populate new tables by launching fill_usmarc.pl
|
||||
#
|
||||
# Then, it should work...
|
||||
# What works exactly will come in the next commit, in a few minuts (hitchcock suspens...)
|
||||
#
|
||||
# Revision 1.14 2002/06/04 08:13:31 tipaul
|
||||
# ouuppsss... forget the 1.13 version, i made a mistake. This version works and should be the last
|
||||
#
|
||||
|
|
@ -26,11 +39,13 @@
|
|||
# marc_biblio contains 1 record for each biblio in the DB
|
||||
CREATE TABLE marc_biblio (
|
||||
bibid bigint(20) unsigned NOT NULL auto_increment,
|
||||
biblionumber int(20) unsigned NOT NULL,
|
||||
datecreated date NOT NULL default '0000-00-00',
|
||||
datemodified date default NULL,
|
||||
origincode char(20) default NULL,
|
||||
PRIMARY KEY (bibid),
|
||||
KEY origincode (origincode)
|
||||
KEY origincode (origincode),
|
||||
KEY biblionumber (biblionumber)
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE marc_subfield_table (
|
||||
|
|
|
|||
Loading…
Reference in New Issue