Bug 17764 - OPAC search fails when lost items are in the result set and there is no logged in user
Summary: OPAC search fails when lost items are in the result set and there is no logge...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: master
Hardware: All All
: P2 critical (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 17556
Blocks:
  Show dependency treegraph
 
Reported: 2016-12-13 03:17 UTC by Liz Rea
Modified: 2016-12-22 21:37 UTC (History)
5 users (show)

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


Attachments
Bug 17764: (bug 17556 follow-up) Fix search for logged out users and lost items (1.35 KB, patch)
2016-12-14 17:10 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 17764: (bug 17556 follow-up) Fix search for logged out users and lost items (1.45 KB, patch)
2016-12-14 18:26 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 17764: (bug 17556 follow-up) Fix search for logged out users and lost items (1.45 KB, patch)
2016-12-16 15:03 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Liz Rea 2016-12-13 03:17:54 UTC
To replicate:

Make sure you have at least one lost item in your result set 
Do a search in the opac that would turn up a whole list of results (and not just that one) with the lost item included 
You will probably get an error: 
Can't call method "category" on an undefined value at /home/liz/koha-src/koha/C4/Search.pm line 2091.
Comment 1 Jonathan Druart 2016-12-14 17:10:16 UTC
Created attachment 58182 [details] [review]
Bug 17764: (bug 17556 follow-up) Fix search for logged out users and lost items

If you are non logged-in and you the search result contain lost items,
you will get:
Can't call method "category" on an undefined value at
/home/liz/koha-src/koha/C4/Search.pm line 2091.

This is because bug 17556 assumed that $userenv was not defined when the user is
logged out. Actually it is, with non defined or empty string values.

Test plan:
Do a search in the opac that would turn up a whole list of results (and not
just that one) with the lost item included.
=> Without this patch you should get an error
=> With this patch applied you should see the search results
Comment 2 Owen Leonard 2016-12-14 18:26:27 UTC
Created attachment 58188 [details] [review]
[SIGNED-OFF] Bug 17764: (bug 17556 follow-up) Fix search for logged out users and lost items

If you are non logged-in and you the search result contain lost items,
you will get:
Can't call method "category" on an undefined value at
/home/liz/koha-src/koha/C4/Search.pm line 2091.

This is because bug 17556 assumed that $userenv was not defined when the
user is logged out. Actually it is, with non defined or empty string
values.

Test plan:
Do a search in the opac that would turn up a whole list of results (and
not just that one) with the lost item included.
 => Without this patch you should get an error
 => With this patch applied you should see the search results

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Kyle M Hall 2016-12-16 15:03:14 UTC
Created attachment 58261 [details] [review]
Bug 17764: (bug 17556 follow-up) Fix search for logged out users and lost items

If you are non logged-in and you the search result contain lost items,
you will get:
Can't call method "category" on an undefined value at
/home/liz/koha-src/koha/C4/Search.pm line 2091.

This is because bug 17556 assumed that $userenv was not defined when the
user is logged out. Actually it is, with non defined or empty string
values.

Test plan:
Do a search in the opac that would turn up a whole list of results (and
not just that one) with the lost item included.
 => Without this patch you should get an error
 => With this patch applied you should see the search results

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Brendan Gallagher 2016-12-22 20:26:19 UTC
Pushed to Master - Should be in the 17.05 release!  Thanks!
Comment 5 Katrin Fischer 2016-12-22 21:37:09 UTC
Dependency is not in 16.11.