scripts for new acqui.simple system
authortruth_nz <truth_nz>
Mon, 29 Apr 2002 05:29:02 +0000 (05:29 +0000)
committertruth_nz <truth_nz>
Mon, 29 Apr 2002 05:29:02 +0000 (05:29 +0000)
acqui.simple/addbiblio.pl [new file with mode: 0755]
acqui.simple/addbiblioitem.pl [new file with mode: 0755]
acqui.simple/additem.pl [new file with mode: 0755]
acqui.simple/isbnsearch.pl [new file with mode: 0755]
acqui.simple/keywordsearch.pl [new file with mode: 0755]
acqui.simple/savebiblio.pl [new file with mode: 0755]
acqui.simple/savebiblioitem.pl [new file with mode: 0755]
acqui.simple/saveitem.pl [new file with mode: 0755]
acqui.simple/websitesearch.pl [new file with mode: 0755]

diff --git a/acqui.simple/addbiblio.pl b/acqui.simple/addbiblio.pl
new file mode 100755 (executable)
index 0000000..18cdebc
--- /dev/null
@@ -0,0 +1,81 @@
+#!/usr/bin/perl
+
+#
+# TODO
+#
+# Add info on biblioitems and items already entered as you enter new ones
+#
+
+use CGI;
+use strict;
+use C4::Output;
+
+
+my $input = new CGI;
+my $error = $input->param('error');
+
+print $input->header;
+print startpage();
+print startmenu('acquisitions');
+
+print << "EOF";
+<FONT SIZE=6><em>Adding a new Biblio</em></FONT><br>
+  
+<table bgcolor="#ffcc00" width="80%" cellpadding="5">
+<tr>
+<td><FONT SIZE=5>Section One: Copyright Information </font></td>
+</tr>
+</table>
+EOF
+
+if ($error eq "notitle") {
+    print << "EOF";
+<p />
+<center>
+<font color="#FF0000">Please Specify a Title</font>
+</center>
+EOF
+} # if
+
+print << "EOF";
+<FORM action="savebiblio.pl" method="post">
+<table align="center">
+<tr>
+<td>Title: *</td>
+<td><INPUT name="title" size="40" /></td>
+</tr>
+<tr>
+<td>Subtitle:</td>
+<td><INPUT name="subtitle" size="40" /></td>
+</tr>
+<tr>
+<td>Author:</td>
+<td><INPUT name="author" size="40" /></td>
+</tr>
+    <tr valign="top">
+        <td>Series Title:<br />
+        <i>(if applicable)</i></td>
+        <td><INPUT name="seriestitle" size="40" /></td>
+    </tr>
+<tr>
+<td>Copyright Date:</td>
+<td><INPUT name="copyrightdate" size="40" /></td>
+</tr>
+<tr valign="top">
+<td>Abstract:</td>
+<td><textarea cols="30" rows="6" name="abstract"></textarea></td>
+</tr>
+    <tr valign="top">
+        <td>Notes:</td>
+        <td><textarea cols="30" rows="6" name="notes"></textarea></td>
+    </tr>
+<tr valign="top">
+<td colspan="2"><center><input type="submit" value="Submit"></center></td>
+</tr>
+</table>
+</FORM>
+* Required
+EOF
+
+print endmenu();
+print endpage();
diff --git a/acqui.simple/addbiblioitem.pl b/acqui.simple/addbiblioitem.pl
new file mode 100755 (executable)
index 0000000..6bb0cbe
--- /dev/null
@@ -0,0 +1,121 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+use C4::Output;
+
+my $input = new CGI;
+my $biblionumber = $input->param('biblionumber');
+my $title;
+my $count;
+my @results;
+
+if (! $biblionumber) {
+    print $input->redirect('addbooks.pl');
+} else {
+    
+    ($count, @results) = &getbiblio($biblionumber);
+    $title = @results[0]->{'title'};
+
+    print $input->header;
+    print startpage();
+    print startmenu('acquisitions');
+
+    print << "EOF";
+<font size="6"><em>Adding New Group Information - $title</em></font>
+<table bgcolor="#ffcc00" width="80%" cellpadding="5">
+<tr valign="center">
+<td><font size="5">Section Two: Publication information</font></td>
+</tr></table> 
+<p />
+<form action="savebiblioitem.pl" method="post">
+<input type="hidden" name="biblionumber" value="$biblionumber">
+<table align="center">
+<tr>
+<td align="right">Publisher:</td>
+<td colspan="3"><INPUT name="publishercode" size="40"></td>
+</tr>
+<tr>
+<td align="right">Publication Year:</td>
+<td><INPUT name="publicationyear" size="20"></td>
+<td align="right">Place of Publication:</td>
+<td><input name="place" size="20"></td>
+</tr>
+<tr>
+<td align="right">Illustrator:</td>
+<td colspan="3"><INPUT name="illus" size="40"></td>
+</tr>
+<tr>
+<td align="right">ISBN:</td>
+<td colspan="3"><input name="isbn" size="40"></td>
+</tr>
+<tr valign="top">
+<td align="right">Additional Authors:<br><i>One Author per line</i></td>
+<td colspan="3"><textarea name="additionalauthors" cols="30" rows="6"></textarea></td>
+</tr>
+<tr valign="top">
+<td align="right">Subject Headings:<br><i>One Subject per line</i></td>
+<td colspan="3"><textarea name="subjectheadings" cols="30" rows="6"></textarea></td>
+</tr>
+<tr>
+<td align="right">Format:</td>
+<td colspan="3"><select name="itemtype">
+EOF
+
+    ($count, @results) = &getitemtypes;
+    for (my $i = 0; $i < $count; $i++) {
+       print << "EOF";
+<option value="$results[$i]->{'itemtype'}">$results[$i]->{'itemtype'} - $results[$i]->{'description'}
+EOF
+    } # for
+
+    print << "EOF";
+</select></td>
+</tr>
+<tr>
+<td align="right">URL:</td>
+<td colspan="3"><INPUT name="url" size="40"></td>
+</tr>
+<tr>
+<td align="right">Dewey:</td>
+<td><INPUT name="dewey" size="20"></td>
+<td align="right">Dewey Subclass:</td>
+<td><input name="subclass" size="20"></td>
+</tr>
+<tr>
+<td align="right">ISSN:</td>
+<td><input name="issn" size="20"></td>
+<td align="right">LCCN:</td>
+<td><input name="lccn" size="20"</td>
+</tr>
+<tr>
+<td align="right">Volume:</td>
+<td><input name="volume" size="20"></td>
+<td align="right">Number:</td>
+<td><input name="number" size="20"></td>
+</tr>
+<tr>
+<td align="right">Volume Description:</td>
+<td colspan="3"><input name="volumeddesc" size="40"></td>
+</tr>
+<tr>
+<td align="right">Pages:</td>
+<td><input name="pages" size="20"></td>
+<td align="right">Size:</td>
+<td><input name="size" size="20"></td>
+</tr>
+<tr valign="top">
+<td align="right">Notes:</td>
+<td colspan="3"><textarea name="notes" cols="30" rows="6"></textarea></td>
+</tr>
+<tr valign="top">
+<td colspan="4" align="center"><input type="submit" value="Add New Item"></td>
+</tr>
+    
+  </table></FORM>
+EOF
+
+    print endmenu();
+    print endpage();
+} # else
diff --git a/acqui.simple/additem.pl b/acqui.simple/additem.pl
new file mode 100755 (executable)
index 0000000..4f7b142
--- /dev/null
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+use C4::Output;
+
+my $input = new CGI;
+my $biblioitemnum = $input->param('biblioitemnum');
+my $maxbarcode;
+my $isbn;
+my $count;
+my @results;
+
+if (! $biblioitemnum) {
+    print $input->redirect('addbooks.pl');
+} else {
+    
+    ($count, @results) = &getbiblioitem($biblioitemnum);
+    
+    if (! $count) {
+       print $input->redirect('addbooks.pl');
+    } else {
+       $isbn       = $results[0]->{'isbn'};
+       $maxbarcode = $results[0]->{'biblionumber'};
+  
+       print $input->header;
+       print startpage();
+       print startmenu('acquisitions');
+    
+       ($count, @results) = &getitemsbybiblioitem($biblioitemnum);
+
+       if ($count) {
+           print << "EOF";
+<center>
+<p>
+<table border=1 bgcolor=#dddddd>
+<tr>
+<th colspan=4>Existing Items with ISBN $isbn</th>
+</tr>
+<tr>
+<th>Barcode</th><th>Title</th><th>Author</th><th>Notes</th></tr>
+EOF
+
+           for (my $i = 0; $i < $count; $i++) {
+               print << "EOF";
+<tr>
+<td align=center>$results[$i]->{'barcode'}</td>
+<td><u>$results[$i]->{'title'}</u></td>
+<td>$results[$i]->{'author'}</td>
+<td>$results[$i]->{'itemnotes'}</td>
+</tr>
+EOF
+        } # for
+
+           print << "EOF";
+</table>
+</center>
+EOF
+       } # if
+
+       print << "EOF";
+<center>
+<h2>Section Three: Specific Item Information</h2>
+<form action="saveitems" method="post">
+<input type="hidden" name="biblioitemnum" value="$biblioitemnum">
+<table>
+<tr>
+<td align="right">BARCODE:</td>
+<td><input name="barcode" size="10" value="$maxbarcode" /></td>
+<td align="right">Home Branch:</td>
+<td><select name="homebranch"><option value="STWE">Stewart Elementary<option value="MEZ">Meziadin Elementary</select></td>
+</tr>
+<tr>
+<td align="right">Replacement Price:</td>
+<td colspan="3"><input name="replacementprice" size="10"></td>
+</tr>
+<tr valign="top">
+<td align="right">Notes:</td>
+<td colspan="3"><textarea name="notes" rows="4" cols="40" wrap="physical"></textarea></td>
+</tr>
+</table>
+<input type="submit" value="Add Item" />
+</form>
+</center>
+EOF
+    
+       print endmenu();
+       print endpage();
+    } # if
+} # if
diff --git a/acqui.simple/isbnsearch.pl b/acqui.simple/isbnsearch.pl
new file mode 100755 (executable)
index 0000000..5610c2d
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+
+my $input = new CGI;
+my $isbn  = $input->param('isbn');
+my $biblioitemnum;
+my $count;
+my @results;
+
+if (! $isbn) {
+    print $input->redirect('addbooks.pl');
+} else {
+
+    ($count, @results) = &isbnsearch($isbn);
+    if (! $count) {
+       print $input->redirect("addbooks.pl?error=notfound");
+    } else {
+
+       $biblioitemnum = $results[0]->{'biblioitemnumber'};
+       print $input->redirect("additem.pl?biblioitemnum=$biblioitemnum");
+
+    } # else
+} # else
diff --git a/acqui.simple/keywordsearch.pl b/acqui.simple/keywordsearch.pl
new file mode 100755 (executable)
index 0000000..247e446
--- /dev/null
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+use C4::Output;
+
+my $input    = new CGI;
+my $keywords = $input->param('keyword');
+my $offset   = $input->param('offset');
+my $num      = $input->param('num');
+my $total;
+my $count;
+my @results;
+
+if (! $keywords) {
+    print $input->redirect('addbooks.pl');
+} else {
+    if (! $offset) { $offset = 0 };
+    if (! $num) { $num = 10 };
+
+    ($count, @results) = &keywordsearch($keywords);
+
+    if ($count < ($offset + $num)) {
+        $total = $count;
+    } else {
+       $total = $offset + $num;
+    } # else
+
+    print $input->header;
+    print startpage();
+    print startmenu('acquisitions');
+
+    print << "EOF";
+<font size="6"><em>Biblio Search Results</em></font><br />
+<CENTER>
+You searched on <b>keywords $keywords,</b> $count results found <br />
+Results $offset to $total displayed
+<div align="right">
+<h2><a href="addbiblio.pl">Add New Biblio</a></h2>
+</div>
+<p />
+<table border="0" cellspacing="0" cellpadding="5">
+<tr valign=top bgcolor=#cccc99>
+<td background="/images/background-mem.gif"><b>TITLE</b></td>
+<td background="/images/background-mem.gif"><b>AUTHOR</b></td>
+<td background="/images/background-mem.gif"><b>&copy;</b></td>
+</tr>
+EOF
+
+    for (my $i = $offset; $i < $total; $i++) {
+       if ($i % 2) {
+           print << "EOF";
+<tr valign="top" bgcolor="#ffffcc">
+EOF
+       } else {
+           print << "EOF";
+<tr valign="top" bgcolor="#ffffff">
+EOF
+       } # else
+
+       print << "EOF";
+<td><a href="addbiblioitem.pl?biblionumber=$results[$i]->{'biblionumber'}">$results[$i]->{'title'}</a></td>
+<td><a href="addbiblioitem.pl?biblionumber=$results[$i]->{'biblionumber'}">$results[$i]->{'author'}</a></td>
+<td>$results[$i]->{'copyrightdate'}</td>
+</tr>
+EOF
+    } # for
+    print << "EOF";
+<tr valign=top bgcolor=#cccc99>
+<td background="/images/background-mem.gif">&nbsp;</td>
+<td background="/images/background-mem.gif">&nbsp;</td>
+<td background="/images/background-mem.gif">&nbsp;</td>
+</tr>
+</table>
+<br />
+EOF
+
+    for (my $i = 0; ($i * $num) < $count; $i++) {
+       my $newoffset = $i * $num;
+       print << "EOF";
+<a href="keywordsearch.pl?keyword=$keywords&offset=$newoffset&num=$num">$i</a>
+EOF
+    } # for
+
+    print << "EOF";
+<p />
+Results per page:
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=5">5</a>
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=10">10</a>
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=20">20</a>
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=50">50</a>
+</CENTER>
+<br clear="all" />
+<p>&nbsp;</p>
+EOF
+
+    print endmenu();
+    print endpage();
+} # else
diff --git a/acqui.simple/savebiblio.pl b/acqui.simple/savebiblio.pl
new file mode 100755 (executable)
index 0000000..bb37689
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+
+my $input = new CGI;
+my $biblio->{'title'}       = $input->param('title');
+my $biblio->{'subtitle'}    = $input->param('subtitle');
+my $biblio->{'author'}      = $input->param('author');
+my $biblio->{'seriestitle'} = $input->param('seriestitle');
+my $biblio->{'copyright'}   = $input->param('copyrightdate');
+my $biblio->{'abstract'}    = $input->param('abstract');
+my $biblio->{'notes'}       = $input->param('notes');
+my $biblionumber;
+
+if (! $biblio->{'title'}) {
+    print $input->redirect('addbiblio.pl?error=notitle');
+} else {
+
+    $biblionumber = &newbiblio($biblio);
+    &newsubtitle($biblionumber, $subtitle);
+
+    print $input->redirect('addbiblioitem.pl?biblionumber=$biblionumber');
+} # else
diff --git a/acqui.simple/savebiblioitem.pl b/acqui.simple/savebiblioitem.pl
new file mode 100755 (executable)
index 0000000..83eaa4e
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+
+my $input = new CGI;
+my $biblionumber = $input->param('biblionumber');
+my $biblioitem = {
+    biblionumber      => $biblionumber,
+    publishercode     => $input->param('publishercode'),
+    publicationyear   => $input->param('publicationyear'),
+    place             => $input->param('year'),
+    illus             => $input->param('illus'),
+    isbn              => $input->param('isbn'),
+    additionalauthors => $input->param('additionalauthors'),
+    subjectheadings   => $input->param('subjectheadings'),
+    itemtype          => $input->param('itemtype'),
+    url               => $input->param('url'),
+    dewey             => $input->param('dewey'),
+    subclass          => $input->param('subclass'),
+    issn              => $input->param('issn'),
+    lccn              => $input->param('lccn'),
+    volume            => $input->param('volume'),
+    number            => $input->param('number'),
+    volumeddesc       => $input->param('volumeddesc'),
+    pages             => $input->param('pages'),
+    size              => $input->param('size'),
+    notes             => $input->param('notes')
+};
+my $biblioitemnum;
+
+if (! $biblionumber) {
+    print $input->redirect('addbooks.pl');
+} else {
+
+    $biblioitemnum = &newbiblioitem($biblioitem);
+
+    print $input->redirect('additem.pl?biblioitemnum=$biblioitemnum');
+} # else
diff --git a/acqui.simple/saveitem.pl b/acqui.simple/saveitem.pl
new file mode 100755 (executable)
index 0000000..59be49e
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+
+my $input         = new CGI;
+my $barcode       = $input->param('barcode');
+my $biblioitemnum = $input->param('biblioitemnum');
+my $item          = {
+    biblioitemnum    => $biblioitemnum,
+    homebranch       => $input->param('homebranch'),
+    replacementprice => $input->param('replacementprice'),
+    itemnotes        => $input->param('notes')
+};
+my $count;
+my @results;
+
+if (! $barcode) {
+    print $input->redirect('additem.pl?error=nobarcode');
+} elsif (! $biblioitemnum) {
+    print $input->redirect('addbooks.pl');
+} else {
+
+    ($count, @results) = &getbiblioitem($biblioitemnum);
+    if (! $count) {
+       print->redirect('addbooks.pl');
+    } else {
+
+       $item->{'biblionumber'} = $results[0]->{'biblionumber'};
+       &newitems($item, ($barcode));
+
+       print $input->redirect('additem.pl?biblioitemnum=$biblioitemnum');
+    } # else
+} # else
diff --git a/acqui.simple/websitesearch.pl b/acqui.simple/websitesearch.pl
new file mode 100755 (executable)
index 0000000..2dd6d14
--- /dev/null
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+
+use CGI;
+use strict;
+use C4::Acquisitions;
+use C4::Output;
+
+my $input    = new CGI;
+my $keywords = $input->param('keyword');
+my $offset   = $input->param('offset');
+my $num      = $input->param('num');
+my $total;
+my $count;
+my @results;
+
+if (! $keywords) {
+    print $input->redirect('addbooks.pl');
+} else {
+    if (! $offset) { $offset = 0 };
+    if (! $num) { $num = 10 };
+
+    ($count, @results) = &websitesearch($keywords);
+
+    if ($count < ($offset + $num)) {
+        $total = $count;
+    } else {
+       $total = $offset + $num;
+    } # else
+
+    print $input->header;
+    print startpage();
+    print startmenu('acquisitions');
+
+    print << "EOF";
+<font size="6"><em>Website Search Results</em></font><br />
+<CENTER>
+You searched on <b>keywords $keywords,</b> $count results found <br />
+Results $offset to $total displayed
+<div align="right">
+<h2><a href="addbiblio.pl">Add New Biblio</a></h2>
+</div>
+<p />
+<table border="0" cellspacing="0" cellpadding="5">
+<tr valign=top bgcolor=#cccc99>
+<td background="/images/background-mem.gif"><b>TITLE</b></td>
+<td background="/images/background-mem.gif"><b>AUTHOR</b></td>
+<td background="/images/background-mem.gif"><b>&copy;</b></td>
+</tr>
+EOF
+
+    for (my $i = $offset; $i < $total; $i++) {
+       if ($i % 2) {
+           print << "EOF";
+<tr valign="top" bgcolor="#ffffcc">
+EOF
+       } else {
+           print << "EOF";
+<tr valign="top" bgcolor="#ffffff">
+EOF
+       } # else
+
+       print << "EOF";
+<td><a href="addbiblioitem.pl?biblionumber=$results[$i]->{'biblionumber'}">$results[$i]->{'title'}</a></td>
+<td><a href="addbiblioitem.pl?biblionumber=$results[$i]->{'biblionumber'}">$results[$i]->{'author'}</a></td>
+<td>$results[$i]->{'copyrightdate'}</td>
+</tr>
+EOF
+    } # for
+    print << "EOF";
+<tr valign=top bgcolor=#cccc99>
+<td background="/images/background-mem.gif">&nbsp;</td>
+<td background="/images/background-mem.gif">&nbsp;</td>
+<td background="/images/background-mem.gif">&nbsp;</td>
+</tr>
+</table>
+<br />
+EOF
+
+    for (my $i = 0; ($i * $num) < $count; $i++) {
+       my $newoffset = $i * $num;
+       print << "EOF";
+<a href="keywordsearch.pl?keyword=$keywords&offset=$newoffset&num=$num">$i</a>
+EOF
+    } # for
+
+    print << "EOF";
+<p />
+Results per page:
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=5">5</a>
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=10">10</a>
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=20">20</a>
+<a href="keywordsearch.pl?keyword=$keywords&offset=$offset&num=50">50</a>
+</CENTER>
+<br clear="all" />
+<p>&nbsp;</p>
+EOF
+
+    print endmenu();
+    print endpage();
+} # else