[Koha-patches] [PATCH] Bug 5915 : C4::AuthoritiesMarc AddAuthority

Chris Cormack chrisc at catalyst.net.nz
Mon Mar 21 04:12:43 CET 2011


From: Paul Poulain <paul.poulain at biblibre.com>

Fixing 100$a simple error: Sometimes, language is encoded fre50 and not
frey50.
This patch adds check for that problem
---
 C4/AuthoritiesMarc.pm |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index f3cc948..3496c05 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -649,10 +649,14 @@ sub AddAuthority {
     }
 	}
 
-  if (($format eq "UNIMARCAUTH") && (!$record->subfield('100','a'))){
-        $record->leader("     nx  j22             ");
+  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(
-- 
1.7.1



More information about the Koha-patches mailing list