Bug 28213 - Deleting a patron or patron club causes server error on searching
Summary: Deleting a patron or patron club causes server error on searching
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
: 28214 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-24 14:58 UTC by Andrew Fuerste-Henry
Modified: 2021-05-24 19:21 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06,20.05.12


Attachments
Bug 28213: Prevent crash if patron or club deleted after search to hold (2.31 KB, patch)
2021-04-26 09:16 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28213: Prevent crash if patron or club deleted after search to hold (3.49 KB, patch)
2021-04-26 14:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28213: Prevent crash if patron or club deleted after search to hold (3.55 KB, patch)
2021-04-26 18:11 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 28213: Prevent crash if patron or club deleted after search to hold (3.62 KB, patch)
2021-04-27 14:18 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2021-04-24 14:58:25 UTC
To recreate:
- create a club template
- create a club
- enroll a patron in the club
- from the clubs page, select Search To Hold for your club
- do a search, see that it says "Hold for [club name]" in your search results page
- go back to the clubs page and delete your club
- try to perform a search
- get error "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207"

Koha's trying to retain your deleted club as its Search To Hold target.
Comment 1 Jonathan Druart 2021-04-26 09:16:08 UTC
Created attachment 120168 [details] [review]
Bug 28213: Prevent crash if patron or club deleted after search to hold

Deleting a patron or patron club causes server error on searching.

To recreate:
- create a club template
- create a club
- enroll a patron in the club
- from the clubs page, select Search To Hold for your club
- do a search, see that it says "Hold for [club name]" in your search results page
- go back to the clubs page and delete your club
- try to perform a search
=> Without this patch you get "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207"

Same when placing a hold for a patron
Comment 2 Andrew Fuerste-Henry 2021-04-26 14:36:17 UTC
Looks like there's still an error on the bib detail page. I searched for hold from a patron and deleted them. The search results page didn't give an error, but I got this when I clicked through to bib details:

Can't call method "surname" on an undefined value at /kohadevbox/koha/catalogue/detail.pl line 97
Comment 3 Jonathan Druart 2021-04-26 14:59:13 UTC
Created attachment 120177 [details] [review]
Bug 28213: Prevent crash if patron or club deleted after search to hold

Deleting a patron or patron club causes server error on searching.

To recreate:
- create a club template
- create a club
- enroll a patron in the club
- from the clubs page, select Search To Hold for your club
- do a search, see that it says "Hold for [club name]" in your search results page
- go back to the clubs page and delete your club
- try to perform a search
=> Without this patch you get "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207"

Same when placing a hold for a patron (check the search result and the
detail pages)
Comment 4 Andrew Fuerste-Henry 2021-04-26 18:11:41 UTC
Created attachment 120182 [details] [review]
Bug 28213: Prevent crash if patron or club deleted after search to hold

Deleting a patron or patron club causes server error on searching.

To recreate:
- create a club template
- create a club
- enroll a patron in the club
- from the clubs page, select Search To Hold for your club
- do a search, see that it says "Hold for [club name]" in your search results page
- go back to the clubs page and delete your club
- try to perform a search
=> Without this patch you get "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207"

Same when placing a hold for a patron (check the search result and the
detail pages)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Comment 5 Andrew Fuerste-Henry 2021-04-26 18:12:59 UTC
Thanks for the quick patch!
Comment 6 Andrew Fuerste-Henry 2021-04-26 18:13:20 UTC
*** Bug 28214 has been marked as a duplicate of this bug. ***
Comment 7 Martin Renvoize 2021-04-27 14:18:53 UTC
Created attachment 120238 [details] [review]
Bug 28213: Prevent crash if patron or club deleted after search to hold

Deleting a patron or patron club causes server error on searching.

To recreate:
- create a club template
- create a club
- enroll a patron in the club
- from the clubs page, select Search To Hold for your club
- do a search, see that it says "Hold for [club name]" in your search results page
- go back to the clubs page and delete your club
- try to perform a search
=> Without this patch you get "Can't call method "name" on an undefined value at /kohadevbox/koha/catalogue/search.pl line 207"

Same when placing a hold for a patron (check the search result and the
detail pages)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 8 Martin Renvoize 2021-04-27 14:19:23 UTC
Trivial and obvious fix.. works as expected.

Passing QA
Comment 9 Jonathan Druart 2021-04-28 09:17:19 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 10 Fridolin Somers 2021-04-30 09:11:24 UTC
Pushed to 20.11.x for 20.11.06
Comment 11 Andrew Fuerste-Henry 2021-05-24 19:11:23 UTC
Pushed to 20.05.x for 20.05.12
Comment 12 Victor Grousset/tuxayo 2021-05-24 19:21:58 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.