whacked a couple of bits that Chris marked as okay to delete.
[koha.git] / misc / makeformats.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use C4::Database;
5
6 my $dbh=C4Connect;
7 my $count=0;
8 my $query="Select biblionumber from aqorders where datereceived = '0000-00-00'";
9 my $sth=$dbh->prepare($query);
10 $sth->execute;
11
12 my $query2="Select max(biblioitemnumber) from biblioitems";
13 my $sth2=$dbh->prepare($query2);
14 $sth2->execute;
15 my $data=$sth2->fetchrow_hashref;
16 my $bibitemno=$data->{'max(biblioitemnumber)'};
17 print $bibitemno;
18 $bibitemno++;
19 $sth2->finish;
20 while (my $data=$sth->fetchrow_hashref){
21   $sth2=$dbh->prepare("insert into biblioitems (biblioitemnumber,biblionumber) values
22   ($bibitemno,$data->{'biblionumber'})");
23   $sth2->execute;
24   $sth2->finish;
25   $sth2=$dbh->prepare("update aqorders set biblioitemnumber=$bibitemno where biblionumber
26   =$data->{'biblionumber'}");
27   $sth2->execute;
28   $sth2->finish;
29   $bibitemno++
30   
31 }
32 $sth->finish;
33
34
35 $dbh->disconnect;