Bug 17375 - Prevent internal software error when searching patron with invalid birth date
Summary: Prevent internal software error when searching patron with invalid birth date
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 9811
Blocks: 14874
  Show dependency treegraph
 
Reported: 2016-09-29 11:49 UTC by Marc Véron
Modified: 2017-01-18 14:55 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 17375: Prevent internal software error when searching patron with invalid birth date (2.32 KB, patch)
2016-09-29 12:52 UTC, Marc Véron
Details | Diff | Splinter Review
[SIGNED-OFF]Bug 17375: Prevent internal software error when searching patron with invalid birth date (2.43 KB, patch)
2016-10-03 19:29 UTC, Héctor Eduardo Castro Avalos
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - Add tests (2.18 KB, patch)
2016-10-04 10:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - handle invalid dates (4.73 KB, patch)
2016-10-04 10:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - Add tests (2.31 KB, patch)
2016-10-04 11:36 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - handle invalid dates (4.86 KB, patch)
2016-10-04 11:37 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - handle invalid dates (4.91 KB, patch)
2016-10-20 07:37 UTC, Lucio Moraes
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - Add tests (2.37 KB, patch)
2016-10-27 13:16 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 17375: Search by dateofbirth - handle invalid dates (4.97 KB, patch)
2016-10-27 13:16 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Véron 2016-09-29 11:49:26 UTC
To reproduce:
- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

For the reason see: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14874#c33
Comment 1 Marc Véron 2016-09-29 12:15:50 UTC
Same problem with datatables.

To reproduce:
- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'
Comment 2 Marc Véron 2016-09-29 12:52:42 UTC
Created attachment 55923 [details] [review]
Bug 17375: Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"
Comment 3 Héctor Eduardo Castro Avalos 2016-10-03 19:29:41 UTC
Created attachment 55986 [details] [review]
[SIGNED-OFF]Bug 17375: Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"

Signed-off-by: Hector Castro <hector.hecaxmmx@gmail.com>
Both cases works as advertised
Comment 4 Jonathan Druart 2016-10-04 10:59:31 UTC
Created attachment 56021 [details] [review]
Bug 17375: Search by dateofbirth - Add tests
Comment 5 Jonathan Druart 2016-10-04 10:59:34 UTC
Created attachment 56022 [details] [review]
Bug 17375: Search by dateofbirth - handle invalid dates

Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"
Comment 6 Jonathan Druart 2016-10-04 11:00:20 UTC
Hi Marc,
Could you have a look at these 2 patches?
I think they provide a more robust and durable solution.
Comment 7 Marc Véron 2016-10-04 11:36:08 UTC
Created attachment 56024 [details] [review]
Bug 17375: Search by dateofbirth - Add tests

Signed-off-by: Marc Véron <veron@veron.ch>
Comment 8 Marc Véron 2016-10-04 11:37:00 UTC
Created attachment 56025 [details] [review]
Bug 17375: Search by dateofbirth - handle invalid dates

Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"

Signed-off-by: Marc Véron <veron@veron.ch>
Comment 9 Lucio Moraes 2016-10-20 07:37:52 UTC
Created attachment 56685 [details] [review]
Bug 17375: Search by dateofbirth - handle invalid dates

Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Lucio Moraes <lmoraes@catalyst.net.nz>
Comment 10 Nick Clemens 2016-10-27 13:16:25 UTC
Created attachment 56918 [details] [review]
Bug 17375: Search by dateofbirth - Add tests

Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Nick Clemens 2016-10-27 13:16:32 UTC
Created attachment 56919 [details] [review]
Bug 17375: Search by dateofbirth - handle invalid dates

Prevent internal software error when searching patron with invalid birth date

To reproduce:

- Go to Home > Patron
- Expand patron search (click on + at the left of the search button)
- In drop down 'Search fields', select 'Date of birth'
- Enter a valid date (e.g. 11.02.1995 if syspref 'dateformat' is set to dmydot)
Result: Search works OK
- Enter an invalid date, e.g. 11.02 or abcd...
Result: Internal server error

- Do a patron search with many results
- Use filter on results screen, select 'Date of birth' as search field and
  enter an invalid date to search (e.g. 'a')
Result: Endless message 'Processing'

To test:
- Apply patch
- Repeat steps above
- In both cases, you should get "No results"

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Lucio Moraes <lmoraes@catalyst.net.nz>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Kyle M Hall 2016-10-27 13:19:37 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 13 Frédéric Demians 2016-11-02 17:50:51 UTC
Pushed in 16.05. Will be in 16.05.06.
Comment 14 Julian Maurice 2016-11-08 09:22:28 UTC
Pushed to 3.22.x, will be in 3.22.13