From d50f6a6d7d2c84dfed68a3d446968b9fb9b78bd9 Mon Sep 17 00:00:00 2001 From: Marc Chantreux Date: Sat, 28 Nov 2009 01:20:21 +0100 Subject: [PATCH] correctly add authid --- C4/AuthoritiesMarc.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index c61031b27d..2c79041f60 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -591,11 +591,9 @@ sub AddAuthority { $sth->execute; ($authid)=$sth->fetchrow; $authid=$authid+1; - ##Insert the recordID in MARC record - unless ($record->field('001') && $record->field('001')->data() eq $authid){ - $record->delete_field($record->field('001')); - $record->insert_fields_ordered(MARC::Field->new('001',$authid)); - } + ## Insert the recordID in MARC record + if ( my $field = $record->field('001') ) { $field->data($authid) } + else { $record->insert_fields_ordered(MARC::Field->new('001',$authid)) } } else { $auth_exists=$dbh->do(qq(select authid from auth_header where authid=?),undef,$authid); # warn "auth_exists = $auth_exists"; -- 2.39.5