Added some FIXME comments.
[koha_gimpoz] / modbib.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
31 my $input = new CGI;
32
33 my $bibnum=$input->param('bibnum');
34 my $data=&bibdata($bibnum);
35 my ($subjectcount, $subject)     = &subject($data->{'biblionumber'});
36 my ($subtitlecount, $subtitle)   = &subtitle($data->{'biblionumber'});
37 my ($addauthorcount, $addauthor) = &addauthor($data->{'biblionumber'});
38 my $sub        = $subject->[0]->{'subject'};
39 my $additional = $addauthor->[0]->{'author'};
40 my %inputs;
41 my $dewey;
42 my $submit=$input->param('submit.x');                                                                                              
43 if ($submit eq '') {
44   print $input->redirect("/cgi-bin/koha/delbiblio.pl?biblio=$bibnum");
45 } # if
46
47 print $input->header;
48 # my ($analytictitle)  = &analytic($biblionumber,'t');
49 # my ($analyticauthor) = &analytic($biblionumber,'a');
50 print startpage();
51 print startmenu('catalogue');
52 my %inputs;
53
54 # have to get all subtitles, subjects and additional authors
55 for (my $i = 1; $i < $subjectcount; $i++) {
56   $sub = $sub . "|" . $subject->[$i]->{'subject'};      # FIXME - .=
57 } # for
58
59 for (my $i = 1; $i < $addauthorcount; $i++) {
60   $additional = $additional . "|" . $addauthor->[$i]->{'author'};
61                                                         # FIXME - .=
62 } # for
63
64
65 $dewey = $data->{'dewey'};
66 $dewey =~ s/0+$//;
67 if ($dewey eq "000.") {
68     $dewey = "";
69 } # if
70 if ($dewey < 10) {
71     $dewey = '00' . $dewey;
72 } # if
73 if ($dewey < 100 && $dewey > 10) {
74     $dewey = '0' . $dewey;
75 } # if
76 if ($dewey <= 0){
77   $dewey='';
78 } # if
79 $dewey = ~ s/\.$//;
80
81 $data->{'title'} = &tidyhtml($data->{'title'});
82
83 print << "EOF";
84 <a href="modwebsites.pl?biblionumber=$data->{'biblionumber'}">Modify Website Links</a>
85 <form action="updatebiblio.pl" method="post" name="f">
86 <input type="hidden" name="biblionumber" value="$data->{'biblionumber'}">
87 <input type="hidden" name="biblioitemnumber" value="$data=>{'biblioitemnumber'}">
88 <table border="0" cellspacing="0" cellpadding="5">
89 <tr valign="top">
90 <td>Author</td>
91 <td><input type="text" name="author" value="$data->{'author'}"></td>
92 </tr>
93 <tr valign="top">
94 <td>Title</td>
95 <td><input type="text" name="title" value="$data->{'title'}"></td>
96 </tr>
97 <tr valign="top">
98 <td>Abstract</td>
99 <td><textarea name="abstract" cols="40" rows="4">$data->{'abstract'}</textarea></td>
100 </tr>
101 <tr valign="top">
102 <td>Subject</td>
103 <td><textarea name="subject" cols="40" rows="4">$sub</textarea>
104 <a href="javascript:Dopop()">...</a>
105 </td>
106 </tr>
107 <tr valign="top">
108 <td>Copyright Date</td>
109 <td><input type="text" name="copyrightdate" value="$data->{'copyrightdate'}"></td>
110 </tr>
111 <tr valign="top">
112 <td>Series Title</td>
113 <td><input type="text" name="seriestitle" value="$data->{'seriestitle'}"></td>
114 </tr>
115 <tr valign="top">
116 <td>Additional Author</td>
117 <td><input type="text" name="additionalauthor" value="$additional"></td>
118 </tr>
119 <tr valign="top">
120 <td>Subtitle</td>
121 <td><input type="text" name="subtitle" value="$data->{'subtitle'}"></td>
122 </tr>
123 <tr valign="top">
124 <td>Unititle</td>
125 <td><input type="text" name="unititle" value="$data->{'untitle'}"></td>
126 </tr>
127 <tr valign="top">
128 <td>Notes</td>
129 <td><textarea name="notes" cols="40" rows="4">$data->{'notes'}</textarea></td>
130 </tr>
131 <tr valign="top">
132 <td>Serial</td>
133 <td><input type="text" name="serial" value="$data->{'serial'}"></td>
134 </tr>
135 <tr valign="top">
136 <td>Analytic Author</td>
137 <td><input type="text" name="analyticauthor"></td>
138 </tr>
139 <tr valign="top">
140 <td>Analytic Title</td>
141 <td><input type="text" name="analytictitle"></td>
142 </tr>
143 </table>
144 <br>
145 <input type="submit" name="submit" value="Save Changes">
146 </form>
147 <script>
148 function Dopop() {
149         newin=window.open("thesaurus_popup.pl?subject="+document.f.subject.value,"thesaurus",'width=500,height=400,toolbar=false,scrollbars=yes');
150 }
151 </script>
152 EOF
153
154 print endmenu();
155 print endpage();
156
157 sub tidyhtml {
158   my ($inp)=@_;
159   $inp=~ s/\"/\&quot\;/g;
160   return($inp);
161 }