[Koha-patches] [PATCH 11/55] SetUTF8Flag on any incoming data

Henri-Damien LAURENT henridamien.laurent at biblibre.com
Wed Mar 10 22:25:53 CET 2010


This prompts NFC normalization on adding record
Therefore, any saved record will be NFC normalized
---
 C4/AuthoritiesMarc.pm |    3 ++-
 C4/Biblio.pm          |    2 ++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm
index d77ac2a..f6be8cd 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -630,6 +630,7 @@ sub AddAuthority {
         $format= 'MARC21';
     }
 
+    SetUTF8Flag($record);
 	if ($format eq "MARC21") {
 		if (!$record->leader) {
 			$record->leader($leader);
@@ -662,7 +663,7 @@ sub AddAuthority {
 	}
 
   if (($format eq "UNIMARCAUTH") && (!$record->subfield('100','a'))){
-        $record->leader("     nx  j22             ");
+        $record->leader("     nx  j22             ") unless ($record->leader());
         my $date=POSIX::strftime("%Y%m%d",localtime);    
         if ($record->field('100')){
           $record->field('100')->update('a'=>$date."afrey50      ba0");
diff --git a/C4/Biblio.pm b/C4/Biblio.pm
index ded50fc..7e4df18 100755
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -251,6 +251,7 @@ sub AddBiblio {
     my $dbh = C4::Context->dbh;
 
     # transform the data into koha-table style data
+    SetUTF8Flag($record);
     my $olddata = TransformMarcToKoha( $dbh, $record, $frameworkcode );
     ( $biblionumber, $error ) = _koha_add_biblio( $dbh, $olddata, $frameworkcode );
     $olddata->{'biblionumber'} = $biblionumber;
@@ -299,6 +300,7 @@ sub ModBiblio {
         logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted );
     }
 
+    SetUTF8Flag($record);
     my $dbh = C4::Context->dbh;
 
     $frameworkcode = "" unless $frameworkcode;
-- 
1.6.3.3




More information about the Koha-patches mailing list