road to 1.3.2 :
[koha.git] / modbib.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #script to modify/delete biblios
6 #written 8/11/99
7 # modified 11/11/99 by chris@katipo.co.nz
8
9
10 # Copyright 2000-2002 Katipo Communications
11 #
12 # This file is part of Koha.
13 #
14 # Koha is free software; you can redistribute it and/or modify it under the
15 # terms of the GNU General Public License as published by the Free Software
16 # Foundation; either version 2 of the License, or (at your option) any later
17 # version.
18 #
19 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License along with
24 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
25 # Suite 330, Boston, MA  02111-1307 USA
26
27 use strict;
28
29 use C4::Search;
30 use CGI;
31 use C4::Output;
32
33 my $input = new CGI;
34
35 my $bibnum=$input->param('bibnum');
36 my $data=&bibdata($bibnum);
37 my ($subjectcount, $subject)     = &subject($data->{'biblionumber'});
38 my ($subtitlecount, $subtitle)   = &subtitle($data->{'biblionumber'});
39 my ($addauthorcount, $addauthor) = &addauthor($data->{'biblionumber'});
40 my $sub        = $subject->[0]->{'subject'};
41 my $additional = $addauthor->[0]->{'author'};
42 my $dewey;
43 my $submit=$input->param('submit.x');
44 if ($submit eq '') {
45   print $input->redirect("/cgi-bin/koha/delbiblio.pl?biblio=$bibnum");
46 } # if
47
48 print $input->header;
49 # my ($analytictitle)  = &analytic($biblionumber,'t');
50 # my ($analyticauthor) = &analytic($biblionumber,'a');
51 print startpage();
52 print startmenu('catalogue');
53
54 # have to get all subtitles, subjects and additional authors
55 $sub = join("|", map { $_->{'subject'} } @{$subject});
56
57 $additional = join("|", map { $_->{'author'} } @{$addauthor});
58
59 $dewey = $data->{'dewey'};
60 $dewey =~ s/0+$//;
61 if ($dewey eq "000.") {
62     $dewey = "";
63 } # if
64 if ($dewey < 10) {
65     $dewey = '00' . $dewey;
66 } # if
67 if ($dewey < 100 && $dewey > 10) {
68     $dewey = '0' . $dewey;
69 } # if
70 if ($dewey <= 0){
71   $dewey='';
72 } # if
73 $dewey = ~ s/\.$//;
74
75 $data->{'title'} = &tidyhtml($data->{'title'});
76
77 print << "EOF";
78 <a href="modwebsites.pl?biblionumber=$data->{'biblionumber'}">Modify Website Links</a>
79 <form action="updatebiblio.pl" method="post" name="f">
80 <input type="hidden" name="biblionumber" value="$data->{'biblionumber'}">
81 <input type="hidden" name="biblioitemnumber" value="$data=>{'biblioitemnumber'}">
82 <table border="0" cellspacing="0" cellpadding="5">
83 <tr valign="top">
84 <td>Author</td>
85 <td><input type="text" name="author" value="$data->{'author'}"></td>
86 </tr>
87 <tr valign="top">
88 <td>Title</td>
89 <td><input type="text" name="title" value="$data->{'title'}"></td>
90 </tr>
91 <tr valign="top">
92 <td>Abstract</td>
93 <td><textarea name="abstract" cols="40" rows="4">$data->{'abstract'}</textarea></td>
94 </tr>
95 <tr valign="top">
96 <td>Subject</td>
97 <td><textarea name="subject" cols="40" rows="4">$sub</textarea>
98 <a href="javascript:Dopop()">...</a>
99 </td>
100 </tr>
101 <tr valign="top">
102 <td>Copyright Date</td>
103 <td><input type="text" name="copyrightdate" value="$data->{'copyrightdate'}"></td>
104 </tr>
105 <tr valign="top">
106 <td>Series Title</td>
107 <td><input type="text" name="seriestitle" value="$data->{'seriestitle'}"></td>
108 </tr>
109 <tr valign="top">
110 <td>Additional Author</td>
111 <td><input type="text" name="additionalauthor" value="$additional"></td>
112 </tr>
113 <tr valign="top">
114 <td>Subtitle</td>
115 <td><input type="text" name="subtitle" value="$data->{'subtitle'}"></td>
116 </tr>
117 <tr valign="top">
118 <td>Unititle</td>
119 <td><input type="text" name="unititle" value="$data->{'untitle'}"></td>
120 </tr>
121 <tr valign="top">
122 <td>Notes</td>
123 <td><textarea name="notes" cols="40" rows="4">$data->{'notes'}</textarea></td>
124 </tr>
125 <tr valign="top">
126 <td>Serial</td>
127 <td><input type="text" name="serial" value="$data->{'serial'}"></td>
128 </tr>
129 <tr valign="top">
130 <td>Analytic Author</td>
131 <td><input type="text" name="analyticauthor"></td>
132 </tr>
133 <tr valign="top">
134 <td>Analytic Title</td>
135 <td><input type="text" name="analytictitle"></td>
136 </tr>
137 </table>
138 <br>
139 <input type="submit" name="submit" value="Save Changes">
140 </form>
141 <script>
142 function Dopop() {
143         newin=window.open("thesaurus_popup.pl?subject="+document.f.subject.value,"thesaurus",'width=500,height=400,toolbar=false,scrollbars=yes');
144 }
145 </script>
146 EOF
147
148 print endmenu();
149 print endpage();
150
151 sub tidyhtml {
152   my ($inp)=@_;
153   $inp=~ s/\"/\&quot\;/g;
154   return($inp);
155 }