3 #script to do some serious catalogue maintainance
5 # by chris@katipo.co.nz
8 # Copyright 2000-2002 Katipo Communications
10 # This file is part of Koha.
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
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.
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
29 use C4::Interface::CGI::Output;
34 my ($template, $loggedinuser, $cookie)
35 = get_template_and_user({template_name => 'maint/catmaintain.tmpl',
39 flagsrequired => {catalogue => 1},
46 my $type=$input->param('type');
50 if ($type eq 'allsub'){
51 my $sub=$input->param('sub');
52 my ($count,$results)=listsubjects($sub,$num,$offset);
54 for (my $i=0;$i<$count;$i++){
55 my $sub2=$results->[$i]->{'subject'};
56 push @it, {'sub2' => $sub2, 'subject' => $results->[$i]->{'subject'}};
58 %params = ('sub' => $sub, 'loop' => \@it);
60 } elsif ($type eq 'modsub'){
61 %params = ('sub' => $input->param('sub'));
63 } elsif ($type eq 'upsub'){
64 my $sub=$input->param('sub');
65 my $oldsub=$input->param('oldsub');
66 updatesub($sub,$oldsub);
67 %params = ('sub' => $sub, 'oldsub' => $oldsub);
69 } elsif ($type eq 'undel'){
70 my $title=$input->param('title');
71 my ($count,$results)=deletedbib($title);
73 for (my $i=0;$i<$count;$i++){
75 'title' => $results->[$i]->{'title'},
76 'author' => $results->[$i]->{'author'},
77 'undelete' => "type=finun&bib=$results->[$i]->{'biblionumber'}",
80 %params = ('loop' => \@it);
82 } elsif ($type eq 'finun'){
83 my $bib=$input->param('bib');
86 } elsif ($type eq 'fixitemtype'){
87 my $bi=$input->param('bi');
88 my $item=$input->param('item');
89 %params = ('bi' => $bi, 'item' => $item);
91 } elsif ($type eq 'updatetype'){
92 my $bi=$input->param('bi');
93 my $itemtype=$input->param('itemtype');
94 updatetype($bi,$itemtype);
97 $type = 'mainmenu'; # NOTE
101 $template->param(type => 'intranet',
105 output_html_with_http_headers $input, $cookie, $template->output;