From 09bad8b26a31c09e1331df152f3d947f07a414f7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 28 Oct 2024 16:42:08 -0300 Subject: [PATCH] Bug 31224: Adapt GET /public/biblios/:biblio_id controller Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart --- Koha/REST/V1/Biblios.pm | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index ae4d5d1c26c..035d215c52f 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -22,7 +22,6 @@ use Mojo::Base 'Mojolicious::Controller'; use Koha::Biblios; use Koha::DateUtils; use Koha::Ratings; -use Koha::RecordProcessor; use C4::Biblio qw( DelBiblio AddBiblio ModBiblio ); use C4::Search qw( FindDuplicate ); @@ -162,32 +161,19 @@ sub get_public { return try { - my $metadata = $biblio->metadata; - my $record = $metadata->record; - - my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems'); + my $schema = $biblio->metadata->schema // C4::Context->preference("marcflavour"); my $patron = $c->stash('koha.user'); - # Check if the biblio should be hidden for unprivileged access - # unless there's a logged in user, and there's an exception for it's - # category + # Check if the bibliographic record should be hidden for unprivileged access + # unless there's a logged in user, and there's an exception for it's category + my $opachiddenitems_rules = C4::Context->yaml_preference('OpacHiddenItems'); unless ( $patron and $patron->category->override_hidden_items ) { if ( $biblio->hidden_in_opac( { rules => $opachiddenitems_rules } ) ) { return $c->render_resource_not_found("Bibliographic record"); } } - my $schema = $metadata->schema // C4::Context->preference("marcflavour"); - - my $record_processor = Koha::RecordProcessor->new({ - filters => 'ViewPolicy', - options => { - interface => 'opac', - frameworkcode => $biblio->frameworkcode - } - }); - # Apply framework's filtering to MARC::Record object - $record_processor->process($record); + my $record = $biblio->metadata_record( { interface => 'opac', patron => $patron } ); $c->respond_to( marcxml => { -- 2.34.1