From c9def9328613401f751f038653273b35b3e9d84e Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Tue, 5 Apr 2011 11:04:42 +0200 Subject: [PATCH] Bug 5915 : C4::AuthoritiesMarc AddAuthority Fixing 100$a simple error: Sometimes, language is encoded fre50 and not frey50. This patch adds check for that problem Signed-off-by: Jonathan Druart Signed-off-by: Chris Cormack --- C4/AuthoritiesMarc.pm | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 875d2740a9..57d318b4c0 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -651,17 +651,21 @@ sub AddAuthority { } } - if (($format eq "UNIMARCAUTH") && (!$record->subfield('100','a'))){ + if ($format eq "UNIMARCAUTH") { $record->leader(" nx j22 ") unless ($record->leader()); my $date=POSIX::strftime("%Y%m%d",localtime); - if ($record->field('100')){ + if (my $string=$record->subfield('100',"a")){ + $string=~s/fre50/frey50/; + $record->field('100')->update('a'=>$string); + } + elsif ($record->field('100')){ $record->field('100')->update('a'=>$date."afrey50 ba0"); - } else { - $record->append_fields( - MARC::Field->new('100',' ',' ' - ,'a'=>$date."afrey50 ba0") - ); - } + } else { + $record->append_fields( + MARC::Field->new('100',' ',' ' + ,'a'=>$date."afrey50 ba0") + ); + } } my ($auth_type_tag, $auth_type_subfield) = get_auth_type_location($authtypecode); if (!$authid and $format eq "MARC21") { -- 2.39.5