Bug 8392: Category age ranges not being enforced
authorD Ruth Bavousett <ruth@bywatersolutions.com>
Mon, 9 Jul 2012 14:18:03 +0000 (10:18 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 24 Jul 2012 15:20:42 +0000 (17:20 +0200)
This patch works around the redefinition of an array that was causing the
enforcement of age ranges to not-happen.

Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

I can confirm the bug and the solution.

members/memberentry.pl

index 58f5cf1..0cf5485 100755 (executable)
@@ -101,6 +101,8 @@ 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);
@@ -264,7 +266,6 @@ if ($op eq 'save' || $op eq 'insert'){
     if (checkcardnumber($newdata{cardnumber},$newdata{borrowernumber})){ 
         push @errors, 'ERROR_cardnumber';
     } 
-    my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check) ? 1 : 0;
     if ($newdata{dateofbirth} && $dateofbirthmandatory) {
         my $age = GetAge($newdata{dateofbirth});
         my $borrowercategory=GetBorrowercategory($newdata{'categorycode'});