From 5121f774604a533560c9a8e08ed357e30a5d1ddd Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 14 Apr 2023 17:21:15 -0300 Subject: [PATCH] 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 Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- Koha/Objects/Record/Collections.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/Objects/Record/Collections.pm b/Koha/Objects/Record/Collections.pm index 4be5b8e387..7874abae7f 100644 --- a/Koha/Objects/Record/Collections.pm +++ b/Koha/Objects/Record/Collections.pm @@ -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 : '' ) -- 2.39.5