From 1da2f317c274c3524c499ce785c77c251e16346a 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 --- 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 b7431f5c26..c180ee2a24 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -941,7 +941,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 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