Bug 14956: (followup) Fix birthday date validation in Opac

To reproduce / test:

- In Opac: Go to 'your personal details'
- Enter a valid birtday date
- In Staff client: Go to Home > Patrons > Update patron records
  (Link on start page: Patrons requesting modification)
- Verify that the birtday date is correct
- Back in Opac, clear the birthday date, try to submit
  => Validation message appears
- Enter an invalid date (32/32/2999 or 00/00/0000), try to submit
  => Birthday date field is cleared, validation message appears.

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Works as advertised. Wrong today corrected

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marc Véron 2015-11-05 14:49:23 +01:00 committed by Tomas Cohen Arazi
parent 7a46b1599e
commit 3e3ec3a14e

View file

@ -334,10 +334,15 @@ sub ParseCgiForBorrower {
my $dob_dt;
$dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); }
if ( defined( $borrower{'dateofbirth'} ) );
if ( $borrower{'dateofbirth'} );
$borrower{'dateofbirth'} = output_pref ( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' })
if ( $dob_dt );
if ( $dob_dt ) {
$borrower{'dateofbirth'} = output_pref ( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' } );
}
else {
# Trigger validation
$borrower{'dateofbirth'} = undef;
}
return %borrower;
}