From 7c40e753ae91857f43673258d6f71826f03547fe Mon Sep 17 00:00:00 2001 From: Magnus Enger Date: Wed, 8 May 2013 12:03:48 +0200 Subject: [PATCH] [SIGNED-OFF] Bug 10217 - Make sure direct links to detail views work when there is no session Content-Type: text/plain; charset="utf-8" To reproduce: - Make sure you do not have a session for the OPAC you will be testing with. Delete the CGISESSID session cookie if you have one. - Go directly to a detail view, e.g.: /cgi-bin/koha/opac-detail.pl?biblionumber=1 - Observe the error "Can't use an undefined value as a HASH reference at /home/magnus/scripts/kohadev/opac/opac-detail.pl line 445." To test: - Apply the patch - Reload the page with the error - You should now see the detail view of the record, as usual Thanks to Chris Cormack who suggested the fix for this! Signed-off-by: Owen Leonard --- opac/opac-detail.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index bab4ff6..722a401 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -442,7 +442,10 @@ if ($hideitems) { } my $branches = GetBranches(); -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 ) -- 1.7.9.5