From c21ae5e5177ec9180f07fd5639b7e9912aadfdc1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 16 Jun 2020 08:00:45 -0400 Subject: [PATCH] Bug 25769: Patron self modification triggers change request for date of birth to null If PatronSelfModificationBorrowerUnwantedField contains dateofbirth, all patron self modification requests will attempt to set dateofbirth to null instead of ignoring the field. Test Plan: 1) Add dateofbirth to PatronSelfModificationBorrowerUnwantedField 2) Run a patron self modification 3) Note the request sets dateofbirth to null on the staff side 4) Apply this patch 5) Restart all the things! 6) Run another self-modification 7) Note of the staff side that dateofbirth is unaffected Signed-off-by: Emmi Takkinen Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 73c421a5164a3af4b2b8e1001b49f29213a94e3a) Signed-off-by: Lucas Gass (cherry picked from commit 41ad2ba4db8d70f5010f530883ded02c0641329d) Signed-off-by: Aleisha Amohia --- opac/opac-memberentry.pl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 6c33c41174..3cc0bd8508 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -468,16 +468,18 @@ sub ParseCgiForBorrower { } } - my $dob_dt; - $dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); } - if ( $borrower{'dateofbirth'} ); + if ( defined $borrower{'dateofbirth'} ) { + my $dob_dt; + $dob_dt = eval { dt_from_string( $borrower{'dateofbirth'} ); } + if ( $borrower{'dateofbirth'} ); - if ( $dob_dt ) { - $borrower{'dateofbirth'} = output_pref ( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' } ); - } - else { - # Trigger validation - $borrower{'dateofbirth'} = undef; + if ( $dob_dt ) { + $borrower{'dateofbirth'} = output_pref( { dt => $dob_dt, dateonly => 1, dateformat => 'iso' } ); + } + else { + # Trigger validation + $borrower{'dateofbirth'} = undef; + } } # Replace checkbox 'agreed' by datetime in gdpr_proc_consent -- 2.39.5