Kumara - predecessor to Koha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
859 B

#!/usr/bin/perl
use strict;
use C4::Database;
my $dbh=C4Connect;
my $count=0;
my $query="Select biblionumber from aqorders where datereceived = '0000-00-00'";
my $sth=$dbh->prepare($query);
$sth->execute;
my $query2="Select max(biblioitemnumber) from biblioitems";
my $sth2=$dbh->prepare($query2);
$sth2->execute;
my $data=$sth2->fetchrow_hashref;
my $bibitemno=$data->{'max(biblioitemnumber)'};
print $bibitemno;
$bibitemno++;
$sth2->finish;
while (my $data=$sth->fetchrow_hashref){
$sth2=$dbh->prepare("insert into biblioitems (biblioitemnumber,biblionumber) values
($bibitemno,$data->{'biblionumber'})");
$sth2->execute;
$sth2->finish;
$sth2=$dbh->prepare("update aqorders set biblioitemnumber=$bibitemno where biblionumber
=$data->{'biblionumber'}");
$sth2->execute;
$sth2->finish;
$bibitemno++
}
$sth->finish;
$dbh->disconnect;