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)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Tue, 18 Jul 2023 14:44:57 +0000 (14:44 +0000)
commit83a1fbac24f6f870a25dd560181e85917b17fa52
tree61300072140de28c27277a755918b2b9d01a2964
parentbb9139ee0dfb860c1693cf64531ada0de86355aa
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>
(cherry picked from commit 21ebede0de667f2e17d6935920c8b9cebd16b880)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/REST/Plugin/Objects.pm
Koha/REST/V1/Biblios.pm
t/db_dependent/api/v1/biblios.t