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)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 3 Jul 2023 17:51:43 +0000 (14:51 -0300)
commit353f328ad3a99cc5a9ee913cd1f72a1d841705f2
tree61092937103deed6f6df6f7faf69059bb86925e3
parent60e8998e914d8f8ba9b2153d542bf42365a41994
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>
Koha/REST/Plugin/Objects.pm
Koha/REST/V1/Biblios.pm
t/db_dependent/api/v1/biblios.t