Bugzilla – Attachment 140174 Details for
Bug 31333
Add the ability to limit purchase suggestions by patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31333: (follow-up) Handle anonymous patrons making suggestions
Bug-31333-follow-up-Handle-anonymous-patrons-makin.patch (text/plain), 5.32 KB, created by
Owen Leonard
on 2022-09-02 17:37:10 UTC
(
hide
)
Description:
Bug 31333: (follow-up) Handle anonymous patrons making suggestions
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2022-09-02 17:37:10 UTC
Size:
5.32 KB
patch
obsolete
>From 919678a446e8e6227a3bae66400cd7f508339c3f Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >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 <oleonard@myacpl.org> >--- > 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 @@ > <a href="/cgi-bin/koha/opac-browse.pl">Browse search</a> > </li> > [% END %] >- [% IF Koha.Preference( 'suggestion' ) == 1 %] >+ [% IF suggestion %] > [% IF Koha.Preference( 'AnonSuggestions' ) == 1 || Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %] > <li class="nav-item"> > <a href="/cgi-bin/koha/opac-suggestions.pl?suggested_by_anyone=1">Purchase suggestions</a> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index c47962d22c..95fa8d6304 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -549,7 +549,7 @@ > [% END # / IF total %] > > [%# Display "Not finding what you're looking for" for suggestion or ILL %] >- [% IF suggestion && ( Koha.Preference( 'AnonSuggestions' ) == 1 || loggedinusername ) || ( Koha.Preference( 'ILLModule' ) == 1 && loggedinusername ) %] >+ [% IF suggestion || ( Koha.Preference( 'ILLModule' ) == 1 && loggedinusername ) %] > <div class="suggestion"> > Not finding what you're looking for? > <ul> >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index b6942d6753..dceae6c766 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -94,9 +94,11 @@ else { > } > > # If suggestions are turned off, or this patron belongs to a category not allowed to make suggestions (suggestionPatronCategoryExceptions syspref) we redirect to 404 error. This will also redirect guest suggestions >-if ( !Koha::Patrons->find( $borrowernumber )->category->can_make_suggestions ) { >- print $input->redirect("/cgi-bin/koha/errors/404.pl"); >- exit; >+if ( defined $borrowernumber && !C4::Context->preference('AnonSuggestions') ) { >+ if ( (!Koha::Patrons->find( $borrowernumber )->category->can_make_suggestions) ) { >+ print $input->redirect("/cgi-bin/koha/errors/404.pl"); >+ exit; >+ } > } > > my $suggested_by; >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31333
:
139112
|
139113
|
139114
|
139165
|
139897
|
139898
|
139935
|
139936
|
140169
|
140170
|
140171
|
140172
|
140173
|
140174
|
140270
|
140271
|
140272
|
140273
|
140274
|
140275
|
140276
|
141392
|
141393