$columns{$cols}=1;
}
##Update the database if missing fields;
- $dbh->do("LOCK TABLES auth_header WRITE, auth_subfield_structure WRITE , auth_subfield_table READ");
unless ($columns{'link'}){
my $sth=$dbh->prepare("ALTER TABLE auth_subfield_structure ADD COLUMN `link` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 ");
$sth->execute();
my $sth=$dbh->prepare("ALTER TABLE auth_subfield_structure ADD COLUMN `kohafield` VARCHAR(45) NOT NULL ");
$sth->execute();
}
+$dbh->do("UNLOCK TABLES ");
my $sth=$dbh->prepare("select authid,authtypecode from auth_header ");
$sth->execute();
while (my ($authid,$authtypecode)=$sth->fetchrow ){
my $record = AUTHgetauthorityold($dbh,$authid);
##Add authid and authtypecode to record. Old records did not have these fields
-my ($authidfield,$authidsubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.authid",$authtypecode);
-my ($authidfield,$authtypesubfield)=AUTHfind_marc_from_kohafield($dbh,"auth_header.authtypecode",$authtypecode);
+my ($authidfield,$authidsubfield)=AUTHfind_marc_from_kohafield("auth_header.authid",$authtypecode);
+my ($authidfield,$authtypesubfield)=AUTHfind_marc_from_kohafield("auth_header.authtypecode",$authtypecode);
##Both authid and authtypecode is expected to be in the same field. Modify if other requirements arise
$record->add_fields($authidfield,'','',$authidsubfield=>$authid,$authtypesubfield=>$authtypecode);
$sth2->execute($record->as_usmarc,$authid);
print "." unless ($i % 500);
$i++;
}
-$dbh->do("UNLOCK TABLES ");
+
sub AUTHgetauthorityold {
# Returns MARC::Record of the biblio passed in parameter.