From 6fb85264b0ef1c823a2f33f9745f3f92106ed5c7 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 20 Jun 2024 15:27:11 +0000 Subject: [PATCH] Bug 37143: Do not allow required fields with only whitespace to be submitted To test: 1. Make some fields for OPAC self registration required. 2. Create a new patron via self reg. 3. Fill out those required fields as an empty string like " ". 4. Submit the form, it succeeds. 5. APPLY PATCH, restart_all 6. Try again. Required fields with only whitespace are treated as if they were empty. --- opac/opac-memberentry.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl index 7adc381d47..47dec54def 100755 --- a/opac/opac-memberentry.pl +++ b/opac/opac-memberentry.pl @@ -466,7 +466,7 @@ sub CheckMandatoryFields { foreach my $key ( keys %$mandatory_fields ) { push( @empty_mandatory_fields, $key ) - unless ( defined( $borrower->{$key} ) && $borrower->{$key} ); + unless ( defined( $borrower->{$key} ) && $borrower->{$key} && $borrower->{$key} !~ /^\s*$/ ); } return @empty_mandatory_fields; -- 2.39.2