From f5e0d6a1f28754ca832be7895881b6708185e753 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 7 Jun 2022 13:17:04 +0100 Subject: [PATCH] Bug 30744: Optionally allow passing record to prevent refetch This patch adds the option to pass the marcrecord into the call to prevent the extra DB fetch of the record. --- Koha/Biblio.pm | 4 ++-- opac/opac-detail.pl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 1c387c4487..cd59f28c41 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -913,7 +913,7 @@ sub cover_images { =head3 get_marc_notes - $marcnotesarray = $biblio->get_marc_notes({ opac => 1 }); + $marcnotesarray = $biblio->get_marc_notes({ opac => 1, [ record => $marc ] }); Get all notes from the MARC record and returns them in an array. The notes are stored in different fields depending on MARC flavour. @@ -928,7 +928,7 @@ sub get_marc_notes { my $opac = $params->{opac} // '0'; my $interface = $params->{opac} ? 'opac' : 'intranet'; - my $record = $self->metadata->record; + my $record = $params->{record} // $self->metadata->record; my $record_processor = Koha::RecordProcessor->new( { filters => [ 'ViewPolicy', 'ExpandCodedFields' ], diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index f6b713542d..8957f55567 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -796,7 +796,7 @@ if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) { } } -my $marcnotesarray = $biblio->get_marc_notes({ opac => 1 }); +my $marcnotesarray = $biblio->get_marc_notes({ opac => 1, record => $record }); if( C4::Context->preference('ArticleRequests') ) { my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef; -- 2.20.1