Browse Source

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 <tomascohen@theke.io>
23.05.x
Tomás Cohen Arazi 1 year ago
parent
commit
79e3fd1640
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 43
      Koha/Biblios.pm

43
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 Koha::Objects::Record::Collections);
@ -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(...);

Loading…
Cancel
Save