From a38b55e258eba808c57f285c0e3b0e81d8742317 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 9 Jul 2021 12:30:35 +0100 Subject: [PATCH] Bug 11175: (follow-up) Rename routine get_marc_components For consistency with other marc data accessor methods rename the new 'components' method to 'get_marc_components'. Signed-off-by: Martin Renvoize Signed-off-by: Andrew Nugged Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- C4/XSLT.pm | 4 ++-- Koha/Biblio.pm | 6 +++--- t/db_dependent/Koha/Biblio.t | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index d5a2395b59..2893dbf85c 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -291,12 +291,12 @@ sub XSLTParse4Display { my $biblio = Koha::Biblios->find( $biblionumber ); my $max_results = 300; - if ( $biblio->components($max_results) ) { + if ( $biblio->get_marc_components($max_results) ) { my $search_query = Koha::Util::Search::get_component_part_query($biblionumber); $variables->{ComponentPartQuery} = $search_query; my @componentPartRecordXML = (''); - for my $cb ( @{ $biblio->components($max_results) } ) { + for my $cb ( @{ $biblio->get_marc_components($max_results) } ) { if( ref $cb eq 'MARC::Record'){ $cb = $cb->as_xml_record(); } else { diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index 69fd30fbb9..17f7db4f17 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -479,16 +479,16 @@ sub suggestions { return Koha::Suggestions->_new_from_dbic( $suggestions_rs ); } -=head3 components +=head3 get_marc_components -my $components = $self->components(); + my $components = $self->get_marc_components(); Returns an array of MARCXML data, which are component parts of this object (MARC21 773$w points to this) =cut -sub components { +sub get_marc_components { my ($self, $max_results) = @_; return if (C4::Context->preference('marcflavour') ne 'MARC21'); diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 01ef1e44e3..2a9e49e136 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -507,7 +507,7 @@ subtest 'suggestions() tests' => sub { $schema->storage->txn_rollback; }; -subtest 'components() tests' => sub { +subtest 'get_marc_components() tests' => sub { plan tests => 3; @@ -519,13 +519,13 @@ subtest 'components() tests' => sub { my $search_mod = Test::MockModule->new( 'Koha::SearchEngine::Zebra::Search' ); $search_mod->mock( 'simple_search_compat', \&search_component_record2 ); - my @components = $host_biblio->components; + my @components = $host_biblio->get_marc_components; is( ref(\@components), 'ARRAY', 'Return type is correct' ); is_deeply( [@components], [()], - '->components returns an empty ARRAY' + '->get_marc_components returns an empty ARRAY' ); $search_mod->unmock( 'simple_search_compat'); @@ -533,9 +533,9 @@ subtest 'components() tests' => sub { my $component_record = component_record1()->as_xml(); is_deeply( - $host_biblio->components, + $host_biblio->get_marc_components, [($component_record)], - '->components returns the related component part record' + '->get_marc_components returns the related component part record' ); $search_mod->unmock( 'simple_search_compat'); -- 2.39.5