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>";
47 print "<form action=/cgi-bin/koha/catmaintain.pl method=post>";
48 print "<input type=hidden name=type value=allsub>";
49 print "Show all subjects beginning with <input type=text name=sub><br>";
50 print "<input type=submit value=Show>";
53 print endmenu('catalog');