Bug 25050: Adjust marc_records_to_documents to search entire mapping array

There was an assumption in the ES code that match-heading mappings will appear in
a specified portion of the mappings array.

Certain mappings setups will not meet this assumption.
We need to move our searching up one level

The key seems to be having a mapping for a complete field, say 150, in both the
match-heading and another field as well as having mappings for ungrouped fields like
150a 150ab etc.

The unit test coverage should be sufficient for testing

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2020-04-03 12:14:27 +00:00 committed by Martin Renvoize
parent f7cb465603
commit a22315ef61
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 1 additions and 1 deletions

View File

@ -577,7 +577,7 @@ sub marc_records_to_documents {
}
);
}
if ( defined @{$mappings}[0] && grep /match-heading/, @{@{$mappings}[0]} ){
if ( @{$mappings} && grep { $_->[0] eq 'match-heading'} @{$mappings} ){
# Used by the authority linker the match-heading field requires a specific syntax
# that is specified in C4/Heading
my $heading = C4::Heading->new_from_field( $field, undef, 1 ); #new auth heading