Bug 33974: Make biblioitem columns searchable in a generic way
authorTomas Cohen Arazi <tomascohen@theke.io>
Fri, 16 Jun 2023 15:50:07 +0000 (12:50 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 17 Jul 2023 15:21:30 +0000 (16:21 +0100)
commit21ebede0de667f2e17d6935920c8b9cebd16b880
tree9534eb44a3fb7234aee1b6b8cd198810b7d160de
parent949ba13a6e51acd078535e01d74efae9756b5fcc
Bug 33974: Make biblioitem columns searchable in a generic way

This patch makes biblioitem attributes be searchable on the biblios
endpoint. It does so by using the new method in Koha::Biblios, and by
adjusting objects.search(_rs) to accept a $query_fixer arrayref of
functions to be applied to each query or order_by parameters.

The result is cleaner code to write, but complex internals.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/api/v1/biblios.t
=> SUCCESS: Tests pass! Searching for biblioitem attributes works on the
API!
3. Sign off :-D

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 353f328ad3a99cc5a9ee913cd1f72a1d841705f2)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/Plugin/Objects.pm
Koha/REST/V1/Biblios.pm
t/db_dependent/api/v1/biblios.t