From 336ddd97caf3070f693c0466deb67c74473c1eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Wed, 14 Oct 2015 19:56:14 +0200 Subject: [PATCH] [SIGNED-OFF]Bug 14956 - (follow) Validate incoming birth date This patch validates the birthdate and resets it to empty if date is not valid. Signed-off-by: Hector Castro Works as advertised --- opac/opac-memberentry.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 22fb843..51f37d5 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -332,13 +332,10 @@ sub ParseCgiForBorrower { } } - my $dob_dt; - $dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); } - if ( defined( $borrower{'dateofbirth'} ) ); - - $borrower{'dateofbirth'} = output_pref ( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' }) - if ( $dob_dt ); - + $borrower{'dateofbirth'} = + eval { + output_pref ( { dt => dt_from_string( $borrower{'dateofbirth'} ) , dateonly => 1, dateformat => 'iso' } ); + }; return %borrower; } -- 2.1.4