Added POD.
[koha.git] / 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'};
57 } # for
58
59 for (my $i = 1; $i < $addauthorcount; $i++) {
60   $additional = $additional . "|" . $addauthor->[$i]->{'author'};
61 } # for
62
63
64 $dewey = $data->{'dewey'};
65 $dewey =~ s/0+$//;
66 if ($dewey eq "000.") {
67     $dewey = "";
68 } # if
69 if ($dewey < 10) {
70     $dewey = '00' . $dewey;
71 } # if
72 if ($dewey < 100 && $dewey > 10) {
73     $dewey = '0' . $dewey;
74 } # if
75 if ($dewey <= 0){
76   $dewey='';
77 } # if
78 $dewey = ~ s/\.$//;
79
80 $data->{'title'} = &tidyhtml($data->{'title'});
81
82 print << "EOF";
83 <a href="modwebsites.pl?biblionumber=$data->{'biblionumber'}">Modify Website Links</a>
84 <form action="updatebiblio.pl" method="post" name="f">
85 <input type="hidden" name="biblionumber" value="$data->{'biblionumber'}">
86 <input type="hidden" name="biblioitemnumber" value="$data=>{'biblioitemnumber'}">
87 <table border="0" cellspacing="0" cellpadding="5">
88 <tr valign="top">
89 <td>Author</td>
90 <td><input type="text" name="author" value="$data->{'author'}"></td>
91 </tr>
92 <tr valign="top">
93 <td>Title</td>
94 <td><input type="text" name="title" value="$data->{'title'}"></td>
95 </tr>
96 <tr valign="top">
97 <td>Abstract</td>
98 <td><textarea name="abstract" cols="40" rows="4">$data->{'abstract'}</textarea></td>
99 </tr>
100 <tr valign="top">
101 <td>Subject</td>
102 <td><textarea name="subject" cols="40" rows="4">$sub</textarea>
103 <a href="javascript:Dopop()">...</a>
104 </td>
105 </tr>
106 <tr valign="top">
107 <td>Copyright Date</td>
108 <td><input type="text" name="copyrightdate" value="$data->{'copyrightdate'}"></td>
109 </tr>
110 <tr valign="top">
111 <td>Series Title</td>
112 <td><input type="text" name="seriestitle" value="$data->{'seriestitle'}"></td>
113 </tr>
114 <tr valign="top">
115 <td>Additional Author</td>
116 <td><input type="text" name="additionalauthor" value="$additional"></td>
117 </tr>
118 <tr valign="top">
119 <td>Subtitle</td>
120 <td><input type="text" name="subtitle" value="$data->{'subtitle'}"></td>
121 </tr>
122 <tr valign="top">
123 <td>Unititle</td>
124 <td><input type="text" name="unititle" value="$data->{'untitle'}"></td>
125 </tr>
126 <tr valign="top">
127 <td>Notes</td>
128 <td><textarea name="notes" cols="40" rows="4">$data->{'notes'}</textarea></td>
129 </tr>
130 <tr valign="top">
131 <td>Serial</td>
132 <td><input type="text" name="serial" value="$data->{'serial'}"></td>
133 </tr>
134 <tr valign="top">
135 <td>Analytic Author</td>
136 <td><input type="text" name="analyticauthor"></td>
137 </tr>
138 <tr valign="top">
139 <td>Analytic Title</td>
140 <td><input type="text" name="analytictitle"></td>
141 </tr>
142 </table>
143 <br>
144 <input type="submit" name="submit" value="Save Changes">
145 </form>
146 <script>
147 function Dopop() {
148         newin=window.open("thesaurus_popup.pl?subject="+document.f.subject.value,"thesaurus",'width=500,height=400,toolbar=false,scrollbars=yes');
149 }
150 </script>
151 EOF
152
153 print endmenu();
154 print endpage();
155
156 sub tidyhtml {
157   my ($inp)=@_;
158   $inp=~ s/\"/\&quot\;/g;
159   return($inp);
160 }