Bug 37143 - Patron registration allows for saving required fields with a single space instead of information
Summary: Patron registration allows for saving required fields with a single space ins...
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low trivial
Assignee: Lucas Gass (lukeg)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-20 14:57 UTC by Lisette Scheer
Modified: 2026-01-29 18:25 UTC (History)
5 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This changes the OPAC self-registration form validation so that required fields need actual information, and not just spaces. Before this, spaces could be entered into most required fields and the form would successfully submit. Now, when submitting, a warning is generated to fill in all missing fields for required fields with just spaces.
Version(s) released in:
Circulation function:


Attachments
Bug 37143: Do not allow required fields with only whitespace to be submitted (1.17 KB, patch)
2024-06-20 15:30 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 37143: Do not allow required fields with only whitespace to be submitted (1.17 KB, patch)
2026-01-29 15:57 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 37143: Do not allow required fields with only whitespace to be submitted (1.22 KB, patch)
2026-01-29 17:46 UTC, David Nind
Details | Diff | Splinter Review
Bug 37143: Do not allow required fields with only whitespace to be submitted (1.22 KB, patch)
2026-01-29 18:20 UTC, David Nind
Details | Diff | Splinter Review
Bug 37143: Do not allow required fields with only whitespace to be submitted (1.22 KB, patch)
2026-01-29 18:25 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lisette Scheer 2024-06-20 14:57:17 UTC
When creating a patron or self registration a single space (or series of spaces) can be saved instead of required information in fields. This can cause difficulties in finding patrons.
Comment 1 Liz Rea 2024-06-20 15:08:49 UTC
"difficulties" = 500 error searching for patrons where the erroneous patron is part of the result set.
Comment 2 Lucas Gass (lukeg) 2024-06-20 15:09:13 UTC
This is true for staff interface patron reg as well.
Comment 3 Lucas Gass (lukeg) 2024-06-20 15:22:00 UTC
For example:

1. Do a patron search in the staff interface for all patrons. In k-t-d this works fine.
2. Self register a patron. For the required firstname and surname fields use an empty string like "  ".
3. You can successfully register.
4. Go back to the staff client and do the same patron search, it never completes.
Comment 4 Lucas Gass (lukeg) 2024-06-20 15:30:18 UTC
Created attachment 167936 [details] [review]
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.
Comment 5 David Nind 2026-01-28 21:56:17 UTC
The patch no longer applies.

I did manage to fix the patch, but the QA tidy showed an issue with this line - the double commas:

opac/opac-memberentry.pl

  280 branchcode  => $patron->branchcode,,

I'm not sure if fixing this should be in another bug.

The fixed patch does work.
Comment 6 Lucas Gass (lukeg) 2026-01-29 15:57:10 UTC
Created attachment 192161 [details] [review]
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.
Comment 7 David Nind 2026-01-29 17:46:53 UTC Comment hidden (obsolete)
Comment 8 David Nind 2026-01-29 18:20:04 UTC Comment hidden (obsolete)
Comment 9 David Nind 2026-01-29 18:20:57 UTC
Amended patch to fix qa tidy warning.
Comment 10 David Nind 2026-01-29 18:25:07 UTC
Created attachment 192191 [details] [review]
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>