3 #script to do some serious catalogue maintainance
5 # by chris@katipo.co.nz
15 my $type=$input->param('type');
17 print startmenu('catalog');
21 if ($type eq 'allsub'){
22 my $sub=$input->param('sub');
23 my ($count,$results)=listsubjects($sub,$num,$offset);
24 for (my $i=0;$i<$count;$i++){
25 my $sub2=$results->[$i]->{'subject'};
27 print "\"<a href=\"/cgi-bin/koha/catmaintain.pl?type=allsub&sub=$sub\" onclick=\'messenger(\"/cgi-bin/koha/catmaintain.pl?type=modsub&sub=$sub2\");window1.focus()\'>$results->[$i]->{'subject'}\"</a><br>\n";
29 } elsif ($type eq 'modsub'){
30 my $sub=$input->param('sub');
31 print "<form action=/cgi-bin/koha/catmaintain.pl>";
32 print "Subject:<input type=text value=\"$sub\" name=sub size=40><br>\n";
33 print "<input type=hidden name=type value=upsub>";
34 print "<input type=hidden name=oldsub value=\"$sub\">";
35 print "<input type=submit value=modify>";
36 # print "<a href=\"nowhere\" onclick=\"document.forms[0].submit();\">Modify</a>";
38 print "<p> This will change the subject headings on all the biblios this subject is applied to"
39 } elsif ($type eq 'upsub'){
40 my $sub=$input->param('sub');
41 my $oldsub=$input->param('oldsub');
42 updatesub($sub,$oldsub);
43 print "Successfully modified $oldsub is now $sub";
44 print "<p><a href=/cgi-bin/koha/catmaintain.pl target=window0 onclick=\"window0.focus()\">Back to catalogue maintenance</a><br>";
45 print "<a href=nowhere onclick=\"self.close()\">Close this window</a>";
46 } elsif ($type eq 'undel'){
47 my $title=$input->param('title');
48 my ($count,$results)=deletedbib($title);
49 print "<table border=0>";
50 print "<tr><td><b>Title</b></td><td><b>Author</b></td><td><b>Undelete</b></td></tr>";
51 for (my $i=0;$i<$count;$i++){
52 print "<tr><td>$results->[$i]->{'title'}</td><td>$results->[$i]->{'author'}</td><td><a href=/cgi-bin/koha/catmaintain.pl?type=finun&bib=$results->[$i]->{'biblionumber'}>Undelete</a></td>\n";
55 } elsif ($type eq 'finun'){
56 my $bib=$input->param('bib');
58 print "Succesfully undeleted";
59 print "<p><a href=/cgi-bin/koha/catmaintain.pl>Back to Catalogue Maintenance</a>";
61 print "<B>Subject Maintenance</b><br>";
62 print "<form action=/cgi-bin/koha/catmaintain.pl method=post>";
63 print "<input type=hidden name=type value=allsub>";
64 print "Show all subjects beginning with <input type=text name=sub><br>";
65 print "<input type=submit value=Show>";
68 print "<B>Group Maintenance</b></br>";
69 print "<form action=/cgi-bin/koha/search.pl method=post>";
70 print "<input type=hidden name=type value=catmain>";
71 print "Show all Titles beginning with <input type=text name=title><br>";
72 print "<input type=submit value=Show>";
75 print "<B>Undelete Biblio</b></br>";
76 print "<form action=/cgi-bin/koha/catmaintain.pl method=post>";
77 print "<input type=hidden name=type value=undel>";
78 print "Show all Titles beginning with <input type=text name=title><br>";
79 print "<input type=submit value=Show>";
82 print endmenu('catalog');