Bug 38416: Tidy

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 8b952b1a34)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
David Cook 2024-11-11 22:17:58 +00:00 committed by Lucas Gass
parent 464967abbe
commit 42490c2918
2 changed files with 15 additions and 11 deletions

View File

@ -794,14 +794,15 @@ sub marc_records_to_documents {
#NOTE: Try to round-trip the record to prove it will work for retrieval after searching
my $decoded_usmarc_record = MARC::Record->new_from_usmarc($usmarc_record);
if ($decoded_usmarc_record->warnings()){
if ( $decoded_usmarc_record->warnings() ) {
#NOTE: We override the warnings since they're many and misleading
@warnings = (
"Warnings encountered while roundtripping a MARC record to/from USMARC. Failing over to MARCXML.",
);
}
my $marc_data = encode_base64(encode('UTF-8', $usmarc_record));
my $marc_data = encode_base64( encode( 'UTF-8', $usmarc_record ) );
$record_document->{'marc_data'} = $marc_data;
}
if (@warnings) {

View File

@ -756,20 +756,23 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
$marc_record_with_large_field->leader(' cam 22 a 4500');
$marc_record_with_large_field->append_fields(
MARC::Field->new('100', '', '', a => 'Author 1'),
MARC::Field->new('245', '', '', a => 'Title:', b => 'record with large field'),
MARC::Field->new('500', '', '', a => 'X' x 15000),
MARC::Field->new('999', '', '', c => '1234567'),
MARC::Field->new( '100', '', '', a => 'Author 1' ),
MARC::Field->new( '245', '', '', a => 'Title:', b => 'record with large field' ),
MARC::Field->new( '500', '', '', a => 'X' x 15000 ),
MARC::Field->new( '999', '', '', c => '1234567' ),
);
$docs = $see->marc_records_to_documents([$marc_record_with_large_field]);
$docs = $see->marc_records_to_documents( [$marc_record_with_large_field] );
is($docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly');
is( $docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly' );
$decoded_marc_record = $see->decode_record_from_result($docs->[0]);
$decoded_marc_record = $see->decode_record_from_result( $docs->[0] );
ok($decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result");
is($decoded_marc_record->as_xml_record(), $marc_record_with_large_field->as_xml_record(), "Decoded MARCXML record has same data as original record");
ok( $decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result" );
is(
$decoded_marc_record->as_xml_record(), $marc_record_with_large_field->as_xml_record(),
"Decoded MARCXML record has same data as original record"
);
};