From fc6506af15c90bf47262335e09bddd4604eecec6 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 4 Sep 2020 12:25:17 +0400 Subject: [PATCH] Bug 25375: Get biblionumber from the correct MARC field Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Nick Clemens --- Koha/SearchEngine/Elasticsearch.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm index 885e59fc15..3583172045 100644 --- a/Koha/SearchEngine/Elasticsearch.pm +++ b/Koha/SearchEngine/Elasticsearch.pm @@ -29,6 +29,7 @@ use Koha::SearchMarcMaps; use Koha::Caches; use C4::Heading; use C4::AuthoritiesMarc; +use C4::Biblio; use Carp; use Clone qw(clone); @@ -706,7 +707,10 @@ sub marc_records_to_documents { # Check if there is at least one available item if ($self->index eq $BIBLIOS_INDEX) { - my $biblio = Koha::Biblios->find($record->field('001')->data); + my ($tag, $code) = GetMarcFromKohaField('biblio.biblionumber'); + my $field = $record->field($tag); + my $biblionumber = $field->is_control_field ? $field->data : $field->subfield($code); + my $biblio = Koha::Biblios->find($biblionumber); my $items = $biblio->items; my $available = 0; while (my $item = $items->next) { -- 2.11.0