tidied up, less hlt specific now
[koha.git] / misc / fixcatalog.pl
1 #!/usr/bin/perl
2
3 use C4::Database;
4 use strict;
5
6 my $dbh=C4Connect;
7
8 my $sth=$dbh->prepare("Select biblio.biblionumber,biblio.title from biblio,catalogueentry where catalogueentry.entrytype
9 ='t' and catalogueentry.catalogueentry=biblio.title limit 500");
10 $sth->execute;
11 while (my $data=$sth->fetchrow_hashref){
12   my $query="Update catalogueentry set biblionumber='$data->{'biblionumber'}' where catalogueentry.catalogueentry =
13   \"$data->{'title'}\" and catalogueentry.entrytype='t'";
14   my $sth2=$dbh->prepare($query);
15   $sth2->execute;
16   $sth2->finish;
17 }
18 $sth->finish;
19
20
21 $dbh->disconnect;