Bug 28930 - Cardnumber is lost if an invalid self registration form is submitted to the server, and the server side form validation fails
Summary: Cardnumber is lost if an invalid self registration form is submitted to the s...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Andreas Jonsson
QA Contact: Joonas Kylmälä
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-31 12:48 UTC by Andreas Jonsson
Modified: 2021-10-26 01:00 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05,20.11.11


Attachments
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration. (1.47 KB, patch)
2021-08-31 12:51 UTC, Andreas Jonsson
Details | Diff | Splinter Review
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration. (2.17 KB, patch)
2021-09-01 11:38 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration. (2.32 KB, patch)
2021-10-03 09:48 UTC, Joonas Kylmälä
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Jonsson 2021-08-31 12:48:34 UTC
Cardnumber is lost if an invalid self registration form is submited to the server, and the server side form validation fails.

I believe the idea is that the cardnumber should not be editable when requesting modifications to the borrower's details in the OPAC.  But it would still make sense to keep the cardnumber field editable when correcting invalid form fields during self registration (also, see bug 17213).

So, a simple fix is to let the cardnumber be editable if action != 'edit'.

Test case

* Enable the system preference PatronSelfRegistration 
* Make sure  PatronSelfRegistrationBorrowerUnwantedField does not contain cardnumber.
* Set the system preference  GDPR_Policy to "Enforce".
* In the OPAC click "Log in to your account" and "Register here".
* Fill out the form with valid data, but make sure you leave the checkbox under "GDPR consent" unchecked.
* Submit the form
* You will get back the form with the error message "You have not filled out all required fields. Please fill in all missing fields and resubmit."
* Without patch: cardnumber is not editable, and there is no input element for borrower_cardnumber (so the cardnumber will be lost when resubmitting the form)
* With patch: cardnumber is editable.
Comment 1 Andreas Jonsson 2021-08-31 12:51:03 UTC
Created attachment 124278 [details] [review]
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration.
Comment 2 Owen Leonard 2021-09-01 11:38:43 UTC
Created attachment 124320 [details] [review]
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration.

Test plan:

- Enable the system preference PatronSelfRegistration
- Make sure  PatronSelfRegistrationBorrowerUnwantedField does not
  contain cardnumber.
- Set the system preference  GDPR_Policy to "Enforce".
- In the OPAC click "Log in to your account" and "Register here".
- Fill out the form with valid data, but make sure you leave the
  checkbox under "GDPR consent" unchecked.
- Submit the form
- You will get back the form with the error message "You have not filled
  out all required fields. Please fill in all missing fields and
  resubmit."
- Without patch: cardnumber is not editable, and there is no input
  element for borrower_cardnumber (so the cardnumber will be lost when
  resubmitting the form)
- With patch: cardnumber is editable.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Joonas Kylmälä 2021-10-03 09:48:01 UTC
Created attachment 125665 [details] [review]
Bug 28930: Keep cardnumber be editable after server side form validation fails during self registration.

Test plan:

- Enable the system preference PatronSelfRegistration
- Make sure  PatronSelfRegistrationBorrowerUnwantedField does not
  contain cardnumber.
- Set the system preference  GDPR_Policy to "Enforce".
- In the OPAC click "Log in to your account" and "Register here".
- Fill out the form with valid data, but make sure you leave the
  checkbox under "GDPR consent" unchecked.
- Submit the form
- You will get back the form with the error message "You have not filled
  out all required fields. Please fill in all missing fields and
  resubmit."
- Without patch: cardnumber is not editable, and there is no input
  element for borrower_cardnumber (so the cardnumber will be lost when
  resubmitting the form)
- With patch: cardnumber is editable.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Comment 4 Joonas Kylmälä 2021-10-03 09:50:05 UTC
Passing QA. This bug was actually "Fixed" already by bug 28934 which was pushed just recently but this fixes the situation where a librarian changes the Opac registration form mandatory values after the patron doing the registration has already loaded the registration page. So if GDPR option became mandatory whilst the patron was inputting the registration info this fixes it now :)
Comment 5 Jonathan Druart 2021-10-06 12:57:14 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Kyle M Hall 2021-10-08 14:33:12 UTC
Pushed to 21.05.x for 21.05.05
Comment 7 Fridolin Somers 2021-10-21 06:03:00 UTC
Pushed to 20.11.x for 20.11.11
Comment 8 Victor Grousset/tuxayo 2021-10-26 01:00:47 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.