From d0918e2691122234a563a7d14ba9eb9e6d32777a Mon Sep 17 00:00:00 2001 From: amillar Date: Sun, 9 Jun 2002 20:40:59 +0000 Subject: [PATCH] Minor cleanups and comments --- acqui.simple/marcimport.pl | 62 +++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/acqui.simple/marcimport.pl b/acqui.simple/marcimport.pl index 4590640d9b..4767e30210 100755 --- a/acqui.simple/marcimport.pl +++ b/acqui.simple/marcimport.pl @@ -91,7 +91,7 @@ my @tagmaplist=( ['022', 'a', 'issn', 0 ], ['082', 'a', 'dewey', 0 ], ['100', 'a', 'author', 0 ], - ['245', 'a', 'title', 0 ], + ['245', 'a', 'title', 0, ':;' ], ['245', 'b', 'subtitle', 0 ], ['260', 'a', 'place', 0, ':' ], ['260', 'b', 'publisher', 0, ':' ], @@ -225,8 +225,8 @@ RECORD: my ( $bib, # hash ref to named fields $fieldlist, # list ref - $lccn, $isbn, $issn, $dewey, $author, - $place, $publisher, $publicationyear, $volume, + $lccn, $isbn, $issn, $dewey, + $publisher, $publicationyear, $volume, $number, @subjects, $notes, $additionalauthors, $copyrightdate, $seriestitle, $origisbn, $origissn, $origlccn, $origcontrolnumber, @@ -273,8 +273,6 @@ RECORD: $lccn =$bib->{lccn}; $isbn =$bib->{isbn}; $issn =$bib->{issn}; - $author =$bib->{author}; - $place =$bib->{place}; $publisher =$bib->{publisher}; $publicationyear =$bib->{publicationyear}; $copyrightdate =$bib->{copyrightdate}; @@ -288,7 +286,7 @@ RECORD: $titleinput=$input->textfield(-name=>'title', -default=>$bib->{title}, -size=>40); $marcinput=$input->hidden(-name=>'marc', -default=>$marc); $subtitleinput=$input->textfield(-name=>'subtitle', -default=>$bib->{subtitle}, -size=>40); - $authorinput=$input->textfield(-name=>'author', -default=>$author); + $authorinput=$input->textfield(-name=>'author', -default=>$bib->{author}); $illustratorinput=$input->textfield(-name=>'illustrator', -default=>$bib->{illustrator}); $additionalauthorsinput=$input->textarea(-name=>'additionalauthors', -default=>$additionalauthors, -rows=>4, -cols=>20); @@ -314,12 +312,12 @@ RECORD: $lccninput=$input->textfield(-name=>'lccn', -default=>$lccn); $isbninput=$input->textfield(-name=>'isbn', -default=>$isbn); $deweyinput=$input->textfield(-name=>'dewey', -default=>$bib->{dewey}); - $cleanauthor=$author; + $cleanauthor=$bib->{author}; $cleanauthor=~s/[^A-Za-z]//g; $subclassinput=$input->textfield(-name=>'subclass', -default=>uc(substr($cleanauthor,0,3))); $publisherinput=$input->textfield(-name=>'publishercode', -default=>$publisher); $pubyearinput=$input->textfield(-name=>'publicationyear', -default=>$publicationyear); - $placeinput=$input->textfield(-name=>'place', -default=>$place); + $placeinput=$input->textfield(-name=>'place', -default=>$bib->{place}); $pagesinput=$input->textfield(-name=>'pages', -default=>$bib->{pages}); $sizeinput=$input->textfield(-name=>'size', -default=>$bib->{size}); $fileinput=$input->hidden(-name=>'file', -default=>$file); @@ -329,7 +327,7 @@ RECORD: $origcontrolnumber=$input->hidden(-name=>'origcontrolnumber', -default=>$controlnumber); #print "
getting itemtypeselect
\n"; - $itemtypeselect=&GetKeyTableSelectOptions( + $itemtypeselect=&getkeytableselectoptions( $dbh, 'itemtypes', 'itemtype', 'description', 1); #print "
it=$itemtypeselect
\n"; @@ -417,26 +415,32 @@ sub ListSearchResults { # if z3950 results if ($file=~/Z-(\d+)/) { + # This is a z3950 search $recordsource=''; } else { + # This is a Marc upload my $sth=$dbh->prepare("select marc,name from uploadedmarc where id=$file"); $sth->execute; ($data, $name) = $sth->fetchrow; $recordsource="from $name"; } - print << "EOF"; -
-

- Select a New File -

- - -
- Select a Record to Import $recordsource -
+ + print << "EOF"; +
+

+ Select a New File +

+ + +
+ Select a Record to Import $recordsource +
EOF + if ($file=~/Z-(\d+)/) { - my $id=$1; + # This is a z3950 search + + my $id=$1; # search results id number my $sth=$dbh->prepare("select servers from z3950queue where id=$id"); $sth->execute; my ($servers) = $sth->fetchrow; @@ -494,8 +498,10 @@ EOF print "
\n"; } print "
    \n"; - my $stj=$dbh->prepare("update z3950results set highestseen=".($startrecord+10)." where id=$resultsid"); - $stj->execute; + my $stj=$dbh->prepare("update z3950results + set highestseen=? where id=?"); + $stj->execute($startrecord+10,$resultsid); + if ($sti->rows == 0) { print "pending..."; } elsif ($enddate == 0) { @@ -532,7 +538,8 @@ EOF my $elapsed=time()-$starttimer; print "
    It took $elapsed seconds to process this page.\n"; } else { - + # This is an uploaded Marc record + my @records=parsemarcfileformat($data); foreach $record (@records) { @@ -602,6 +609,7 @@ sub extractmarcfields { # return my $bib; # pointer to hash of named output fields + # Example: $bib->{'author'} = "Twain, Mark"; my $debug=0; @@ -1261,7 +1269,7 @@ sub ItemCopyForm { $barcode=int(rand()*1000000); } - my $branchselect=GetKeyTableSelectOptions( + my $branchselect=getkeytableselectoptions( $dbh, 'branches', 'branchcode', 'branchname', 0); print << "EOF"; @@ -1336,7 +1344,7 @@ sub AcceptItemCopy { #--------------- # Create an HTML option list for a