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