https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36025

Marcel de Rooy <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #178037|0                           |1
        is obsolete|                            |

--- Comment #29 from Marcel de Rooy <[email protected]> ---
Created attachment 178081
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=178081&action=edit
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 [""]

This seems to be an issue with get_columns from DBIX Class and how that is cast
when forcing an array
in the template. It returns an empty string for nothing, a scalar for a single
value, and an array for multiple
values.

This patch now checks if the variable is set and has content, and wraps as an
array if so. In the case of two attributes,
we do double the array, but this was true before as we always cast the return
as an array.

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'
* Now set one patro attribute to searchable and searched by default and add a
value for a patron, confirm search works
* Set a second patron attribute to searchable and searched by default and
confirm searching works

Signed-off-by: Nick Clemens <[email protected]>
Signed-off-by: Magnus Enger <[email protected]>
Works as advertised. Did not run the selenium tests, as they have
been obsoleted.

Signed-off-by: Marcel de Rooy <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to