removing unused package
[koha.git] / modbib.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #script to modify/delete biblios
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA  02111-1307 USA
23
24 use strict;
25
26 use C4::Biblio;
27 use CGI;
28 use C4::Output;
29 use HTML::Template;
30 use C4::Auth;
31 use C4::Context;
32 use C4::Interface::CGI::Output;
33
34 my $input = new CGI;
35
36 my $bibnum=$input->param('bibnum');
37 my $data=&bibdata($bibnum);
38 my ($subjectcount, $subject)     = &getsubject($bibnum);
39 my ($subtitlecount, $subtitle)   = &getsubtitle($bibnum);
40 my ($addauthorcount, $addauthor) = &getaddauthor($bibnum);
41 my $sub        = $subject->[0]->{'subject'};
42 my $additional = $addauthor->[0]->{'author'};
43 my $dewey;
44 my $submit=$input->param('submit.x');
45 if ($submit eq '') {
46   print $input->redirect("/cgi-bin/koha/delbiblio.pl?biblio=$bibnum");
47 } # if
48
49 my ($template, $loggedinuser, $cookie)
50     = get_template_and_user({template_name => "modbib.tmpl",
51                              query => $input,
52                              type => "intranet",
53                              authnotrequired => 0,
54                              flagsrequired => {acquisition => 1},
55                              debug => 1,
56                              });
57
58 # have to get all subtitles, subjects and additional authors
59 $sub = join("|", map { $_->{'subject'} } @{$subject});
60
61 $additional = join("|", map { $_->{'author'} } @{$addauthor});
62
63 $dewey = $data->{'dewey'};
64 $dewey =~ s/0+$//;
65 if ($dewey eq "000.") {
66     $dewey = "";
67 } # if
68 if ($dewey < 10) {
69     $dewey = '00' . $dewey;
70 } # if
71 if ($dewey < 100 && $dewey > 10) {
72     $dewey = '0' . $dewey;
73 } # if
74 if ($dewey <= 0){
75   $dewey='';
76 } # if
77 $dewey = ~ s/\.$//;
78
79 $data->{'title'} = &tidyhtml($data->{'title'});
80
81 $template->param ( biblionumber => $bibnum,
82                                                 biblioitemnumber => $data->{'biblioitemnumber'},
83                                                 author => $data->{'author'},
84                                                 title => $data->{'title'},
85                                                 abstract => $data->{'abstract'},
86                                                 subject => $sub,
87                                                 copyrightdate => $data->{'copyrightdate'},
88                                                 seriestitle => $data->{'seriestitle'},
89                                                 additionalauthor => $additional,
90                                                 subtitle => $data->{'subtitle'},
91                                                 unititle => $data->{'unititle'},
92                                                 notes => $data->{'bnotes'},
93                                                 serial => $data->{'serial'});
94
95 output_html_with_http_headers $input, $cookie, $template->output;
96
97 sub tidyhtml {
98   my ($inp)=@_;
99   $inp=~ s/\"/\&quot\;/g;
100   return($inp);
101 }