From d0a42a0113b5f488a56c704bfcc985776865a3fb Mon Sep 17 00:00:00 2001 From: Paul Derscheid Date: Fri, 19 Aug 2022 15:13:31 +0200 Subject: [PATCH] Bug 25870 - (follow-up) Raw MARC-XML records from Zebra now get appropriate treatment To test: 1) Apply the patch 2) Pick an endpoint tester of your choice, e.g. Insomnia or the ThunderClient if you use VSCode or derivatives. 3) Run a query while using Zebra. 4) Observe the marc-in-json response and check for validity. 5) Run a query while using Elasticsearch. 6) Again, observe the marc-in-json response and check for validity. 7) Not ready for sign-off but please leave a comment or help me on the Koha::Biblios->search thing. --- Koha/REST/V1/Biblios.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 15e8e939ed..02f8af036b 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -171,10 +171,16 @@ sub get_biblios_public { my $patron = $c->stash('koha.user'); my $is_public = $c->stash('is_public'); my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems'); - my @biblionumbers = map { $_->field('999')->subfield('c') } $results->@*; + my $searchengine = C4::Context->preference('SearchEngine'); + + my @biblionumbers + = $searchengine eq 'Zebra' + ? map { MARC::Record->new_from_xml( $_, 'UTF-8' )->field('999')->subfield('c') } $results->@* + : map { $_->field('999')->subfield('c') } $results->@*; my @biblios = map { Koha::Biblios->find( { biblionumber => $_ } ) } @biblionumbers; my @records = map { - next if ( $is_public && !( $patron && $patron->category->override_hidden_items ) + next if ( $is_public + && !( $patron && $patron->category->override_hidden_items ) && $_->hidden_in_opac( { rules => $opachiddenitems_rules } ) ); $_->metadata->record; } @biblios; @@ -473,4 +479,4 @@ sub get_items_public { }; } -1; \ No newline at end of file +1; -- 2.31.1