From 58566e5e667c58e4a87fcdfc0eb9e12264b9eae9 Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Fri, 26 Aug 2022 02:04:51 +0000 Subject: [PATCH] Bug 31333: (follow-up) Handle anonymous patrons making suggestions Test plan: 1. Enable suggestion & AnonSuggestions sysprefs and set AnonymousPatron = 1 2. Visit the OPAC without logging in 3. Confirm you can successfully create a suggestion from: - Item detail page - Search result page - Masthead under the 'Library catalogue' search box 4. Disable the AnonSuggestions syspref 5. Confirm you cannot see links to make purchase suggestions on the following pages: - Item detail page - Search result page - Masthead under the 'Library catalogue' search box 6. Confirm if you try visiting /cgi-bin/koha/opac-suggestions.pl page you are re-directed to a login page 7. Select the category of your user in the suggestionPatronCategoryExceptions syspref 8. Log into the OPAC 9. Confirm you cannot see links to make purchase suggestions on the following pages: - Item detail page - Search result page - Masthead under the 'Library catalogue' search box - opac-user.pl ('Your summary') page 10. Confirm if you try visiting /cgi-bin/koha/opac-suggestions.pl page you are re-directed to a 404 error page 11. Enable AnonSuggestions syspref 12. Confirm you can successfully create a suggestion from: - Item detail page - Search result page - Masthead under the 'Library catalogue' search box - opac-user.pl ('Your summary') page 13. Disable AnonSuggestions syspref and un-check your category from suggestionPatronCategoryExeptions syspref 14. Confirm you can create a suggestion from: - Item detail page - Search result page - Masthead under the 'Library catalogue' search box - opac-user.pl ('Your summary') page Sponsored-by: Catalyst IT, New Zealand Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer --- C4/Auth.pm | 4 +++- koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 2 +- opac/opac-suggestions.pl | 8 +++++--- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 612aeb4fe2..137b74943d 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -501,7 +501,9 @@ sub get_template_and_user { # Decide if the patron can make suggestions in the OPAC my $can_make_suggestions; - if ( C4::Context->userenv && C4::Context->userenv->{'number'} ) { + 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; } diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index fbab4ec2c9..c13f52f4dc 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -329,7 +329,7 @@ Browse search [% END %] - [% IF Koha.Preference( 'suggestion' ) == 1 %] + [% IF suggestion %] [% IF Koha.Preference( 'AnonSuggestions' ) == 1 || Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %]