From 0bdb64200fc1c9ce8f8ecd3c30dbae66f85a8800 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Mon, 2 Mar 2009 11:29:17 +0100 Subject: [PATCH] Fix encoding items items were doubled encoded --- C4/Biblio.pm | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index 4e58a67196..5fbcc7a895 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -285,25 +285,10 @@ sub ModBiblio { foreach my $field ($record->field($itemtag)) { $record->delete_field($field); } - - # parse each item, and, for an unknown reason, re-encode each subfield - # if you don't do that, the record will have encoding mixed - # and the biblio will be re-encoded. - # strange, I (Paul P.) searched more than 1 day to understand what happends - # but could only solve the problem this way... - my @fields = $oldRecord->field( $itemtag ); - foreach my $fielditem ( @fields ){ - my $field; - foreach ($fielditem->subfields()) { - if ($field) { - $field->add_subfields(Encode::encode('utf-8',$_->[0]) => Encode::encode('utf-8',$_->[1])); - } else { - $field = MARC::Field->new("$itemtag",'','',Encode::encode('utf-8',$_->[0]) => Encode::encode('utf-8',$_->[1])); - } - } - $record->append_fields($field); - } - + + # once all the items fields are removed, copy the old ones, in order to keep synchronize + $record->append_fields($oldRecord->field( $itemtag )); + # update biblionumber and biblioitemnumber in MARC # FIXME - this is assuming a 1 to 1 relationship between # biblios and biblioitems -- 2.39.5