Bug 30868

Summary: Modifying a patron - page not found error after fixing validation errors where the message is displayed at the top of the page
Product: Koha Reporter: David Nind <david>
Component: PatronsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: major    
Priority: P1 - high CC: arthur.suzuki, gmcharlt, jonathan.druart, kyle.m.hall, lucas, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes a page not found error message generated after fixing validation errors when editing a patron (where the validation/error message is shown at the top of the page - below the patron name, but before the Save and Cancel buttons). (This was introduced by bug 29684: Fix warn about js/locale_data.js in 22.05.)
Version(s) released in:
22.11.00, 22.05.01, 21.11.07
Bug Depends on: 29684    
Bug Blocks:    
Attachments: Bug 30868: (bug 29684 follow-up) Fix borrowernumber var in template
Bug 30868: (bug 29684 follow-up) Fix borrowernumber var in template
Bug 30868: (bug 29684 follow-up) Fix borrowernumber var in template

Description David Nind 2022-05-30 20:57:32 UTC
A page not found error message is generated after fixing validation errors when editing a patron - where the validation/error message is shown at the top of the page (below the patron name, but before the Save and Cancel buttons).

To replicate:
1. Edit a patron record (for example: Henry Acevedo).
2. Note that the URL is http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=19
3. Change date of birth to yesterday.
4. Save.
5. Error message displayed above the Save and Cancel buttons: 
   The following fields are wrong. Please fix them.
   - Patron's age is incorrect for their category. Ages allowed are 18-999.
6. Note that the URL is now http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl
7. Fix date of birth (for example: change year to 2000).
8. Select Save.
9. Message displayed: "Patron not found. Return to search."

Inline validation errors (such as for required fields) don't cause this issue.
Comment 1 Jonathan Druart 2022-05-31 06:23:25 UTC
I think it has been introduced by bug 29684
Comment 2 Jonathan Druart 2022-05-31 06:25:30 UTC
Created attachment 135465 [details] [review]
Bug 30868: (bug 29684 follow-up) Fix borrowernumber var in template

borrower_data does not contain the borrowernumber, it is sent
separately.

Test plan:
1. Edit a patron record (for example: Henry Acevedo).
2. Note that the URL is http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=19
3. Change date of birth to yesterday.
4. Save.
5. Error message displayed above the Save and Cancel buttons:
   The following fields are wrong. Please fix them.
   - Patron's age is incorrect for their category. Ages allowed are 18-999.
6. Note that the URL is now http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl
7. Fix date of birth (for example: change year to 2000).
8. Select Save.
=> Without this patch you get: "Patron not found. Return to search."
=> With this patch applied the patron's data is saved
Comment 3 David Nind 2022-05-31 06:33:52 UTC
Created attachment 135466 [details] [review]
Bug 30868: (bug 29684 follow-up) Fix borrowernumber var in template

borrower_data does not contain the borrowernumber, it is sent
separately.

Test plan:
1. Edit a patron record (for example: Henry Acevedo).
2. Note that the URL is http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=19
3. Change date of birth to yesterday.
4. Save.
5. Error message displayed above the Save and Cancel buttons:
   The following fields are wrong. Please fix them.
   - Patron's age is incorrect for their category. Ages allowed are 18-999.
6. Note that the URL is now http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl
7. Fix date of birth (for example: change year to 2000).
8. Select Save.
=> Without this patch you get: "Patron not found. Return to search."
=> With this patch applied the patron's data is saved

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Katrin Fischer 2022-06-06 10:54:54 UTC
Created attachment 135719 [details] [review]
Bug 30868: (bug 29684 follow-up) Fix borrowernumber var in template

borrower_data does not contain the borrowernumber, it is sent
separately.

Test plan:
1. Edit a patron record (for example: Henry Acevedo).
2. Note that the URL is http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=19
3. Change date of birth to yesterday.
4. Save.
5. Error message displayed above the Save and Cancel buttons:
   The following fields are wrong. Please fix them.
   - Patron's age is incorrect for their category. Ages allowed are 18-999.
6. Note that the URL is now http://127.0.0.1:8081/cgi-bin/koha/members/memberentry.pl
7. Fix date of birth (for example: change year to 2000).
8. Select Save.
=> Without this patch you get: "Patron not found. Return to search."
=> With this patch applied the patron's data is saved

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2022-06-06 14:38:15 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass 2022-06-15 16:25:33 UTC
Pushed to 22.05.x for 22.05.01
Comment 7 Arthur Suzuki 2022-06-21 13:55:04 UTC
thx pushed to 21.11.x for 21.11.07
Comment 8 Victor Grousset/tuxayo 2022-06-26 00:12:10 UTC
Missing dependencies for 21.05.x, it shouldn't be affected, no backport.
Nothing to document, marking resolved.