[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/misc marc_into_authority.pl
From: |
Tumer Garip |
Subject: |
[Koha-cvs] koha/misc marc_into_authority.pl |
Date: |
Fri, 19 May 2006 21:39:53 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch:
Changes by: Tumer Garip <address@hidden> 06/05/19 21:39:53
Modified files:
misc : marc_into_authority.pl
Log message:
Old authorities did not contain authid in marc record. Add it
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/misc/marc_into_authority.pl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: koha/misc/marc_into_authority.pl
diff -u koha/misc/marc_into_authority.pl:1.1
koha/misc/marc_into_authority.pl:1.2
--- koha/misc/marc_into_authority.pl:1.1 Fri May 19 19:07:09 2006
+++ koha/misc/marc_into_authority.pl Fri May 19 21:39:52 2006
@@ -9,6 +9,7 @@
use MARC::Record;
use MARC::File::USMARC;
use MARC::File::XML;
+use C4::AuthoritiesMarc;
use Time::HiRes qw(gettimeofday);
my $timeneeded;
my $starttime = gettimeofday;
@@ -41,7 +42,12 @@
while (my ($authid,$authtypecode)=$sth->fetchrow ){
- my $record = AUTHgetauthority($dbh,$authid);
+ 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);
+##Both authid and authtypecode is expected to be in the same field. Modify if
other requirements arise
+
$record->add_fields($authfield,'','',$authidsubfield=>$authid,$authtypesubfield=>$authtypecode);
$sth2->execute($record->as_usmarc,$authid);
$timeneeded = gettimeofday - $starttime unless ($i % 1000);
print "$i in $timeneeded s\n" unless ($i % 1000);
@@ -50,7 +56,7 @@
}
$dbh->do("UNLOCK TABLES ");
-sub AUTHgetauthority {
+sub AUTHgetauthorityold {
# Returns MARC::Record of the biblio passed in parameter.
my ($dbh,$authid)address@hidden;
my $record = MARC::Record->new();