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.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
(cherry picked from commit 12426b5924)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Lucas Gass 2024-06-20 15:27:11 +00:00 committed by Wainui Witika-Park
parent d6f529c38c
commit 01df1563bf
No known key found for this signature in database
GPG Key ID: 2D0A6AB5DAF1B78D
1 changed files with 1 additions and 1 deletions

View File

@ -462,7 +462,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;