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 <victor@tuxayo.net>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Fridolin Somers 2020-09-09 13:54:34 +02:00 committed by Jonathan Druart
parent 31ec92bfab
commit f042c804cd
1 changed files with 1 additions and 1 deletions

View File

@ -1166,7 +1166,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