Bugzilla – Attachment 161915 Details for
Bug 36025
Extended attributes clause added to patron search query even when there are no searchable attributes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36025: Incorrect clause in patron search
Bug-36025-Incorrect-clause-in-patron-search.patch (text/plain), 3.84 KB, created by
Nick Clemens (kidclamp)
on 2024-02-08 14:16:43 UTC
(
hide
)
Description:
Bug 36025: Incorrect clause in patron search
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-02-08 14:16:43 UTC
Size:
3.84 KB
patch
obsolete
>From 8eeed9c4668c07e63857b13233ca9b6d53e03084 Mon Sep 17 00:00:00 2001 >From: Andreas Jonsson <andreas.jonsson@kreablo.se> >Date: Thu, 8 Feb 2024 01:08:10 +0000 >Subject: [PATCH] Bug 36025: Incorrect clause in patron search > >This patch removes the search clause for >extended_attributes when there is no patron >attribute types which are searchable by default. > >The clause was incorrectly added because the array >extended_attribute_types was rendered as [""] in >the template patron-search.inc most likely due to >a bug in DBIx::Class. > >Test plan: > >* Make sure that no borrower attribute type is set to "searched by default" > in Koha administration -> Patron attribute types. >* Enable the network monitring in the developer tools in your web browser > (Ctrl + Shift + E in firefox or Ctrl + Shift + I and select the "Network" > tab). >* Go to the patrons view members-home.pl (click patrons in top menu bar). >* Search for a string that will match multiple borrowers (to not be automatically > redirected) >* Examine the ajax-request and make sure that "extended_attributes.code" is NOT > part of the query. >* Also, in koha-testing-docker with selenium enabled, > run 'perl t/db_dependent/selenium/patrons_search.t' > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Template/Plugin/ExtendedAttributeTypes.pm | 5 ++++- > koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc | 2 +- > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 2 +- > 3 files changed, 6 insertions(+), 3 deletions(-) > >diff --git a/Koha/Template/Plugin/ExtendedAttributeTypes.pm b/Koha/Template/Plugin/ExtendedAttributeTypes.pm >index 9511b7325e2..d867270f075 100644 >--- a/Koha/Template/Plugin/ExtendedAttributeTypes.pm >+++ b/Koha/Template/Plugin/ExtendedAttributeTypes.pm >@@ -33,7 +33,10 @@ sub all { > > sub codes { > my ( $self, $params ) = @_; >- return Koha::Patron::Attribute::Types->search($params)->get_column('code'); >+ >+ my @codes = Koha::Patron::Attribute::Types->search($params)->get_column('code'); >+ >+ return \@codes; > } > > 1; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index bac7d5d40dc..e7305981e02 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -233,7 +233,7 @@ > }, {}); > > [% IF Koha.Preference('ExtendedPatronAttributes') %] >- [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %] >+ [% SET extended_attribute_types = ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) %] > let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; > [% END %] > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index ab24a9304e2..9eb4f613263 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -650,7 +650,7 @@ function buildPatronSearchQuery(term, options) { > q.push({ "-or": term_subquery_or }); > > // Add each pattern for each extended patron attributes >- if ( typeof options !== 'undefined' && ( (options.search_fields == 'standard' && options.extended_attribute_types) || ( searched_attribute_fields.length > 0 ) ) && extendedPatronAttributes) { >+ if ( typeof options !== 'undefined' && ( (options.search_fields == 'standard' && options.extended_attribute_types.length > 0) || ( searched_attribute_fields.length > 0 ) ) && extendedPatronAttributes) { > extended_attribute_codes_to_search = (searched_attribute_fields.length > 0) ? searched_attribute_fields : options.extended_attribute_types; > extended_attribute_subquery_and = []; > patterns.forEach(function (pattern, i) { >-- >2.30.2
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 36025
:
161873
|
161874
|
161914
| 161915