Bug 27837: (follow-up) Do not check subfield unless tag defined

This was causing extra warnings when the permanent_location field was
unmapped.

We only need to check if there is a field defined as you can define a mapping
without both a field and subfield, so the existence of one implies the other

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2021-05-11 11:08:17 +00:00 committed by Jonathan Druart
parent f5bd16410a
commit 0e00dc78e4
1 changed files with 1 additions and 1 deletions

View File

@ -305,7 +305,7 @@ sub ModItemFromMarc {
my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' );
my ( $perm_loc_tag, $perm_loc_subfield ) = C4::Biblio::GetMarcFromKohaField( "items.permanent_location" );
my $has_permanent_location = defined $item_marc->subfield( $perm_loc_tag, $perm_loc_subfield );
my $has_permanent_location = defined $perm_loc_tag && defined $item_marc->subfield( $perm_loc_tag, $perm_loc_subfield );
# Retrieving the values for the fields that are not linked
my @mapped_fields = Koha::MarcSubfieldStructures->search(