In 20.05 when a birthdate is entered in patron registration form (memberentry.pl) incorrectly, and save button is clicked, you receive an Internal Server Error and all the data is lost. To recreate: 1. Add new patron 2. Enter birthdate as 2/11/1986 3. Complete required fields 4. Save 5. Get ISE Yes, the text below the birthdate does specify MM/DD/YYYY but an incorrect entry should not cause all the data entered to be lost. Perhaps a warning instead that the birthdate format is incorrect?
Created attachment 118315 [details] [review] Bug 27937: Unit test
Created attachment 118316 [details] [review] Bug 23937: Allow for single date day or month When validating dates in JavaScript it is acceptable to have single digit days or months e.g,: 2011-6-16 When parsing in Koha::DateUtils->dt_from_string we die on these This patch changes the logic to allow for one or two digits in the days and months To test: 1 - Add new patron 2 - Enter birthdate as 2/11/1986 3 - Complete required fields 4 - Save 5 - Get ISE The given date (2/11/1986) does not match the date format (us) at /kohadevbox/koha/Koha/DateUtils.pm line 175 6 - Apply patch 7 - Repeat 1-4 8 - Patron successfully added 9 - Edit patron, try setting DOB to 2/1/1986 10 - Success! 11 - Repeat with other settings of system preference 'dateformat'
Another option here would be to validate/normalize the data in the JS before passing to Koha
Created attachment 118317 [details] [review] Bug 27937: Set datepicker when date is valid When validating dates in JavaScript it is acceptable to have single digit days or months e.g,: 2011-6-16 When parsing in Koha::DateUtils->dt_from_string we die on these This patch uses JS to set the datepicker which normalizes the date as Koha expects To test: 1 - Add new patron 2 - Enter birthdate as 2/11/1986 3 - Complete required fields 4 - Save 5 - Get ISE The given date (2/11/1986) does not match the date format (us) at /kohadevbox/koha/Koha/DateUtils.pm line 175 6 - Apply patch 7 - Repeat 1-2 8 - Note that when you change focus (click on another field) the date is formatted as '02/11/1986' 9 - Save patron, success! 10 - Edit patron, try setting DOB to 2/1/1986 11 - Change focus and note date is formatted as '02/01/1986', save 12 - Repeat with other settings of system preference 'dateformat' Current status: Needs Signoff
Created attachment 118368 [details] [review] Bug 27937: Set datepicker when date is valid When validating dates in JavaScript it is acceptable to have single digit days or months e.g,: 2011-6-16 When parsing in Koha::DateUtils->dt_from_string we die on these This patch uses JS to set the datepicker which normalizes the date as Koha expects To test: 1 - Add new patron 2 - Enter birthdate as 2/11/1986 3 - Complete required fields 4 - Save 5 - Get ISE The given date (2/11/1986) does not match the date format (us) at /kohadevbox/koha/Koha/DateUtils.pm line 175 6 - Apply patch 7 - Repeat 1-2 8 - Note that when you change focus (click on another field) the date is formatted as '02/11/1986' 9 - Save patron, success! 10 - Edit patron, try setting DOB to 2/1/1986 11 - Change focus and note date is formatted as '02/01/1986', save 12 - Repeat with other settings of system preference 'dateformat' Signed-off-by: Donna <donna@bywatersolutions.com>
Created attachment 119069 [details] [review] Bug 27937: Set datepicker when date is valid When validating dates in JavaScript it is acceptable to have single digit days or months e.g,: 2011-6-16 When parsing in Koha::DateUtils->dt_from_string we die on these This patch uses JS to set the datepicker which normalizes the date as Koha expects To test: 1 - Add new patron 2 - Enter birthdate as 2/11/1986 3 - Complete required fields 4 - Save 5 - Get ISE The given date (2/11/1986) does not match the date format (us) at /kohadevbox/koha/Koha/DateUtils.pm line 175 6 - Apply patch 7 - Repeat 1-2 8 - Note that when you change focus (click on another field) the date is formatted as '02/11/1986' 9 - Save patron, success! 10 - Edit patron, try setting DOB to 2/1/1986 11 - Change focus and note date is formatted as '02/01/1986', save 12 - Repeat with other settings of system preference 'dateformat' Signed-off-by: Donna <donna@bywatersolutions.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Created attachment 119070 [details] [review] Bug 27937: (QA follow-up) Fix indentation Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Created attachment 119084 [details] [review] Bug 27937: Set datepicker when date is valid When validating dates in JavaScript it is acceptable to have single digit days or months e.g,: 2011-6-16 When parsing in Koha::DateUtils->dt_from_string we die on these This patch uses JS to set the datepicker which normalizes the date as Koha expects To test: 1 - Add new patron 2 - Enter birthdate as 2/11/1986 3 - Complete required fields 4 - Save 5 - Get ISE The given date (2/11/1986) does not match the date format (us) at /kohadevbox/koha/Koha/DateUtils.pm line 175 6 - Apply patch 7 - Repeat 1-2 8 - Note that when you change focus (click on another field) the date is formatted as '02/11/1986' 9 - Save patron, success! 10 - Edit patron, try setting DOB to 2/1/1986 11 - Change focus and note date is formatted as '02/01/1986', save 12 - Repeat with other settings of system preference 'dateformat' Signed-off-by: Donna <donna@bywatersolutions.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi> Bug 27937: (QA follow-up) Fix indentation Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Pushed to master for 21.05, thanks to everybody involved!
Pushed to 20.11.x for 20.11.05
Pushed to 20.05.x for 20.05.11
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.