Bugzilla – Attachment 87480 Details for
Bug 22595
Items search is mixing inputs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22595: Items search is mixing inputs
Bug-22595-Items-search-is-mixing-inputs.patch (text/plain), 2.89 KB, created by
Michal Denar
on 2019-04-06 21:21:16 UTC
(
hide
)
Description:
Bug 22595: Items search is mixing inputs
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2019-04-06 21:21:16 UTC
Size:
2.89 KB
patch
obsolete
>From 56f951c53855bfc30bc49962acecd4de639b8c9f Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 27 Mar 2019 16:19:29 +0100 >Subject: [PATCH] Bug 22595: Items search is mixing inputs > >Items search is using inputs and selects from search form to create an Ajax call. > >In this call selects are parsed before inputs. >But a custom search field can be used with authorised values and used after a regular search field. >In this case the "q" param is not ordered like the "name" param. > >Test plan : >1) Go to Administration > Item search fields >2) Define a search field with an authorised values category >3) Go to items search >4) Use a regular filter like call number >5) Click on new field >6) Use custom field with an authorised value >7) Perform search >=> Without patch you get wrong resuts, authorised value is used as value for first field >=> You can see this by listening traffic in Firebug, look at params "f" and "q" >8) Check some combinaison of select and input filters > >Signed-off-by: Michal Denar <black23@gmail.com> >--- > .../prog/en/modules/catalogue/itemsearch.tt | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >index ab3c027c5c..c7c3668257 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt >@@ -329,16 +329,14 @@ > .append(table); > > var params = []; >- $form.find('select').not(':disabled').find('option:selected').each(function () { >- var name = $(this).parents('select').first().attr('name'); >- var value = $(this).val(); >- params.push({ 'name': name, 'value': value }); >- }); >- $form.find('input[type="text"],input[type="hidden"]').not(':disabled').each(function () { >- params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >- }); >- $form.find('input[type="radio"]:checked').each(function() { >- params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >+ $form.find('select:not(:disabled) option:selected,input[type="text"]:not(:disabled),input[type="hidden"]:not(:disabled),input[type="radio"]:checked').each(function() { >+ if ( $(this).prop('tagName').toLowerCase() == 'option' ) { >+ var name = $(this).parents('select').first().attr('name'); >+ var value = $(this).val(); >+ params.push({ 'name': name, 'value': value }); >+ } else { >+ params.push({ 'name': $(this).attr('name'), 'value': $(this).val() }); >+ } > }); > > $('#results').dataTable($.extend(true, {}, dataTablesDefaults, { >-- >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 22595
:
87076
|
87480
|
87562