From 0e00dc78e4ed01678f037a970487fd871fa3e70f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 11 May 2021 11:08:17 +0000 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart --- C4/Items.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 729c6e0b48..1f0d560e86 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -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( -- 2.39.5