From b9e8dfd10367e7166b6a89fc69cc0574ee022033 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Sep 2015 13:34:34 +0100 Subject: [PATCH] Bug 12478: Fix encoding issues on indexing There were encoding issues on indexing, the way to build a marc record was the old way (retrieved from the noxml style from rebuild_zebra). Here we should either c/p the code from C4::Biblio::GetMarcBiblio or call it directly (what this patch does). --- Koha/Biblio.pm | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 6c975d6..9bfe60f 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -112,15 +112,13 @@ sub get_all_biblios_iterator { my $database = Koha::Database->new(); my $schema = $database->schema(); my $rs = - $schema->resultset('Biblioitem')->search( { marc => { '!=', undef } }, - { columns => [qw/ biblionumber marc /] } ); + $schema->resultset('Biblio')->search( {}, + { columns => [qw/ biblionumber /] } ); my $next_func = sub { my $row = $rs->next(); return undef if !$row; - my $marc = MARC::Record->new_from_usmarc( $row->marc ); - my $bibnum = $row->get_column('biblionumber'); - C4::Biblio::EmbedItemsInMarcBiblio( $marc, $bibnum ); - return __PACKAGE__->new($marc, $bibnum); + my $marc = C4::Biblio::GetMarcBiblio( $row->biblionumber, 1 ); + return __PACKAGE__->new($marc, $row->biblionumber); }; return Koha::MetadataIterator->new($next_func); } @@ -148,21 +146,7 @@ If set to true, item data is embedded in the record. Default is to not do this. sub get_marc_biblio { my ($class, $bibnum, %options) = @_; - my $database = Koha::Database->new(); - my $schema = $database->schema(); - my $rs = - $schema->resultset('Biblioitem') - ->search( { marc => { '!=', undef }, biblionumber => $bibnum }, - { columns => [qw/ marc /] } ); - - my $row = $rs->next(); - return unless $row; - my $marc = MARC::Record->new_from_usmarc($row->marc); - - # TODO implement this in this module - C4::Biblio::EmbedItemsInMarcBiblio($marc, $bibnum) if $options{item_data}; - - return $marc; + return C4::Biblio::GetMarcBiblio( $bibnum, ($options{item_data} ? 1 : 0 ) ); } 1; -- 2.1.0