From 0efae9ed0565aac7ade8b9febfcd0e44fe35d420 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 7 Jun 2022 13:45:14 +0100 Subject: [PATCH] Bug 30918: Allow passing filtered record to get_marc_notes This patch does the absolute bare minimum to prevent private notes from appearing on the OPAC. Test plan 1. Go to Koha Administration -> Koha bibliographic frameworks 2. View the MARC structure for your BKS framework (or something else) 3. Search for tag 583, edit subfields 4. Go to subfield 'x' - nonpublic note. Confirm the OPAC visibility checkbox is UNCHECKED. 5. Edit or create a record using the BKS framework. Put a note in the 583$x. 6. View this record in the OPAC 7. Go to the Title notes tab. Confirm the non-public note is showing, even though the framework says it should not be visible via the OPAC. 8. Apply patch 9. Confirm the non-public note is no longer visible Signed-off-by: Owen Leonard Signed-off-by: Tomas Cohen Arazi --- Koha/Biblio.pm | 2 +- opac/opac-detail.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index ea0c9d9f84..4f77b5c914 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -949,7 +949,7 @@ sub get_marc_notes { my %hiddenlist = map { $_ => 1 } split( /,/, C4::Context->preference('NotesToHide')); - my $record = $self->metadata->record; + my $record = $params->{record} // $self->metadata->record; $record = transformMARCXML4XSLT( $self->biblionumber, $record, $opac ); foreach my $field ( $record->field($scope) ) { diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 7219eef18e..acd20e6308 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -799,7 +799,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.39.5