Bugzilla – Attachment 179340 Details for
Bug 38330
Make bib-level suppression a biblio table field instead of part of a marc tag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38330: (QA follow-up) Remove use of metadata_extractor
Bug-38330-QA-follow-up-Remove-use-of-metadataextra.patch (text/plain), 3.73 KB, created by
Martin Renvoize (ashimema)
on 2025-03-14 16:16:05 UTC
(
hide
)
Description:
Bug 38330: (QA follow-up) Remove use of metadata_extractor
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-03-14 16:16:05 UTC
Size:
3.73 KB
patch
obsolete
>From 97d2ca6c26a1436c935a269f9d97b80dfa592fed Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 14 Mar 2025 16:09:08 +0000 >Subject: [PATCH] Bug 38330: (QA follow-up) Remove use of metadata_extractor > >We had a local method for getting opac_suppressed in Koha::Biblio which >relied on extracting from the MARC record. Now that we have an >opac_suppressed field in the Biblio table, we no longer need this >wrapper method. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Biblio.pm | 14 ----------- > Koha/Biblio/Metadata/Extractor/MARC.pm | 17 ------------- > .../Koha/Biblio/Metadata/Extractor/MARC.t | 25 +------------------ > 3 files changed, 1 insertion(+), 55 deletions(-) > >diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm >index e3971b1cb55..c9baa0d1540 100644 >--- a/Koha/Biblio.pm >+++ b/Koha/Biblio.pm >@@ -1681,20 +1681,6 @@ sub normalized_upc { > return $self->metadata_extractor->get_normalized_upc; > } > >-=head3 opac_suppressed >- >- my $opac_suppressed = $biblio->opac_suppressed(); >- >-Returns whether the record is flagged as suppressed in the OPAC. >-FIXME: Revisit after 38330 discussion >- >-=cut >- >-sub opac_suppressed { >- my ($self) = @_; >- return $self->metadata_extractor->get_opac_suppression(); >-} >- > =head3 normalized_oclc > > my $normalized_oclc = $biblio->normalized_oclc >diff --git a/Koha/Biblio/Metadata/Extractor/MARC.pm b/Koha/Biblio/Metadata/Extractor/MARC.pm >index c7f564db739..99e3f6032c5 100644 >--- a/Koha/Biblio/Metadata/Extractor/MARC.pm >+++ b/Koha/Biblio/Metadata/Extractor/MARC.pm >@@ -100,23 +100,6 @@ sub get_control_number { > return $control_number; > } > >-=head2 get_opac_suppression >- >- my $opac_suppressed = $extractor->get_opac_suppression(); >- >-Returns whether the record is flagged as suppressed in the OPAC. >-FIXME: Revisit after 38330 discussion >- >-=cut >- >-sub get_opac_suppression { >- my ($self) = @_; >- >- my $record = $self->metadata; >- >- return $record->subfield( '942', 'n' ) ? 1 : 0; >-} >- > =head3 _normalize_string > > my $normalized_string = $self->_normalize_string($string); >diff --git a/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t b/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t >index a2af91bcb41..31c30076d2a 100755 >--- a/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t >+++ b/t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 3; >+use Test::More tests => 2; > use Test::Exception; > > use t::lib::TestBuilder; >@@ -55,26 +55,3 @@ subtest 'get_control_number() tests' => sub { > is( $extractor->get_control_number, $identifier, 'Returns the right value' ); > } > }; >- >-subtest 'get_opac_suppression() tests' => sub { >- >- plan tests => 8; >- >- foreach my $marcflavour (qw( MARC21 UNIMARC )) { >- t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); >- >- my $record = MARC::Record->new(); >- my $extractor = Koha::Biblio::Metadata::Extractor->new( { metadata => $record } ); >- >- is( $extractor->get_opac_suppression(), 0, 'If 942$n absent, then not suppressed' ); >- >- $record->append_fields( MARC::Field->new( '942', q{}, q{}, n => '' ) ); >- is( $extractor->get_opac_suppression(), 0, 'If 942$n has empty string, then not suppressed' ); >- >- $record->field('942')->replace_with( MARC::Field->new( '942', q{}, q{}, n => 'potato' ) ); >- is( $extractor->get_opac_suppression(), 1, 'If 942$n has something different than false, then suppressed' ); >- >- $record->field('942')->replace_with( MARC::Field->new( '942', q{}, q{}, n => '1' ) ); >- is( $extractor->get_opac_suppression(), 1, 'If 942$n is 1, then suppressed' ); >- } >-}; >-- >2.48.1
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 38330
:
175648
|
175649
|
175650
|
175651
|
175767
|
175768
|
175769
|
175770
|
179335
|
179336
|
179337
|
179338
|
179339
| 179340 |
179341