Summary: | New patrons are created with invalid dateofbirth value if field is left empty | ||
---|---|---|---|
Product: | Koha | Reporter: | Owen Leonard <oleonard> |
Component: | Patrons | Assignee: | Bugs List <koha-bugs> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | gmcharlt, jonathan.druart, kyle.m.hall |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Medium patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | 10403 | ||
Bug Blocks: | |||
Attachments: |
Bug 11221: SQLHelper::_filter_hash does not manage well dates
Bug 11221: SQLHelper::_filter_hash does not manage well dates Bug 11221: Follow up adding a unit test to test handling empty strings as dates [PASSED QA] Bug 11221: SQLHelper::_filter_hash does not manage well dates [PASSED QA] Bug 11221: Follow up adding a unit test to test handling empty strings as dates |
Description
Owen Leonard
2013-11-08 16:01:12 UTC
Created attachment 22879 [details] [review] Bug 11221: SQLHelper::_filter_hash does not manage well dates The default values for date fields is undef, so if a date field contains an empty string, we should insert NULL in the DB. The format_date_in_iso routine should be only called if a date is defined, is not equal to an empty string and does not match the iso regex. Partial test plan: 1. Create a new patron. Leave dateofbirth empty. 2. Save the record. 3. Open the record for editing. 4. Save the record without making changes. 5. Koha gives no error. I think this patch is correct but I don't have the time to provide unit tests and I don't know how to foresee all side effects. We should have several looks at this patch! Created attachment 22978 [details] [review] Bug 11221: SQLHelper::_filter_hash does not manage well dates The default values for date fields is undef, so if a date field contains an empty string, we should insert NULL in the DB. The format_date_in_iso routine should be only called if a date is defined, is not equal to an empty string and does not match the iso regex. Partial test plan: 1. Create a new patron. Leave dateofbirth empty. 2. Save the record. 3. Open the record for editing. 4. Save the record without making changes. 5. Koha gives no error. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Created attachment 22979 [details] [review] Bug 11221: Follow up adding a unit test to test handling empty strings as dates Created attachment 22993 [details] [review] [PASSED QA] Bug 11221: SQLHelper::_filter_hash does not manage well dates The default values for date fields is undef, so if a date field contains an empty string, we should insert NULL in the DB. The format_date_in_iso routine should be only called if a date is defined, is not equal to an empty string and does not match the iso regex. Partial test plan: 1. Create a new patron. Leave dateofbirth empty. 2. Save the record. 3. Open the record for editing. 4. Save the record without making changes. 5. Koha gives no error. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and QA script. Now when no date is given NULL is saved to the database. Tested: - Adding a patron without date of birth - Editing the patron, entering a date of birth - Editing the patron, deleting date of birth All worked as expected. Created attachment 22994 [details] [review] [PASSED QA] Bug 11221: Follow up adding a unit test to test handling empty strings as dates Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> All tests pass. Pushed to master and 3.14.x. Thanks, Jonathan and Chris! |