Koha-clms/Koha/Template/Plugin
Andreas Jonsson bcd89bb5a7
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 <nick@bywatersolutions.com>
Signed-off-by: Magnus Enger <magnus@libriotech.no>
Works as advertised. Did not run the selenium tests, as they have
been obsoleted.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 208a7cc3a4)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
2025-03-19 23:57:59 +01:00
..
AdditionalContents.pm Bug 37628: (follow-up) Remove get_opac_news_by_id 2024-08-16 17:33:51 +02:00
Asset.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AudioAlerts.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
AuthClient.pm Bug 33708: Provide non-public endpoint for OAuth/OIDC for staff interface 2023-05-18 11:35:15 -03:00
AuthorisedValues.pm Bug 33568: Status 2024-04-05 15:34:48 +02:00
Biblio.pm Bug 35790: Remove Koha::Template::Plugin::Biblio::CanArticleRequest 2024-03-22 12:26:45 +01:00
Branches.pm Bug 36941: Limit login branch list when IP restriction enabled 2024-06-28 13:49:26 +02:00
Categories.pm Bug 28924: (QA follow-up): Remove unnecessary template method 2024-07-18 18:25:56 +02:00
CirculationRules.pm Bug 30901: Add POD for Koha::Template::Plugin::CirculationRules 2022-08-16 10:43:10 -03:00
ClassSources.pm Bug 11844: Fix QA issues (POD, TT filters, file exec flag) 2023-05-16 12:58:38 +02:00
Context.pm Bug 23166: Early return if no set 2020-08-25 12:01:38 +02:00
Desks.pm Bug 29844: Fix ->search occurrences 2022-02-09 15:36:23 -10:00
ExtendedAttributeTypes.pm Bug 36025: Incorrect clause in patron search 2025-03-19 23:57:59 +01:00
Frameworks.pm Bug 33607: Handle default framework 2023-05-16 15:17:44 -03:00
HtmlId.pm Bug 27336: Add POD for new package 2021-01-11 10:27:37 +01:00
HtmlScrubber.pm Bug 38488: Add Template::Toolkit filter for C4::Scrubber 2025-02-18 19:17:20 +01:00
HtmlTags.pm
…
I18N.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
ItemTypes.pm Bug 29454: Use Koha Cache Memory Lite to stash itemtype descriptions for template plugin 2022-06-24 11:55:34 -03:00
JSConsents.pm Bug 27378: Introduce cookie consent to OPAC and staff client 2023-09-12 09:45:07 -03:00
Koha.pm Bug 36081: Use multivalue_preference 2025-02-24 20:43:20 +01:00
KohaDates.pm Bug 38758: Add strftime as TT virtual method 2024-12-30 12:22:31 +01:00
KohaPlugins.pm Bug 31503: (follow-up) Add 'feature_enabled' to Koha::Plugins 2023-10-25 10:35:22 -03:00
KohaSpan.pm
…
KohaTimes.pm Bug 38043: Add unit tests for KohaTimes TT filter 2024-10-11 11:13:54 +02:00
Languages.pm Bug 18213: Add Template plugin and fix for C4/Languages 2019-03-28 15:57:32 +00:00
NoticeTemplates.pm Bug 29393: Prevent SQL errors when SQL strict mode is set 2024-04-29 17:38:00 +02:00
Notices.pm Bug 32986: (follow-up) Fix CircAutoPrintQuickSlip and remove unecessary module usage 2023-11-08 17:59:35 -03:00
Price.pm Bug 4078: Pass with_symbol to module 2018-03-23 11:45:38 -03:00
Registers.pm Bug 24665: Add support for filtering by cash register 2020-11-06 15:55:17 +01:00
Remove_MARC_punctuation.pm Bug 19578: Remove MARC punctuation in notices (TT syntax) 2018-04-04 15:45:43 -03:00
SafeURL.pm Bug 22223: Add filter to make item URLs safe in template output 2024-11-07 16:29:18 +01:00
TablesSettings.pm Bug 38594: Remove unused TablesSettings.GetColumns 2024-12-12 14:04:48 +01:00
To.pm Bug 17600: Standardize our EXPORT_OK 2021-07-16 08:58:47 +02:00
raw.pm Bug 13618: Add POD to raw.pm 2018-08-17 16:14:14 +00:00