Added whitespace to make the POD work.
[koha.git] / updatebiblio.pl
1 #!/usr/bin/perl
2
3
4 # Copyright 2000-2002 Katipo Communications
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA  02111-1307 USA
20
21 use CGI;
22 use strict;
23 use C4::Acquisitions;
24 use C4::Output;
25
26 my $input       = new CGI;
27 my $bibnum      = checkinp($input->param('biblionumber'));
28 my $biblio = {
29     biblionumber => $bibnum,
30     title        => $input->param('title')?$input->param('title'):"",
31     author       => $input->param('author')?$input->param('author'):"",
32     abstract     => $input->param('abstract')?$input->param('abstract'):"",
33     copyright    => $input->param('copyrightdate')?$input->param('copyrightdate'):"",
34     seriestitle  => $input->param('seriestitle')?$input->param('seriestitle'):"",
35     serial       => $input->param('serial')?$input->param('serial'):"",
36     unititle     => $input->param('unititle')?$input->param('unititle'):"",
37     notes        => $input->param('notes')?$input->param('notes'):"",
38 }; # my $biblio
39 my $subtitle    = checkinp($input->param('subtitle'));
40 my $subject     = checkinp($input->param('subject'));
41 my $addauthor   = checkinp($input->param('additionalauthor'));
42 my $force       = $input->param('Force');
43 my %data;
44 my @sub;
45 my @subs;
46 my @names;
47 my $count;
48 my $error;
49
50 &modbiblio($biblio);
51 &modsubtitle($bibnum, $subtitle);
52 &modaddauthor($bibnum, $addauthor);
53
54 $subject = uc($subject);
55 @sub     = split(/\|/, $subject);
56 $count   = @sub;
57
58 for (my $i = 0; $i < $count; $i++) {
59     $sub[$i] =~ s/ +$//;
60 } # for
61
62 $error = &modsubject($bibnum,$force,@sub);
63
64 if ($error ne ''){
65     print $input->header;
66     print startpage();
67     print startmenu('catalogue');
68     print $error;
69     my @subs=split('\n',$error);
70     print "<p> Click submit to force the subject";
71     my @names=$input->param;
72     my %data;
73     my $count=@names;
74     for (my $i=0;$i<$count;$i++) {
75         if ($names[$i] ne 'Force') {
76             my $value=$input->param("$names[$i]");
77             $data{$names[$i]}="hidden\t$value\t$i";
78         } # if
79     } # for
80     $data{"Force"}="hidden\t$subs[0]\t$count";
81     print mkform3('updatebiblio.pl',%data);
82     print endmenu();
83     print endpage();
84 } else {
85     print $input->redirect("detail.pl?type=intra&bib=$bibnum");
86 } # else
87
88 sub checkinp{
89   my ($inp)=@_;
90   $inp=~ s/\'/\\\'/g;
91   $inp=~ s/\"/\\\"/g;
92   return($inp);
93 }