From 85a71cf043b4ce7f860ffff8f791e3a5f54f8113 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Sat, 29 Jul 2017 21:39:32 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 14385: Corrected issues with category code. When a user isn't logged in, $borrower is undef and causes error when determining category code. Added conditional check. Signed-off-by: Mark Tompsett Signed-off-by: Aleisha Amohia --- opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 2 +- opac/opac-detail.pl | 2 +- opac/opac-search.pl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 68aeca1..b003509 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -94,7 +94,7 @@ if (scalar @items >= 1) { # we need to fetch the borrower info here, so we can pass the category my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } ); - $borcat = $borrower->categorycode; + $borcat = $borrower ? $borrower->categorycode : q{}; } my @hiddenitems = GetHiddenItemnumbers( { items => \@items, borcat => $borcat }); diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 0fe2b06..cc6bb53 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -91,7 +91,7 @@ if (scalar @all_items >= 1) { # we need to fetch the borrower info here, so we can pass the category my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } ); - $borcat = $borrower->categorycode; + $borcat = $borrower ? $borrower->categorycode : q{}; } push @items2hide, GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat }); diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index fa9e2b4..5bac860 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -87,7 +87,7 @@ if ( scalar @all_items >= 1 ) { # we need to fetch the borrower info here, so we can pass the category my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } ); - $borcat = $borrower->categorycode; + $borcat = $borrower ? $borrower->categorycode : q{}; } push @hiddenitems, diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 081c9e5..3cd7adc 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -633,7 +633,7 @@ $search_context->{'interface'} = 'opac'; if (C4::Context->preference('OpacHiddenItemsExceptions')){ # we need to fetch the borrower info here, so we can pass the category my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } ); - $search_context->{'category'} = $borrower->categorycode; + $search_context->{'category'} = $borrower ? $borrower->categorycode : q{}; } for (my $i=0;$i<@servers;$i++) { -- 2.1.4