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 <michaela.sieber@kit.edu>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-05-10 10:54:39 +02:00 committed by Tomas Cohen Arazi
parent 9b5c92035f
commit 63bc731fd4
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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"),