[Koha-patches] [PATCH] Bug 5909 : SetUTF8Flag on any incoming data

Chris Cormack chrisc at catalyst.net.nz
Sun Mar 20 23:40:43 CET 2011


From: Henri-Damien LAURENT <henridamien.laurent at biblibre.com>

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 f3cc948..3e6ca18 100644
--- a/C4/AuthoritiesMarc.pm
+++ b/C4/AuthoritiesMarc.pm
@@ -624,6 +624,7 @@ sub AddAuthority {
       $f5->update($time.".0");
     }
 
+    SetUTF8Flag($record);
 	if ($format eq "MARC21") {
 		if (!$record->leader) {
 			$record->leader($leader);
@@ -650,7 +651,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 0914d35..8143ee1 100644
--- a/C4/Biblio.pm
+++ b/C4/Biblio.pm
@@ -250,6 +250,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;
@@ -294,6 +295,7 @@ sub ModBiblio {
         logaction( "CATALOGUING", "MODIFY", $biblionumber, "BEFORE=>" . $newrecord->as_formatted );
     }
 
+    SetUTF8Flag($record);
     my $dbh = C4::Context->dbh;
 
     $frameworkcode = "" unless $frameworkcode;
-- 
1.7.1



More information about the Koha-patches mailing list