Bugzilla – Attachment 110845 Details for
Bug 7607
Advanced search: Index and search term don't match when leaving fields empty
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7607: Fix adv search when leaving fields empty
Bug-7607-Fix-adv-search-when-leaving-fields-empty.patch (text/plain), 2.64 KB, created by
Jonathan Druart
on 2020-09-28 10:54:12 UTC
(
hide
)
Description:
Bug 7607: Fix adv search when leaving fields empty
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-09-28 10:54:12 UTC
Size:
2.64 KB
patch
obsolete
>From 0a8f70c72977b44b37327952a75de11c7d82041b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 7 Aug 2020 14:50:15 +0200 >Subject: [PATCH] Bug 7607: Fix adv search when leaving fields empty > >We have a rewrite rule in our apache config that remove empty >parameters: > RewriteCond %{QUERY_STRING} (.*?)(?:[A-Za-z0-9_-]+)=&(.*) > >That causes the advanced search to search on the wrong index if an input >field is left empty. > >Test plan (staff and OPAC): >- leave the first pulldown on keyword and the search term empty >- select author or title from the second pull down and enter a search term >--- > .../prog/en/modules/catalogue/advsearch.tt | 12 +++++++++++- > .../opac-tmpl/bootstrap/en/modules/opac-advsearch.tt | 8 ++++++++ > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >index 8c555441e1..bc4dc56822 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -34,7 +34,7 @@ > <div class="row"> > <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> > >-<form action="search.pl" method="get"> >+<form id="adv-search-form" action="search.pl" method="get"> > <div id="advanced-search"> > <input type="hidden" name="advsearch" value="1"/> > <h1>Advanced search</h1> >@@ -334,6 +334,16 @@ > browser.show_back_link(); > [% END %] > >+ $("#adv-search-form").on("submit", function(){ >+ var idx = $("select[name='idx']"); >+ var i = 0; >+ $("input[name='q']").each(function(){ >+ if( !$(this).val().length ) { >+ $(idx[i]).val(""); >+ } >+ i++; >+ }); >+ }); > }); > </script> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >index 7e0aec5e0f..f618326a26 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt >@@ -490,6 +490,14 @@ $(document).ready(function() { > jQuery.cookie("search_path_code", 'ads',{ path: '/'}); > jQuery.removeCookie("num_paragraph", { path: '/'}); > [% END %] >+ >+ var i = 0; >+ $("input[name='q']").each(function(){ >+ if( !$(this).val().length ) { >+ $("#search-field_"+i).val(""); >+ } >+ i++; >+ }); > }); > > }); >-- >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 7607
:
107963
|
110845
|
110849
|
111064
|
111065
|
112912
|
112963
|
112964
|
113133
|
113134
|
113682
|
113683
|
113691
|
113692
|
113781
|
113872
|
113873
|
113874