Bug 26211: Patron age verification while doing the self-registration.
To Test
1. Create the patron category from the staff page for ex: Kid and give age required and age Upperage limit
age required 5 yrs and upperage limit 17.
2. Allow category in PatronSelfRegistrationDefaultCategory for online registration from opac.
3. Go to /cgi-bin/koha/opac-memberentry.pl page.
4. Fill the form and give choose date of birth 10/10/1974 and click OK. Now you can able to save the page.
5. Apply the patch.
6. Again go to cgi-bin/koha/opac-memberentry.pl page.
7. Fill the form and give choose date of birth 10/10/1974 and click OK. It will give the error message.
Patron's age is incorrect for their category. Ages allowed are 5-17.
Signed-off-by: Sam Sowanick <sam.sowanick@corvallisoregon.gov>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 579389ed32)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
parent
d8ad5d8637
commit
0c20d9ac45
|
|
@ -115,6 +115,9 @@
|
|||
[% IF field == "email_match" %]
|
||||
<li>Emails do not match! <a href="#borrower_repeat_email">confirm email address</a></li>
|
||||
[% END %]
|
||||
[% IF field == "ERROR_age_limitations" %]
|
||||
<li>Patron's age is incorrect for their category. Ages allowed are [% age_low | html %]-[% age_high | html %].</li>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</ul>
|
||||
<span>Please correct and resubmit.</span>
|
||||
|
|
|
|||
|
|
@ -532,6 +532,18 @@ sub CheckForInvalidFields {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $borrower->{'dateofbirth'} ) {
|
||||
my $patron = Koha::Patron->new( { dateofbirth => $borrower->{'dateofbirth'} } );
|
||||
my $age = $patron->get_age;
|
||||
my $borrowercategory = Koha::Patron::Categories->find( $borrower->{'categorycode'} );
|
||||
my ( $low, $high ) = ( $borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit );
|
||||
if ( ( $high && ( $age > $high ) ) or ( $age < $low ) ) {
|
||||
push @invalidFields, 'ERROR_age_limitations';
|
||||
$template->param( age_low => $low);
|
||||
$template->param( age_high => $high);
|
||||
}
|
||||
}
|
||||
|
||||
return \@invalidFields;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue