Removed the dependency on Set::Scalar.
[koha.git] / moditem.pl
1 #!/usr/bin/perl
2
3 #script to modify/delete biblios
4 #written 8/11/99
5 # modified 11/11/99 by chris@katipo.co.nz
6
7
8 # Copyright 2000-2002 Katipo Communications
9 #
10 # This file is part of Koha.
11 #
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
16 #
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA  02111-1307 USA
24
25 use strict;
26
27 use C4::Search;
28 use CGI;
29 use C4::Output;
30 use C4::Acquisitions;
31 use C4::Biblio;
32
33 my $input = new CGI;
34 my $submit=$input->param('delete.x');
35 my $itemnum=$input->param('item');
36 my $bibitemnum=$input->param('bibitem');
37 if ($submit ne ''){
38   print $input->redirect("/cgi-bin/koha/delitem.pl?itemnum=$itemnum&bibitemnum=$bibitemnum");
39 }
40
41 print $input->header;
42 #print $input->dump;
43
44 my $data=bibitemdata($bibitemnum);
45
46 my $item=itemnodata('blah','',$itemnum);
47 #my ($analytictitle)=analytic($biblionumber,'t');
48 #my ($analyticauthor)=analytic($biblionumber,'a');
49 print startpage();
50 print startmenu('catalogue');
51 my %inputs;
52
53
54
55 #hash is set up with input name being the key then
56 #the value is a tab separated list, the first item being the input type
57 #$inputs{'Author'}="text\t$data->{'author'}\t0";
58 #$inputs{'Title'}="text\t$data->{'title'}\t1";
59 my $dewey = $data->{'dewey'};                                                      
60 $dewey =~ s/0+$//;                                                                 
61 if ($dewey eq "000.") { $dewey = "";};                                             
62 if ($dewey < 10){$dewey='00'.$dewey;}                                              
63 if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}                               
64 if ($dewey <= 0){                                                                  
65   $dewey='';                                                                       
66
67 $dewey=~ s/\.$//;
68 $inputs{'Barcode'}="text\t$item->{'barcode'}\t0";
69 $inputs{'Class'}="hidden\t$data->{'classification'}$dewey$data->{'subclass'}\t2";
70 #$inputs{'Item Type'}="text\t$data->{'itemtype'}\t3";
71 #$inputs{'Subject'}="textarea\t$sub\t4";
72 $inputs{'Publisher'}="hidden\t$data->{'publishercode'}\t5";
73 #$inputs{'Copyright date'}="text\t$data->{'copyrightdate'}\t6";
74 $inputs{'ISBN'}="hidden\t$data->{'isbn'}\t7";
75 $inputs{'Publication Year'}="hidden\t$data->{'publicationyear'}\t8";
76 $inputs{'Pages'}="hidden\t$data->{'pages'}\t9";
77 $inputs{'Illustrations'}="hidden\t$data->{'illustration'}\t10";
78 #$inputs{'Series Title'}="text\t$data->{'seriestitle'}\t11";
79 #$inputs{'Additional Author'}="text\t$additional\t12";
80 #$inputs{'Subtitle'}="text\t$subtitle->[0]->{'subtitle'}\t13";
81 #$inputs{'Unititle'}="text\t$data->{'unititle'}\t14";
82 $inputs{'ItemNotes'}="textarea\t$item->{'itemnotes'}\t15";
83 #$inputs{'Serial'}="text\t$data->{'serial'}\t16";
84 $inputs{'Volume'}="hidden\t$data->{'volumeddesc'}\t17";
85 $inputs{'Home Branch'}="text\t$item->{'homebranch'}\t18";
86 $inputs{'Lost'}="radio\t$item->{'itemlost'}\t19";
87 #$inputs{'Analytic author'}="text\t\t18";
88 #$inputs{'Analytic title'}="text\t\t19";
89
90 $inputs{'bibnum'}="hidden\t$data->{'biblionumber'}\t20";
91 $inputs{'bibitemnum'}="hidden\t$data->{'biblioitemnumber'}\t21";
92 $inputs{'itemnumber'}="hidden\t$itemnum\t22";
93
94
95
96 print <<printend
97 <FONT SIZE=6><em>$data->{'title'} ($data->{'author'})</em></FONT><br>
98 <table border=0 cellspacing=0 cellpadding=5>
99 <tr valign=top bgcolor=white><td><form action=updateitem.pl method=post>
100 <table border=0 cellspacing=0 cellpadding=5>
101 <tr valign=top bgcolor=white><td>Barcode</td><td><input type=text name=Barcode value="$item->{'barcode'}" size=40></td></tr>
102 <input type=hidden name=Class value="$data->{'classification'}$dewey$data->{'subclass'}">
103 <input type=hidden name=Publisher value="$data->{'publisher'}">
104 <input type=hidden name=ISBN value="$data->{'isbn'}">
105 <input type=hidden name=Publication Year value="$data->{'publicationyear'}">
106 <input type=hidden name=Pages value="$data->{'pages'}">
107 <input type=hidden name=Illustrations value="$data->{'illustration'}">
108 <tr valign=top bgcolor=white><td>ItemNotes</td><td><textarea name=ItemNotes cols=40 rows=4>$item->{'itemnotes'}</textarea></td></tr>
109 <input type=hidden name=Volume value="$data->{'volumeddesc'}">
110 <tr valign=top bgcolor=white><td>Home Branch</td><td><input type=text name=Home Branch value="$item->{'homebranch'}" size=40></td></tr>
111 <tr valign=top bgcolor=white><td>Lost</td><td><input type=radio name=Lost value=1
112 printend
113 ;
114 if ($item->{'itemlost'} ==1){
115   print " checked ";
116 }
117 print <<printend
118 >Yes
119 <input type=radio name=Lost value=0
120 printend
121 ;
122 if ($item->{'itemlost'} ==0){
123   print " checked ";
124 }
125 print <<printend
126 >No</td></tr>
127 <tr valign=top bgcolor=white><td>Cancelled</td><td><input type=radio name=withdrawn value=1
128 printend
129 ;
130 if ($item->{'wthdrawn'} ==1){
131   print " checked ";
132 }
133 print <<printend
134 >Yes
135 <input type=radio name=withdrawn value=0
136 printend
137 ;
138 if ($item->{'wthdrawn'} ==0){
139   print " checked ";
140 }
141 print <<printend
142 >No</td></tr>
143 <input type=hidden name=bibnum value="$data->{'biblionumber'}"> 
144 <input type=hidden name=bibitemnum value="$data->{'biblioitemnumber'}">
145 <input type=hidden name=itemnumber value="$itemnum">
146 <tr valign=top bgcolor=white><td></td><td>
147
148 <input type=image  name=submit src=/images/save-changes.gif border=0 width=187 
149 height=42></td></tr>
150 </table>
151 </form></td></tr>
152 </table>
153         
154 printend
155 ;
156
157
158
159
160
161 print endmenu();
162 print endpage();