Fixing printing error, now is printing all of the days issues for borrower
[koha.git] / catmaintain.pl
1 #!/usr/bin/perl
2
3 #script to do some serious catalogue maintainance
4 #written 22/11/00
5 # by chris@katipo.co.nz
6
7 use strict;
8 use CGI;
9 use C4::Output;
10 use C4::Database;
11 use C4::Maintainance;
12
13 my $input = new CGI;
14 print $input->header;
15 my $type=$input->param('type');
16 print startpage();
17 print startmenu('catalog');
18 my $blah;
19 my $num=0;
20 my $offset=0;
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'};
26     $sub2=~ s/ /%20/g;
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";
28   }
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>";
37   print "</form>";
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 } else {
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>";
51   print "</form>";
52 }
53 print endmenu('catalog');
54 print endpage();