Bugzilla – Attachment 116862 Details for
Bug 26406
Suggestions filter does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26406: Fix suggestions filter at the OPAC
Bug-26406-Fix-suggestions-filter-at-the-OPAC.patch (text/plain), 7.44 KB, created by
Katrin Fischer
on 2021-02-14 14:57:25 UTC
(
hide
)
Description:
Bug 26406: Fix suggestions filter at the OPAC
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-02-14 14:57:25 UTC
Size:
7.44 KB
patch
obsolete
>From 1160bc2af18cff66b505e6da1f1d6de062db9d37 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 Sep 2020 15:21:24 +0200 >Subject: [PATCH] Bug 26406: Fix suggestions filter at the OPAC > >There is an input filter but it does nothing > >Test plan: >You need 2 differents users, U1 and U2 >Create several (at least one) suggestions for each of them >Test the following with and without OPACViewOthersSuggestions: >With U1 logged in, go to the suggestions tab and use the input to filter >the suggestions. >It should work correctly. >Also play with the "Suggested by" options > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > .../bootstrap/en/modules/opac-suggestions.tt | 31 +++++++++++++--------- > opac/opac-suggestions.pl | 9 ++++++- > 2 files changed, 26 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index 49f3c49d31..d73defd049 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -289,10 +289,11 @@ > > [% IF ( deleted ) %]<div class="alert alert-info">The selected suggestions have been deleted.</div>[% END %] > >- [% IF ( suggestions_loop ) %] >- [% SET can_delete_suggestion = 0 %] >+ [% IF suggestions_loop OR title_filter %] > <form action="/cgi-bin/koha/opac-suggestions.pl" class="form-inline" id="search_suggestions_form" method="get"> > <div class="form-row"> >+ <label for="title_filter">Search for:</label> >+ <input type="text" name="title_filter" id="title_filter" value="[% title_filter | html %]" /> > [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) == 1 %] > [% IF loggedinusername %] > <div class="col-auto my-1"> >@@ -307,13 +308,16 @@ > [% END %] > </select> > </div> >- <div class="col-auto my-1"> >- <button type="submit" class="btn btn-sm btn-primary">Go</button> >- </div> > [% END %] > [% END %] >+ <div class="col-auto my-1"> >+ <button type="submit" class="btn btn-sm btn-primary">Go</button> >+ </div> > </div> > </form> >+ [% END %] >+ [% IF suggestions_loop %] >+ [% SET can_delete_suggestion = 0 %] > <form action="/cgi-bin/koha/opac-suggestions.pl" method="post" id="delete_suggestions"> > <input type="hidden" name="op" value="delete_confirm" /> > [% IF ( loggedinusername || ( Koha.Preference( 'AnonSuggestions' ) == 1 ) ) %] >@@ -434,18 +438,20 @@ > </form> > [% ELSE %] > [% IF Koha.Preference( 'OPACViewOthersSuggestions' ) %] >- [% IF ( loggedinusername ) %] >- [% IF ( suggested_by_anyone ) %] >- <p>There are no pending purchase suggestions.</p> >- [% ELSE %] >- <p>You have no pending purchase suggestions. <a href="/cgi-bin/koha/opac-suggestions.pl?suggested_by_anyone=1">View all suggestions</a></p> >- [% END %] >+ [% IF title_filter %] >+ <p>There are no pending purchase suggestions matching your search.</p> >+ [% ELSIF loggedinusername AND NOT suggested_by_anyone %] >+ <p>You have no pending purchase suggestions. <a href="/cgi-bin/koha/opac-suggestions.pl?suggested_by_anyone=1">View all suggestions</a></p> > [% ELSE %] > <p>There are no pending purchase suggestions.</p> > [% END %] > [% ELSE %] > [% IF ( loggedinusername ) %] >- <p>You have no pending purchase suggestions.</p> >+ [% IF title_filter %] >+ <p>There are no pending purchase suggestions matching your search.</p> >+ [% ELSE %] >+ <p>You have no pending purchase suggestions.</p> >+ [% END %] > [% ELSE %] > <p>You are not authorized to see pending purchase suggestions.</p> > [% END %] >@@ -489,7 +495,6 @@ > $(function() { > $("#suggestt").dataTable($.extend(true, {}, dataTablesDefaults, { > "order": [[ 1, "asc" ]], >- "dom": '<"top"<"table_entries"><"table_controls"f>>t', > "autoWidth": false, > "columnDefs": [ > [% IF ( loggedinusername ) %]{ "targets": [ 0 ], "sortable": false, "searchable": false }[% END %] >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index 77e0fcedb8..b1f1701ddc 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -41,6 +41,7 @@ my $biblionumber = $input->param('biblionumber'); > my $suggestion = $input->Vars; > my $negcaptcha = $input->param('negcap'); > my $suggested_by_anyone = $input->param('suggested_by_anyone') || 0; >+my $title_filter = $input->param('title_filter'); > my $need_confirm = 0; > > # If a spambot accidentally populates the 'negcap' field in the sugesstions form, then silently skip and return. >@@ -188,7 +189,12 @@ if ( $op eq "add_confirm" ) { > $op = 'else'; > } > >-my $suggestions_loop = &SearchSuggestion({suggestedby => $suggestion->{suggestedby}}); >+my $suggestions_loop = &SearchSuggestion( >+ { >+ suggestedby => $suggestion->{suggestedby}, >+ title => $title_filter, >+ } >+); > if ( $op eq "delete_confirm" ) { > my @delete_field = $input->multi_param("delete_field"); > foreach my $delete_field (@delete_field) { >@@ -261,6 +267,7 @@ $template->param( > messages => \@messages, > suggestionsview => 1, > suggested_by_anyone => $suggested_by_anyone, >+ title_filter => $title_filter, > patrons_pending_suggestions_count => $patrons_pending_suggestions_count, > need_confirm => $need_confirm, > patrons_total_suggestions_count => $patrons_total_suggestions_count, >-- >2.11.0
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 26406
:
109748
|
109762
|
116630
| 116862