Bugzilla – Attachment 94642 Details for
Bug 23392
Support MARC21 indicators for private note fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23392: Don;t display private notes in MARC 21
Bug-23392-Dont-display-private-notes-in-MARC-21.patch (text/plain), 4.92 KB, created by
Katrin Fischer
on 2019-10-24 06:02:04 UTC
(
hide
)
Description:
Bug 23392: Don;t display private notes in MARC 21
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2019-10-24 06:02:04 UTC
Size:
4.92 KB
patch
obsolete
>From 239d6cd76b2f78ad6f387228be5827c416a72bfa Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 29 Jul 2019 13:19:19 +0000 >Subject: [PATCH] Bug 23392: Don;t display private notes in MARC 21 > >To test: >1 - Add some notes to a record in fields 541,542,561,583,590 >2 - Ensure all of these are visible in the frameworks >3 - Note they appear in the 'Title notes'/'Description' tabs on OPAC/Staff client >4 - Mark first indicator '0' on all notes >5 - They still display >6 - Apply patch >7 - Notes no longer show on OPAC >8 - Notes still show on Staff client >9 - prove -v t/Biblio/GetMarcNotes.t > >Signed-off-by: Myka Kennedy Stephens <mkstephens@lancasterseminary.edu> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Biblio.pm | 13 ++++++++++++- > opac/opac-basket.pl | 2 +- > opac/opac-detail.pl | 2 +- > t/Biblio/GetMarcNotes.t | 15 +++++++++++++-- > 4 files changed, 27 insertions(+), 5 deletions(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 55a2c01890..443e445245 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1495,7 +1495,7 @@ sub GetMarcISSN { > =cut > > sub GetMarcNotes { >- my ( $record, $marcflavour ) = @_; >+ my ( $record, $marcflavour, $opac ) = @_; > if (!$record) { > carp 'GetMarcNotes called on undefined record'; > return; >@@ -1503,11 +1503,22 @@ sub GetMarcNotes { > > my $scope = $marcflavour eq "UNIMARC"? '3..': '5..'; > my @marcnotes; >+ >+ #MARC21 specs indicate some notes should be private if first indicator 0 >+ my %maybe_private = ( >+ 541 => 1, >+ 542 => 1, >+ 561 => 1, >+ 583 => 1, >+ 590 => 1 >+ ); >+ > my %blacklist = map { $_ => 1 } > split( /,/, C4::Context->preference('NotesBlacklist')); > foreach my $field ( $record->field($scope) ) { > my $tag = $field->tag(); > next if $blacklist{ $tag }; >+ next if $opac && $maybe_private{$tag} && !$field->indicator(1); > if( $marcflavour ne 'UNIMARC' && $field->subfield('u') ) { > # Field 5XX$u always contains URI > # Examples: 505u, 506u, 510u, 514u, 520u, 530u, 538u, 540u, 542u, 552u, 555u, 561u, 563u, 583u >diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl >index dc385431e9..6a454bedf0 100755 >--- a/opac/opac-basket.pl >+++ b/opac/opac-basket.pl >@@ -81,7 +81,7 @@ foreach my $biblionumber ( @bibs ) { > }); > $record_processor->process($record); > next unless $record; >- my $marcnotesarray = GetMarcNotes( $record, $marcflavour ); >+ my $marcnotesarray = GetMarcNotes( $record, $marcflavour, 1 ); > my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour ); > my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); > my $marcseriesarray = GetMarcSeries ($record,$marcflavour); >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e55ecb6a39..0facd004b9 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -766,7 +766,7 @@ if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) { > ); > } > >-my $marcnotesarray = GetMarcNotes ($record,$marcflavour); >+my $marcnotesarray = GetMarcNotes ($record,$marcflavour,1); > > if( C4::Context->preference('ArticleRequests') ) { > my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef; >diff --git a/t/Biblio/GetMarcNotes.t b/t/Biblio/GetMarcNotes.t >index 6068dcd92a..bb55226bdc 100755 >--- a/t/Biblio/GetMarcNotes.t >+++ b/t/Biblio/GetMarcNotes.t >@@ -26,7 +26,7 @@ use MARC::Record; > use C4::Biblio; > > subtest 'GetMarcNotes MARC21' => sub { >- plan tests => 4; >+ plan tests => 11; > t::lib::Mocks::mock_preference( 'NotesBlacklist', '520' ); > > my $record = MARC::Record->new; >@@ -34,12 +34,23 @@ subtest 'GetMarcNotes MARC21' => sub { > MARC::Field->new( '500', '', '', a => 'Note1' ), > MARC::Field->new( '505', '', '', a => 'Note2', u => 'http://someserver.com' ), > MARC::Field->new( '520', '', '', a => 'Note3 skipped' ), >+ MARC::Field->new( '541', '0', '', a => 'Note4 skipped on opac' ), >+ MARC::Field->new( '541', '', '', a => 'Note5' ), > ); > my $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21' ); > is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); > is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); > is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); >- is( @$notes, 3, 'No more notes' ); >+ is( $notes->[3]->{marcnote}, 'Note4 skipped on opac',"Not shows if not opac" ); >+ is( $notes->[4]->{marcnote}, 'Note5', 'Fifth note' ); >+ is( @$notes, 5, 'No more notes' ); >+ $notes = C4::Biblio::GetMarcNotes( $record, 'MARC21', 1 ); >+ is( $notes->[0]->{marcnote}, 'Note1', 'First note' ); >+ is( $notes->[1]->{marcnote}, 'Note2', 'Second note' ); >+ is( $notes->[2]->{marcnote}, 'http://someserver.com', 'URL separated' ); >+ is( $notes->[3]->{marcnote}, 'Note5', 'Fifth note shows after fourth skipped' ); >+ is( @$notes, 4, 'No more notes' ); >+ > }; > > subtest 'GetMarcNotes UNIMARC' => sub { >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23392
:
91851
|
94632
|
94633
|
94634
| 94642