#!/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.="