Fixed a few warnings.
[koha.git] / acqui.simple / additem.pl
1 #!/usr/bin/perl
2
3 use CGI;
4 use strict;
5 use C4::Acquisitions;
6 use C4::Output;
7
8 my $input = new CGI;
9 my $biblioitemnum = $input->param('biblioitemnum');
10 my $maxbarcode;
11 my $isbn;
12 my $count;
13 my @results;
14 my $branchcount;
15 my @branches;
16
17 if (! $biblioitemnum) {
18     print $input->redirect('addbooks.pl');
19 } else {
20
21     ($count, @results) = &getbiblioitem($biblioitemnum);
22     
23     if (! $count) {
24         print $input->redirect('addbooks.pl');
25     } else {
26         $isbn       = $results[0]->{'isbn'};
27         $maxbarcode = $results[0]->{'biblionumber'};
28   
29         print $input->header;
30         print startpage();
31         print startmenu('acquisitions');
32     
33         ($count, @results) = &getitemsbybiblioitem($biblioitemnum);
34         ($branchcount, @branches) = &branches;
35
36         if ($count) {
37             print << "EOF";
38 <center>
39 <p>
40 <table border=1 bgcolor=#dddddd>
41 <tr>
42 <th colspan=4>Existing Items with ISBN $isbn</th>
43 </tr>
44 <tr>
45 <th>Barcode</th><th>Title</th><th>Author</th><th>Notes</th></tr>
46 EOF
47
48             for (my $i = 0; $i < $count; $i++) {
49                 print << "EOF";
50 <tr>
51 <td align=center>$results[$i]->{'barcode'}</td>
52 <td><u>$results[$i]->{'title'}</u></td>
53 <td>$results[$i]->{'author'}</td>
54 <td>$results[$i]->{'itemnotes'}</td>
55 </tr>
56 EOF
57         } # for
58
59             print << "EOF";
60 </table>
61 </center>
62 EOF
63         } # if
64
65         print << "EOF";
66 <center>
67 <h2>Section Three: Specific Item Information</h2>
68 <form action="saveitem.pl" method="post">
69 <input type="hidden" name="biblioitemnum" value="$biblioitemnum">
70 <table>
71 <tr>
72 <td align="right">BARCODE:</td>
73 <td><input name="barcode" size="10" value="$maxbarcode" /></td>
74 <td align="right">Home Branch:</td>
75 <td><select name="homebranch">
76 EOF
77
78         for (my $i = 0; $i < $branchcount; $i ++) {
79             print << "EOF";
80 <option value="$branches[$i]->{'branchcode'}">$branches[$i]->{'branchname'}
81 EOF
82         } # for
83
84         print << "EOF";
85 </select></td>
86 </tr>
87 <tr>
88 <td align="right">Replacement Price:</td>
89 <td colspan="3"><input name="replacementprice" size="10"></td>
90 </tr>
91 <tr valign="top">
92 <td align="right">Notes:</td>
93 <td colspan="3"><textarea name="notes" rows="4" cols="40" wrap="physical"></textarea></td>
94 </tr>
95 </table>
96 <input type="submit" value="Add Item" />
97 </form>
98 </center>
99 EOF
100     
101         print endmenu();
102         print endpage();
103     } # if
104 } # if