From 72a30eee9d671e4a81b281fd6d413990abf67c43 Mon Sep 17 00:00:00 2001 From: tonnesen Date: Fri, 5 Oct 2001 21:19:29 +0000 Subject: [PATCH] Added simple acquisitions script --- acqui.simple/addbooks.pl | 390 ++ acqui.simple/viewmarc.pl | 10250 +++++++++++++++++++++++++++++++++++++ 2 files changed, 10640 insertions(+) create mode 100755 acqui.simple/addbooks.pl create mode 100755 acqui.simple/viewmarc.pl diff --git a/acqui.simple/addbooks.pl b/acqui.simple/addbooks.pl new file mode 100755 index 0000000000..50efdd7c6b --- /dev/null +++ b/acqui.simple/addbooks.pl @@ -0,0 +1,390 @@ +#!/usr/bin/perl + +# +# TODO +# +# Add info on biblioitems and items already entered as you enter new ones +# + +use C4::Database; +use CGI; +use strict; +use C4::Acquisitions; +use C4::Output; + + +my $input = new CGI; +my $dbh=C4Connect; + + +my $isbn=$input->param('isbn'); +my $q_isbn=$dbh->quote($isbn); +my $biblioitemnumber; + +print $input->header; +print startpage(); +print startmenu('acquisitions'); + +($input->param('checkforbiblio')) && (checkforbiblio()); +($input->param('newbiblioitem')) && (newbiblioitem()); +($input->param('newitem')) && (newitem()); + +sub checkforbiblio { + my $title=$input->param('title'); + my $q_title=$dbh->quote($title); + my $author=$input->param('author'); + my $q_author=$dbh->quote($author); + my $seriestitle=$input->param('seriestitle'); + my $serial=0; + ($seriestitle) && ($serial=1); + my $q_seriestitle=$dbh->quote($seriestitle); + my $copyrightdate=$input->param('copyrightdate'); + my $q_copyrightdate=$dbh->quote($copyrightdate); + my $notes=$input->param('notes'); + my $q_notes=$dbh->quote($notes); + my $subtitle=$input->param('subtitle'); + my $q_subtitle=$dbh->quote($subtitle); + my $sth=$dbh->prepare("select biblionumber from biblio where title=$q_title + and author=$q_author and copyrightdate=$q_copyrightdate"); + $sth->execute; + my $biblionumber=0; + if ($sth->rows) { + ($biblionumber) = $sth->fetchrow; + } else { + print "Adding new biblio for $title by $author
\n"; + my $sth=$dbh->prepare("select max(biblionumber) from biblio"); + $sth->execute; + ($biblionumber) = $sth->fetchrow; + $biblionumber++; + $sth=$dbh->prepare("insert into biblio (biblionumber, title, author, + serial, seriestitle, copyrightdate, notes) values ($biblionumber, + $q_title, $q_author, $serial, $q_seriestitle, $q_copyrightdate, + $q_notes)"); + $sth->execute; + $sth=$dbh->prepare("insert into bibliosubtitle (subtitle, biblionumber) + values ($q_subtitle, $biblionumber)"); + $sth->execute; + } + my $itemtypeselect=''; + $sth=$dbh->prepare("select itemtype,description from itemtypes"); + $sth->execute; + while (my ($itemtype, $description) = $sth->fetchrow) { + $itemtypeselect.="