From ee58d118434c9e3bd12ad9cdfcb56a09f2bb073d Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Wed, 12 Jan 2022 13:13:56 +0200 Subject: [PATCH] Bug 29858: NULL $field var causing "Use of uninitialized value" warn Some fields might be null which causes "Use of uninitialized value in string eq at .../Koha/Item.pm line 639." warn. This patch prevents this warn to get thrown by checking if the field is defined first. --- Koha/Item.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Item.pm b/Koha/Item.pm index d70fbc3f8f..2d1622144b 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -620,7 +620,7 @@ sub hidden_in_opac { foreach my $field ( keys %{$rules} ) { - if ( any { $self->$field eq $_ } @{ $rules->{$field} } ) { + if ( any { defined $self->$field and $self->$field eq $_ } @{ $rules->{$field} } ) { $hidden_in_opac = 1; last; } -- 2.31.1