From tonnesen@users.sourceforge.net Fri Nov 2 23:28:22 2001 From: Steve Tonnesen To: koha-devel@lists.koha-community.org Subject: [Koha-devel] CVS: koha/acqui.simple marcimport.pl,1.3,1.4 Date: Fri, 02 Nov 2001 23:29:02 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5424679455895792896==" --===============5424679455895792896== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Update of /cvsroot/koha/koha/acqui.simple In directory usw-pr-cvs1:/tmp/cvs-serv16947 Modified Files: marcimport.pl=20 Log Message: Z39.50 now stores list of servers to query in a database table. Index: marcimport.pl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/koha/koha/acqui.simple/marcimport.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** marcimport.pl 2001/11/02 21:21:25 1.3 --- marcimport.pl 2001/11/03 07:28:20 1.4 *************** *** 88,99 **** if (/S-(.*)/) { my $server=3D$1; - if ($server eq 'LOC') { - push @serverlist, "LOC/z3950.loc.gov:7090/voyager//"; - } - if ($server eq 'NLC') { - push @serverlist, "NLC/amicus.nlc-bnc.ca:210/AMICUS/bccms1/hawk5fad"; - } if ($server eq 'MAN') { push @serverlist, "MAN/".$input->param('manualz3950server')."//"; } } --- 88,98 ---- if (/S-(.*)/) { my $server=3D$1; if ($server eq 'MAN') { push @serverlist, "MAN/".$input->param('manualz3950server')."//"; + } else { + my $sth=3D$dbh->prepare("select host,port,db,userid,password from z3950se= rvers where id=3D$server"); + $sth->execute; + my ($host, $port, $db, $userid, $password) =3D $sth->fetchrow; + push @serverlist, "$server/$host\:$port/$db/$userid/$password"; } } *************** *** 278,281 **** --- 277,283 ---- my ($barcode) =3D $sth->fetchrow; $barcode++; + if ($barcode=3D=3D1) { + $barcode=3Dint(rand()*1000000); + } print << "EOF"; *************** *** 316,327 **** my $biblioitemnumber=3D$input->param('biblioitemnumber'); my $replacementprice=3D($input->param('replacementprice') || 0); ! my $sth=3D$dbh->prepare("select max(itemnumber) from items"); ! $sth->execute; ! my ($itemnumber) =3D $sth->fetchrow; ! $itemnumber++; ! my @datearr=3Dlocaltime(time); ! my $date=3D(1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3]; ! $sth=3D$dbh->prepare("insert into items (itemnumber, biblionumber, bibl= ioitemnumber, barcode, itemnotes, homebranch, holdingbranch, dateaccessioned,= replacementprice) values ($itemnumber, $biblionumber, $biblioitemnumber, $q_= barcode, $q_notes, $q_homebranch, 'STWE', '$date', $replacementprice)"); $sth->execute; } =20 --- 318,336 ---- my $biblioitemnumber=3D$input->param('biblioitemnumber'); my $replacementprice=3D($input->param('replacementprice') || 0); ! my $sth=3D$dbh->prepare("select barcode from items where ! barcode=3D$q_barcode"); $sth->execute; + if ($sth->rows) { + print "Barcode '$barcode' has already been assigned.

\n"; + } else { + $sth=3D$dbh->prepare("select max(itemnumber) from items"); + $sth->execute; + my ($itemnumber) =3D $sth->fetchrow; + $itemnumber++; + my @datearr=3Dlocaltime(time); + my $date=3D(1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3]; + $sth=3D$dbh->prepare("insert into items (itemnumber, biblionumber, biblioi= temnumber, barcode, itemnotes, homebranch, holdingbranch, dateaccessioned, re= placementprice) values ($itemnumber, $biblionumber, $biblioitemnumber, $q_bar= code, $q_notes, $q_homebranch, 'STWE', '$date', $replacementprice)"); + $sth->execute; + } } =20 *************** *** 689,698 **** foreach $serverstring (split(/\s+/, $servers)) { my ($name, $server, $database, $auth) =3D split(/\//, $serverstring, 4); ! if ($name eq 'LOC') { print "Library of Congress
\n"; } elsif ($name eq 'NLC') { print "National Library of Canada
\n"; } else { ! print "$server/$database
\n"; } print "

    \n"; --- 698,713 ---- foreach $serverstring (split(/\s+/, $servers)) { my ($name, $server, $database, $auth) =3D split(/\//, $serverstring, 4); ! if ($name eq 'MAN') { ! print "$server/$database
    \n"; ! } elsif ($name eq 'LOC') { print "Library of Congress
    \n"; } elsif ($name eq 'NLC') { print "National Library of Canada
    \n"; } else { ! my $sti=3D$dbh->prepare("select name from ! z3950servers where id=3D$name"); ! $sti->execute; ! my ($longname)=3D$sti->fetchrow; ! print "$longname
    \n"; } print "
      \n"; *************** *** 887,891 **** print "Main Menu
      \n"; print "
\n"; ! print "

Results of Z3950 searches

\n"; print "Refresh
\n
    = \n"; while (my ($id, $term, $type, $done, $numrecords, $length, $startdate, = $enddate, $servers) =3D $sth->fetchrow) { --- 902,906 ---- print "Main Menu
    \n"; print "
    \n"; ! print "

    Results of Z39.50 searches

    \n"; print "Refresh
    \n
      = \n"; while (my ($id, $term, $type, $done, $numrecords, $length, $startdate, = $enddate, $servers) =3D $sth->fetchrow) { *************** *** 921,924 **** --- 936,948 ---- print "
    \n"; print "
    \n"; + my $sth=3D$dbh->prepare("select id,name,checked from z3950servers order= by rank"); + $sth->execute; + my $serverlist=3D''; + while (my ($id, $name, $checked) =3D $sth->fetchrow) { + ($checked) ? ($checked=3D'checked') : ($checked=3D''); + $serverlist.=3D" $name
    \n"; + } + $serverlist.=3D" \n"; + =20 print << "EOF";
    *************** *** 927,937 ****

    !
    Search for MARC records
    LOC and NLC
    Query Term
    ISBN LCCN Title
    ! Library of Congress
    ! National Library of Canada=
    !
    --- 951,959 ----

    !
    Search for MARC records
    Query Term
    ISBN LCCN Title
    ! $serverlist
    --===============5424679455895792896==--