From 12a8c4562bd5d95dcad51af109063fdfd7132944 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 9 Sep 2020 13:54:34 +0200 Subject: [PATCH] Bug 26417: Remove warn in Koha::Patron is_valid_age In Koha::Patron is_valid_age the is a compare : $age < $low But $low may be undef. It generates a warn : Use of uninitialized value $low in numeric lt (<) Needs a test like for $high. Test plan : 1) Run prove t/db_dependent/Koha/Patrons.t 2) Edit a patron catetory, empty "Age required" and save 3) Edit a patron of this category 4) Check in logs you don't see "Use of uninitialized value $low in numeric lt (<)" Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Julian Maurice Signed-off-by: Jonathan Druart (cherry picked from commit f042c804cda09deaee614f73ec9a888bea4ab99a) Signed-off-by: Fridolin Somers (cherry picked from commit ba7cee5b17b13566fdf82019f5576db497d03bff) Signed-off-by: Andrew Fuerste-Henry --- Koha/Patron.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 867a60cee3..2a56a7f852 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1119,7 +1119,7 @@ sub is_valid_age { my $patroncategory = $self->category; my ($low,$high) = ($patroncategory->dateofbirthrequired, $patroncategory->upperagelimit); - return (defined($age) && (($high && ($age > $high)) or ($age < $low))) ? 0 : 1; + return (defined($age) && (($high && ($age > $high)) or ($low && ($age < $low)))) ? 0 : 1; } =head3 account -- 2.39.5