Following patron modification partial editor had no age constraint
checking:
/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=3&step=3
Test plan:
1) Apply the patch
2) Open profile of a patron
3) Click Edit under "Library use": http://prntscr.com/d1ghim
4) Change category to an invalid one (eg. Adult instead of Kid)
5) Error saying "Patron's age is incorrect for their category." should
be displayed.
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Lucio Moraes <lmoraes@catalyst.net.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
: ()
}
- if ( $newdata{dateofbirth} ) {
- my $age = GetAge($newdata{dateofbirth});
+ my $dateofbirth;
+ if ($op eq 'save' && $step == 3) {
+ my $borrower = C4::Members::GetMember(borrowernumber => $borrowernumber);
+ $dateofbirth = $borrower->{dateofbirth};
+ }
+ else {
+ $dateofbirth = $newdata{dateofbirth};
+ }
+
+ if ( $dateofbirth ) {
+ my $age = GetAge($dateofbirth);
my $borrowercategory = Koha::Patron::Categories->find($categorycode);
my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit);
if (($high && ($age > $high)) or ($age < $low)) {