X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=misc%2Fmarc_into_authority.pl;h=d9b038fce23a9e3e94097db4a79b140435489e86;hb=1ab5cdfd44b6226374881bb957c4b743471d73e4;hp=08a2e4d130cded3e86fb06edea30d2494d689156;hpb=7790f976ca9361d653dd9dbbf210ad5261f5b86a;p=koha.git diff --git a/misc/marc_into_authority.pl b/misc/marc_into_authority.pl index 08a2e4d130..d9b038fce2 100644 --- a/misc/marc_into_authority.pl +++ b/misc/marc_into_authority.pl @@ -41,7 +41,6 @@ while (( my $cols)=$sthcols->fetchrow){ $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(); @@ -58,6 +57,7 @@ unless ($columns{'kohafield'}){ 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(); @@ -68,8 +68,8 @@ my $sth2 = $dbh->prepare("UPDATE auth_header set marc=? where authid=?" ); 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); @@ -78,7 +78,7 @@ $timeneeded = gettimeofday - $starttime unless ($i % 1000); print "." unless ($i % 500); $i++; } -$dbh->do("UNLOCK TABLES "); + sub AUTHgetauthorityold { # Returns MARC::Record of the biblio passed in parameter.