Bug 5915 : C4::AuthoritiesMarc AddAuthority
authorPaul Poulain <paul.poulain@biblibre.com>
Tue, 5 Apr 2011 09:04:42 +0000 (11:04 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Thu, 7 Apr 2011 04:33:50 +0000 (16:33 +1200)
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 <jonathan.druart@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/AuthoritiesMarc.pm

index 875d274..57d318b 100644 (file)
@@ -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") {