Bug 33329: Correctly handle UNIMARC encoding for biblios

This patch introduces the same treatment we had for bug 32336, this time
for Koha::Objects::Record::Collections.

To test:
1. Apply the regression tests patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Tests fail! Encoding is wrong for UNIMARC!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass!
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 5121f77460)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2023-04-14 17:21:15 -03:00 committed by Martin Renvoize
parent 34e9fa6e59
commit 158a52b16b
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -47,6 +47,7 @@ This class must always be subclassed.
=cut
=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.
@ -83,7 +84,10 @@ sub print_collection {
$end = MARC::File::XML::footer();
}
while ( my $element = $self->next ) {
push @parts, $serializers{$format}->( $element->record );
my $metadata = $element->metadata;
MARC::File::XML->default_record_format( $metadata->schema // C4::Context->preference("marcflavour") )
if $format eq 'marcxml';
push @parts, $serializers{$format}->( $metadata->record );
}
return
( defined $start ? $start : '' )