From 4757f8b191574286470b5b2b7e6dc64544e070cc Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 10 May 2023 10:54:39 +0200 Subject: [PATCH] Bug 33663: Pass 'suggestion' to the OPAC templates only We don't need it for the staff interface. The previous patch is removing the only occurrence using it. Signed-off-by: Michaela Sieber Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 63bc731fd409e52b505c684fa5ba5f849128aa36) Signed-off-by: Matt Blenkinsop --- C4/Auth.pm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 79155713af..8b0b567a83 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -450,14 +450,6 @@ sub get_template_and_user { # these template parameters are set the same regardless of $in->{'type'} - # Decide if the patron can make suggestions in the OPAC - my $can_make_suggestions; - if ( C4::Context->preference('Suggestion') && C4::Context->preference('AnonSuggestions') ) { - $can_make_suggestions = 1; - } elsif ( C4::Context->userenv && C4::Context->userenv->{'number'} ) { - $can_make_suggestions = Koha::Patrons->find(C4::Context->userenv->{'number'})->category->can_make_suggestions; - } - my $minPasswordLength = C4::Context->preference('minPasswordLength'); $minPasswordLength = 3 if not $minPasswordLength or $minPasswordLength < 3; $template->param( @@ -496,7 +488,6 @@ sub get_template_and_user { intranetstylesheet => C4::Context->preference("intranetstylesheet"), IntranetUserCSS => C4::Context->preference("IntranetUserCSS"), IntranetUserJS => C4::Context->preference("IntranetUserJS"), - suggestion => $can_make_suggestions, virtualshelves => C4::Context->preference("virtualshelves"), StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"), EasyAnalyticalRecords => C4::Context->preference('EasyAnalyticalRecords'), @@ -550,6 +541,14 @@ sub get_template_and_user { $opac_name = C4::Context->userenv->{'branch'}; } + # Decide if the patron can make suggestions in the OPAC + my $can_make_suggestions; + if ( C4::Context->preference('Suggestion') && C4::Context->preference('AnonSuggestions') ) { + $can_make_suggestions = 1; + } elsif ( C4::Context->userenv && C4::Context->userenv->{'number'} ) { + $can_make_suggestions = Koha::Patrons->find(C4::Context->userenv->{'number'})->category->can_make_suggestions; + } + my @search_groups = Koha::Library::Groups->get_search_groups({ interface => 'opac' })->as_list; $template->param( AnonSuggestions => "" . C4::Context->preference("AnonSuggestions"), -- 2.39.5