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
32 my $type=$input->param('type');
34 print startmenu('catalog');
38 if ($type eq 'allsub'){
39 my $sub=$input->param('sub');
40 my ($count,$results)=listsubjects($sub,$num,$offset);
41 for (my $i=0;$i<$count;$i++){
42 my $sub2=$results->[$i]->{'subject'};
45 print "\"<a href=\"/cgi-bin/koha/maint/catmaintain.pl?type=allsub&sub=$sub\" onclick=\'messenger(\"/cgi-bin/koha/maint/catmaintain.pl?type=modsub&sub=$sub2\");window1.focus()\'>$results->[$i]->{'subject'}\"</a><br>\n";
47 } elsif ($type eq 'modsub'){
48 my $sub=$input->param('sub');
49 print "<form action=/cgi-bin/koha/maint/catmaintain.pl>";
50 print "Subject:<input type=text value=\"$sub\" name=sub size=40><br>\n";
51 print "<input type=hidden name=type value=upsub>";
52 print "<input type=hidden name=oldsub value=\"$sub\">";
53 print "<input type=submit value=modify>";
54 # print "<a href=\"nowhere\" onclick=\"document.forms[0].submit();\">Modify</a>";
56 print "<p> This will change the subject headings on all the biblios this subject is applied to"
57 } elsif ($type eq 'upsub'){
58 my $sub=$input->param('sub');
59 my $oldsub=$input->param('oldsub');
60 updatesub($sub,$oldsub);
61 print "Successfully modified $oldsub is now $sub";
62 print "<p><a href=/cgi-bin/koha/maint/catmaintain.pl target=window0 onclick=\"window0.focus()\">Back to catalogue maintenance</a><br>";
63 print "<a href=nowhere onclick=\"self.close()\">Close this window</a>";
64 } elsif ($type eq 'undel'){
65 my $title=$input->param('title');
66 my ($count,$results)=deletedbib($title);
67 print "<table border=0>";
68 print "<tr><td><b>Title</b></td><td><b>Author</b></td><td><b>Undelete</b></td></tr>";
69 for (my $i=0;$i<$count;$i++){
70 print "<tr><td>$results->[$i]->{'title'}</td><td>$results->[$i]->{'author'}</td><td><a href=/cgi-bin/koha/maint/catmaintain.pl?type=finun&bib=$results->[$i]->{'biblionumber'}>Undelete</a></td>\n";
73 } elsif ($type eq 'finun'){
74 my $bib=$input->param('bib');
76 print "Succesfully undeleted";
77 print "<p><a href=/cgi-bin/koha/maint/catmaintain.pl>Back to Catalogue Maintenance</a>";
78 } elsif ($type eq 'fixitemtype'){
79 my $bi=$input->param('bi');
80 my $item=$input->param('item');
81 print "<form method=post action=/cgi-bin/koha/maint/catmaintain.pl>";
82 print "<input type=hidden name=bi value=$bi>";
83 print "<input type=hidden name=type value=updatetype>";
84 print "Itemtype:<input type=text name=itemtype value=$item><br>\n";
85 print "<input type=submit value=Change>";
87 } elsif ($type eq 'updatetype'){
88 my $bi=$input->param('bi');
89 my $itemtype=$input->param('itemtype');
90 updatetype($bi,$itemtype);
91 print "Updated successfully";
92 print "<p><a href=/cgi-bin/koha/maint/catmaintain.pl>Back to Catalogue Maintenance</a>";
94 print "<B>Subject Maintenance</b><br>";
95 print "<form action=/cgi-bin/koha/maint/catmaintain.pl method=post>";
96 print "<input type=hidden name=type value=allsub>";
97 print "Show all subjects beginning with <input type=text name=sub><br>";
98 print "<input type=submit value=Show>";
101 print "<B>Group Maintenance</b></br>";
102 print "<form action=/cgi-bin/koha/search.pl method=post>";
103 print "<input type=hidden name=type value=catmain>";
104 print "Show all Titles beginning with <input type=text name=title><br>";
105 print "Item Number <INPUT TYPE=\"text\" SIZE=\"25\" NAME=\"item\"><br>";
106 print "<input type=submit value=Show>";
109 print "<B>Undelete Biblio</b></br>";
110 print "<form action=/cgi-bin/koha/maint/catmaintain.pl method=post>";
111 print "<input type=hidden name=type value=undel>";
112 print "Show all Titles beginning with <input type=text name=title><br>";
113 print "<input type=submit value=Show>";
116 print endmenu('catalog');