[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-devel] CVS: koha/acqui.simple bulkmarcimport.pl,1.2,1.3
From: |
Steve Tonnesen |
Subject: |
[Koha-devel] CVS: koha/acqui.simple bulkmarcimport.pl,1.2,1.3 |
Date: |
Tue Apr 16 12:56:00 2002 |
Update of /cvsroot/koha/koha/acqui.simple
In directory usw-pr-cvs1:/tmp/cvs-serv26816
Modified Files:
bulkmarcimport.pl
Log Message:
Added some comments detailing how MARC fields are mapped to Koha data
Index: bulkmarcimport.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui.simple/bulkmarcimport.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** bulkmarcimport.pl 16 Apr 2002 18:00:39 -0000 1.2
--- bulkmarcimport.pl 16 Apr 2002 19:49:15 -0000 1.3
***************
*** 99,108 ****
close F;
$splitchar=chr(29);
RECORD:
foreach $record (split(/$splitchar/, $data)) {
- my $marctext="<table border=0 cellspacing=0>\n";
- $marctext.="<tr><th colspan=3 bgcolor=black><font color=white>MARC
RECORD</font></th></tr>\n";
$leader=substr($record,0,24);
- $marctext.="<tr><td>Leader:</td><td colspan=2>$leader</td></tr>\n";
print
"\n\n---------------------------------------------------------------------------\n";
print "Leader: $leader\n";
--- 99,110 ----
close F;
$splitchar=chr(29);
+
+
+ # Cycle through all of the records in the file
+
+
RECORD:
foreach $record (split(/$splitchar/, $data)) {
$leader=substr($record,0,24);
print
"\n\n---------------------------------------------------------------------------\n";
print "Leader: $leader\n";
***************
*** 116,121 ****
foreach $field (split(/$splitchar2/, $record)) {
my %field;
- ($color eq $lc1) ? ($color=$lc2) : ($color=$lc1);
unless ($directory) {
$directory=$field;
my $itemcounter=1;
--- 118,123 ----
foreach $field (split(/$splitchar2/, $record)) {
my %field;
unless ($directory) {
+ # Parse the MARC directory and store the cotents in the %tag
hash
$directory=$field;
my $itemcounter=1;
***************
*** 135,139 ****
$tagcounter++;
$field{'tag'}=$tag;
- $marctext.="<tr><td bgcolor=$color
valign=top>$tagtext{$tag}</td><td bgcolor=$color valign=top>$tag</td>";
printf "%4s %-40s ",$tag, $tagtext{$tag};
$splitchar3=chr(31);
--- 137,140 ----
***************
*** 143,159 ****
my $firstline=1;
if ($#subfields==0) {
- $marctext.="<td bgcolor=$color valign=top>$indicator</td></tr>";
print "$indicator\n";
} else {
print "\n";
my %subfields;
- $marctext.="<td bgcolor=$color valign=top><table border=0
cellspacing=0>\n";
- my $color2=$color;
for ($i=1; $i<=$#subfields; $i++) {
- ($color2 eq $lc1) ? ($color2=$lc2) : ($color2=$lc1);
my $text=$subfields[$i];
my $subfieldcode=substr($text,0,1);
my $subfield=substr($text,1);
- $marctext.="<tr><td colour=$color2><table border=0
cellpadding=0 cellspacing=0><tr><td>$subfieldcode </td></tr></table></td><td
colour=$color2>$subfield</td></tr>\n";
print " $subfieldcode $subfield\n";
if ($subfields{$subfieldcode}) {
--- 144,155 ----
***************
*** 170,174 ****
}
}
- $marctext.="</table></td></tr>\n";
$field{'subfields'}=\%subfields;
}
--- 166,169 ----
***************
*** 187,191 ****
push (@record, \%field);
}
- $marctext.="</table>\n";
address@hidden;
$counter++;
--- 182,185 ----
***************
*** 193,197 ****
my $marc=$record;
foreach $field (sort {$a->{'tag'} cmp $b->{'tag'}} @$rec) {
! #print $field->{'tag'}." ".$field->{'subfields'}->{'a'}."\n";
if ($field->{'tag'} eq '010') {
$lccn=$field->{'subfields'}->{'a'};
--- 187,191 ----
my $marc=$record;
foreach $field (sort {$a->{'tag'} cmp $b->{'tag'}} @$rec) {
! # LCCN is stored in field 010 a
if ($field->{'tag'} eq '010') {
$lccn=$field->{'subfields'}->{'a'};
***************
*** 201,204 ****
--- 195,199 ----
($lccn) = (split(/\s+/, $lccn))[0];
}
+ # LCCN is stored in field 015 a
if ($field->{'tag'} eq '015') {
$lccn=$field->{'subfields'}->{'a'};
***************
*** 207,210 ****
--- 202,206 ----
($lccn) = (split(/\s+/, $lccn))[0];
}
+ # ISBN is stored in field 020 a
if ($field->{'tag'} eq '020') {
$isbn=$field->{'subfields'}->{'a'};
***************
*** 212,215 ****
--- 208,212 ----
($isbn) = (split(/\s+/, $isbn))[0];
}
+ # ISSN is stored in field 022 a
if ($field->{'tag'} eq '022') {
$issn=$field->{'subfields'}->{'a'};
***************
*** 217,232 ****
($issn) = (split(/\s+/, $issn))[0];
}
if ($field->{'tag'} eq '082') {
$dewey=$field->{'subfields'}->{'a'};
- print "DEWEY: $dewey\n";
$dewey=~s/\///g;
if (@$dewey) {
$dewey=$$dewey[0];
}
- #$dewey=~s/\///g;
}
if ($field->{'tag'} eq '100') {
$author=$field->{'subfields'}->{'a'};
}
if ($field->{'tag'} eq '245') {
$title=$field->{'subfields'}->{'a'};
--- 214,234 ----
($issn) = (split(/\s+/, $issn))[0];
}
+ # Dewey number stored in field 082 a
+ # If there is more than one dewey number (more than one 'a'
+ # subfield) I just take the first one
if ($field->{'tag'} eq '082') {
$dewey=$field->{'subfields'}->{'a'};
$dewey=~s/\///g;
if (@$dewey) {
$dewey=$$dewey[0];
}
}
+ # Author is stored in field 100 a
if ($field->{'tag'} eq '100') {
$author=$field->{'subfields'}->{'a'};
}
+ # Title is stored in field 245 a
+ # Subtitle in field 245 b
+ # Illustrator in field 245 c
if ($field->{'tag'} eq '245') {
$title=$field->{'subfields'}->{'a'};
***************
*** 239,242 ****
--- 241,249 ----
}
}
+ # Publisher Info in field 260
+ # a = place
+ # b = publisher
+ # c = publication date
+ # (also store as copyright date if date starts with a 'c' as in
c1995)
if ($field->{'tag'} eq '260') {
$place=$field->{'subfields'}->{'a'};
***************
*** 263,266 ****
--- 270,276 ----
}
}
+ # Physical Dimensions in field 300
+ # a = pages
+ # c = size
if ($field->{'tag'} eq '300') {
$pages=$field->{'subfields'}->{'a'};
***************
*** 270,273 ****
--- 280,284 ----
$size=~s/\s*:$//g;
}
+ # Vol/No in field 362 a
if ($field->{'tag'} eq '362') {
if ($field->{'subfields'}->{'a'}=~/(\d+).*(\d+)/) {
***************
*** 276,279 ****
--- 287,292 ----
}
}
+ # Series Title in field 440 a
+ # Vol/No in field 440 v
if ($field->{'tag'} eq '440') {
$seriestitle=$field->{'subfields'}->{'a'};
***************
*** 283,290 ****
}
}
if ($field->{'tag'} eq '852') {
$barcode=$field->{'subfields'}->{'p'};
push (@barcodes, $barcode);
- print "BARCODE: $barcode\n";
my $q_barcode=$dbh->quote($barcode);
my $deweyfield=$field->{'subfields'}->{'h'};
--- 296,309 ----
}
}
+ # BARCODES!!!
+ # 852 p stores barcodes
+ # 852 h stores dewey field
+ # 852 9 stores replacement price
+ # I check for an itemtype identifier in 852h as well... pb or pbk
means PBK
+ # also if $dewey is > 0, then I assign JNF, otherwise JF.
+ # Note that my libraries are school libraries, so I assume Junior.
if ($field->{'tag'} eq '852') {
$barcode=$field->{'subfields'}->{'p'};
push (@barcodes, $barcode);
my $q_barcode=$dbh->quote($barcode);
my $deweyfield=$field->{'subfields'}->{'h'};
***************
*** 300,305 ****
$replacementprice=$field->{'subfields'}->{'9'};
- #print "BC: $barcode, $title, $author\n";
}
if ($field->{'tag'} eq '700') {
my $name=$field->{'subfields'}->{'a'};
--- 319,325 ----
$replacementprice=$field->{'subfields'}->{'9'};
}
+ # 700 a stores additional authors / illustrator info
+ # 700 c will contain 'ill' if it's an illustrator
if ($field->{'tag'} eq '700') {
my $name=$field->{'subfields'}->{'a'};
***************
*** 310,316 ****
--- 330,343 ----
}
}
+ # I concatenate all 5XX a entries as notes
if ($field->{'tag'} =~/^5/) {
$note.="$field->{'subfields'}->{'a'}\n";
}
+ # 6XX entries are subject entries
+ # Not sure why I'm skipping 691 tags
+ # 691 a contains the subject.
+ # I take subfield a, and append entries from subfield x (general
+ # subdivision) y (Chronological subdivision) and z (geographic
+ # subdivision)
if ($field->{'tag'} =~/6\d\d/) {
(next) if ($field->{'tag'} eq '691');
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-devel] CVS: koha/acqui.simple bulkmarcimport.pl,1.2,1.3,
Steve Tonnesen <=