From 8c5d11a060fc77c0d2eda03cbd3822e1c100e132 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 13 Mar 2023 14:58:21 -0300 Subject: [PATCH] Bug 32734: (QA follow-up) Remove stray method On bug 33083 we introduce a better way to implement a reusable method for the same functionality. This patch just removes the one in `Koha::Biblios` and the result should be the same as the one inherited from `Koha::Objects::Record::Collections` will be picked instead. To test: 1. Run: $ prove t/db_dependent/Koha/Biblios.t \ t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 79e3fd1640dd2dc96f9157745224a84c4e0cf632) Signed-off-by: Matt Blenkinsop --- Koha/Biblios.pm | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/Koha/Biblios.pm b/Koha/Biblios.pm index 173c1b3977..416aa2bbe5 100644 --- a/Koha/Biblios.pm +++ b/Koha/Biblios.pm @@ -24,10 +24,6 @@ use Koha::Database; use Koha::Biblio; use Koha::Libraries; -use MARC::File::MiJ; -use MARC::File::USMARC; -use MARC::File::XML; -use MARC::Record; use base qw(Koha::Objects); @@ -39,45 +35,6 @@ Koha::Biblios - Koha Biblio object set class =head2 Class methods -=head3 print_collection - my $collection_text = $result_set->print_collection($format) - -Return a text representation of a collection (group of records) in the specified format. -Allowed formats are marcxml, mij, marc and txt. Defaults to marcxml. - -=cut - -sub print_collection { - my ( $self, $format ) = @_; - - my ($start, $glue, $end, @parts); - - my %serializers = ( - 'mij' => \&MARC::File::MiJ::encode, - 'marc' => \&MARC::File::USMARC::encode, - 'txt' => \&MARC::Record::as_formatted, - 'marcxml' => \&MARC::File::XML::record - ); - if ($format eq 'mij') { - $start = '['; - $glue = ','; - $end = ']'; - } elsif ($format eq 'marc') { - $glue = "\n"; - } elsif ($format eq 'txt') { - $glue = "\n\n"; - } else { - $glue = ''; - $format = 'marcxml'; - $start = MARC::File::XML::header(); - $end = MARC::File::XML::footer(); - } - while (my $biblio = $self->next) { - push @parts, $serializers{$format}->($biblio->metadata->record); - } - return (defined $start ? $start : '').join($glue, @parts).(defined $end ? $end : ''); -} - =head3 pickup_locations my $biblios = Koha::Biblios->search(...); -- 2.39.5