Script to shift a group to another biblio, called as part of catalogue maintenance
[koha_fer] / maint / shiftbib.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 my $bi=$input->param('bi');
17 my $bib=$input->param('bib');
18 my $type=$input->param('type');
19 print startpage();
20 print startmenu('catalog');
21
22 if ($type eq 'change'){
23   my $biblionumber=$input->param('biblionumber');
24   my $dbh=C4Connect;
25   my $query="Select * from biblio where biblionumber=$biblionumber";
26   my $sth=$dbh->prepare($query);
27   $sth->execute;
28   my $data=$sth->fetchrow_hashref;
29   print "Shifting group $bi to biblio $biblionumber<br>
30   Title:$data->{'title'}<br>
31   Author:$data->{'author'}<p>
32   Are you sure?
33   <p>
34   ";
35   print "<a href=/cgi-bin/koha/maint/shiftbib.pl?type=update&bi=$bi&bib=$biblionumber>Yes</a>";
36 } elsif ($type eq 'update'){
37   shiftgroup($bib,$bi);
38   print "Shifted";
39 } else {
40   print "Shifting Group $bi from biblio $bib to <p>";
41   print "<form action=/cgi-bin/koha/maint/shiftbib.pl method=post>";
42   print "<input  name=bi type=hidden value=$bi>";
43   print "<input type=hidden name=type value=change>";
44   print "<input type=text name=biblionumber><br>";
45   print "<input type=submit value=change></form>";
46 }
47 print endmenu('catalog');
48 print endpage();