Bug 9980: Fix for anonymous searches
authorChris Cormack <chris@bigballofwax.co.nz>
Sun, 7 Apr 2013 07:55:37 +0000 (19:55 +1200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Sun, 7 Apr 2013 16:11:37 +0000 (12:11 -0400)
To test
Search in the OPAC both logged and logged out

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
When I turn off XSLT for the OPAC I can recreate the problem.
After applying the patch things work as expected for all
combinations of:
- Search results and detail view
- Logged in and not logged in
- XSLT and non-XSLT view

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests, QA script and test plan.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
opac/opac-search.pl

index 3ca9d1d..677b7c2 100755 (executable)
@@ -715,8 +715,10 @@ for (my $i=0;$i<@servers;$i++) {
             $template->param(results_per_page =>  $results_per_page);
             my $hide = C4::Context->preference('OpacHiddenItems');
             $hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines
-
-            my $branch = C4::Context->userenv->{branch};
+            my $branch = '';
+            if (C4::Context->userenv){
+                $branch = C4::Context->userenv->{branch};
+            }
             if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
                 if (
                     ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )