From cc393df50fb1862925c3122aeadd579a627912c6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 28 Apr 2015 11:45:46 +0200 Subject: [PATCH] Bug 11925: Check ages limits when creating/updating patrons The check on the ages limits is only done when the dateofbirth field is mandatory, which does not make any sense. This check should be done when the field is filled. Test plan: 1/ Remove the dateofbirth field from the BorrowerMandatoryField pref 2/ Create a patron category for teenager (say between 12-17y) 3/ Try to create a patron in this category outside the range of the ages limits. You should not be able to do it. Signed-off-by: Christopher Brannon Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- members/memberentry.pl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/members/memberentry.pl b/members/memberentry.pl index 22bceabaae..967ebd11a3 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -135,8 +135,6 @@ my @field_check=split(/\|/,$check_BorrowerMandatoryField); foreach (@field_check) { $template->param( "mandatory$_" => 1); } -# we'll need this, later. -my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check) ? 1 : 0; # function to designate unwanted fields my $check_BorrowerUnwantedField=C4::Context->preference("BorrowerUnwantedField"); @field_check=split(/\|/,$check_BorrowerUnwantedField); @@ -305,7 +303,7 @@ if ($op eq 'save' || $op eq 'insert'){ : () } - if ($newdata{dateofbirth} && $dateofbirthmandatory) { + if ( $newdata{dateofbirth} ) { my $age = GetAge($newdata{dateofbirth}); my $borrowercategory=GetBorrowercategory($newdata{'categorycode'}); my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'}); -- 2.11.0