From 85e6e197fbe4b1d72a58f9c296159f8ce9326eb5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 12 Oct 2021 09:49:34 +0100 Subject: [PATCH] Bug 11175: (QA follow-up) Account for difference in simple_search return Thanks to a comment from Andrew, I discovered that the return from simple_search_compat actually differs depending on if you are using ElasticSearch or Zebra. The 'results' arrayref contains MARC::Record objects for ES and raw marc strings if you are using Zebra. This is actually already dealt with in the misnamed new_record_from_zebra function inside C4::Search.. so this patch simply replaces our MARC::Record instantiation code with a call to that function. Signed-off-by: Martin Renvoize Signed-off-by: Andrew Nugged Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- catalogue/detail.pl | 4 ++-- opac/opac-detail.pl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 2495352c6b..cb2d00734c 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -39,7 +39,7 @@ use C4::Reserves; use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); use C4::XISBN qw( get_xisbns ); use C4::External::Amazon qw( get_amazon_tld ); -use C4::Search qw( z3950_search_args enabled_staff_search_views ); +use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra ); use C4::Tags qw( get_tags ); use C4::XSLT qw( XSLTParse4Display ); use Koha::DateUtils qw( format_sqldatetime ); @@ -217,7 +217,7 @@ if ( $showcomp eq 'both' || $showcomp eq 'staff' ) { if ( my $components = $biblio->get_marc_components(300) ) { my $parts; for my $part ( @{$components} ) { - $part = MARC::Record->new_from_xml( $part, 'UTF-8' ); + $part = C4::Search::new_record_from_zebra( 'biblioserver', $part ); push @{$parts}, XSLTParse4Display( diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 05f8967dad..43d675222d 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -32,6 +32,7 @@ use C4::Koha qw( GetNormalizedOCLCNumber GetNormalizedUPC ); +use C4::Search qw( new_record_from_zebra ); use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials ); use C4::Output qw( parametrized_url output_html_with_http_headers ); use C4::Biblio qw( @@ -233,7 +234,6 @@ if ($OpacBrowseResults) { my $session = get_session($query->cookie("CGISESSID")); my %paging = (previous => {}, next => {}); if ($session->param('busc')) { - use C4::Search; use URI::Escape qw( uri_escape_utf8 uri_unescape ); # Rebuild the string to store on session @@ -663,7 +663,7 @@ if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { if ( my $components = $biblio->get_marc_components(300) ) { my $parts; for my $part ( @{$components} ) { - $part = MARC::Record->new_from_xml( $part, 'UTF-8' ); + $part = C4::Search::new_record_from_zebra( 'biblioserver', $part ); push @{$parts}, XSLTParse4Display( -- 2.39.5