Bugzilla – Attachment 112912 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: [Alternate] Remove empty inputs when submitting search form
Bug-7607-Alternate-Remove-empty-inputs-when-submit.patch (text/plain), 2.78 KB, created by
Nick Clemens (kidclamp)
on 2020-11-03 11:33:48 UTC
(
hide
)
Description:
Bug 7607: [Alternate] Remove empty inputs when submitting search form
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-11-03 11:33:48 UTC
Size:
2.78 KB
patch
obsolete
>From 41203dfe53f3041e399c16cb9416cc7cf6c82ff1 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 3 Nov 2020 11:19:23 +0000 >Subject: [PATCH] Bug 7607: [Alternate] Remove empty inputs when submitting > search form > >This patch surrounds the operator, index, and query fields on the advanced search >page wtih a 'search_set' class. > >This allows us to process them as a group and confirm the query is populated before submitting >the other parts to the form > >TO test: >1 - Go to advanced search >2 - Use search boxes to search like: > Title: (leave blank) > Author: clinton > keyword: shuffle >3 - Perform search >4 - Note no results as you searched for title:clinton etc. >5 - apply patch >6 - refresh and repeat >7 - search is now correct >8 - Try vaeious searches with 'more options' and selecting different operators >--- > .../intranet-tmpl/prog/en/modules/catalogue/advsearch.tt | 6 +++++- > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 11 +++++++++++ > 2 files changed, 16 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 673aa2d7c9..11b84e53bb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt >@@ -94,7 +94,11 @@ > <fieldset id="searchterms"> > <legend>Search for </legend> > [% FOREACH search_box IN search_boxes_loop %] >- [% IF ( search_boxes_label ) %]<div style="text-indent: 4.5em;">[% ELSE %]<div>[% END %] >+ [% IF ( search_boxes_label ) %] >+ <div class="search_set" style="text-indent: 4.5em;"> >+ [% ELSE %] >+ <div class="search_set"> >+ [% END %] > [% IF ( expanded_options ) %] > [% IF ( search_box.boolean ) %] > <select name="op"> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index 29ba0d9805..bd253deb25 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -131,6 +131,17 @@ $.fn.selectTabByID = function (tabID) { > /* Search results browsing */ > /* forms with action leading to search */ > $("form[action*='search.pl']").submit(function(){ >+ var removedPrior = false; >+ $(".search_set").each(function(){ >+ if( removedPrior ){ >+ $(this).find('select[name="op"]').remove(); >+ removedPrior = false; >+ } >+ if( $(this).find('input[name="q"]').val() == "" ){ >+ $(this).remove(); >+ removedPrior = true; >+ } >+ }); > resetSearchContext(); > }); > /* any link to launch a search except navigation links */ >-- >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 7607
:
107963
|
110845
|
110849
|
111064
|
111065
|
112912
|
112963
|
112964
|
113133
|
113134
|
113682
|
113683
|
113691
|
113692
|
113781
|
113872
|
113873
|
113874