[Koha-patches] [PATCH] Bug 8464: Age limitations during patron creation

Adrien Saurat adrien.saurat at biblibre.com
Wed Jul 18 11:15:14 CEST 2012


The age limitations defined in patron category were not
handled during patron creation.
---
 .../prog/en/modules/members/memberentrygen.tt      |    2 +-
 members/memberentry.pl                             |   14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
index 1f28b04..bfa641e 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
@@ -168,7 +168,7 @@
 			[% END %]
 			[% IF ( ERROR_age_limitations ) %]
 				<li id="ERROR_age_limitations">Patron's age is incorrect for their category.  
-					Ages allowed are [% ERROR_age_limitations %].</li>
+					Ages allowed are [% allowedAgeRange %].</li>
 			[% END %]
 			[% IF ( ERROR_branch ) %]
 				<li id="ERROR_branch">Library is invalid.</li>
diff --git a/members/memberentry.pl b/members/memberentry.pl
index 58f5cf1..724d438 100755
--- a/members/memberentry.pl
+++ b/members/memberentry.pl
@@ -97,14 +97,14 @@ $template->param("minPasswordLength" => $minpw);
 
 # function to designate mandatory fields (visually with css)
 my $check_BorrowerMandatoryField=C4::Context->preference("BorrowerMandatoryField");
-my @field_check=split(/\|/,$check_BorrowerMandatoryField);
-foreach (@field_check) {
+my @field_check_mandatory=split(/\|/,$check_BorrowerMandatoryField);
+foreach (@field_check_mandatory) {
 	$template->param( "mandatory$_" => 1);    
 }
 # function to designate unwanted fields
 my $check_BorrowerUnwantedField=C4::Context->preference("BorrowerUnwantedField");
- at field_check=split(/\|/,$check_BorrowerUnwantedField);
-foreach (@field_check) {
+my @field_check_unwanted=split(/\|/,$check_BorrowerUnwantedField);
+foreach (@field_check_unwanted) {
     next unless m/\w/o;
 	$template->param( "no$_" => 1);
 }
@@ -263,15 +263,15 @@ 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;
+    }
+    my $dateofbirthmandatory = (scalar grep {$_ eq "dateofbirth"} @field_check_mandatory) ? 1 : 0;
     if ($newdata{dateofbirth} && $dateofbirthmandatory) {
         my $age = GetAge($newdata{dateofbirth});
         my $borrowercategory=GetBorrowercategory($newdata{'categorycode'});   
         my ($low,$high) = ($borrowercategory->{'dateofbirthrequired'}, $borrowercategory->{'upperagelimit'});
         if (($high && ($age > $high)) or ($age < $low)) {
             push @errors, 'ERROR_age_limitations';
-            $template->param('ERROR_age_limitations' => "$low to $high");
+            $template->param('allowedAgeRange' => "$low to $high");
         }
     }
   
-- 
1.7.4.1



More information about the Koha-patches mailing list