Koha-clms/Koha/REST
Tomas Cohen Arazi f34c6e4686 Bug 29570: Fix sorting orders by biblioitems columns
The API representation of Koha::Biblio objects includes the
biblioitems.* columns too. This proved problematic as queries had to get
translated so they work (i.e. if a query passes q={"biblio.ean":"123%"}
then the query needs to be tweaked so biblio.ean is translated into
biblio.biblioitem.ean. This is solved, locally, in the controller.

But sorting needs the same kind of tweak, and it was missing. This patch
solves that by doing a similar conversion.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/acquisitions_orders.t
=> FAIL: Tests fail, searching on a 'biblioitems' column generates a 500
error.
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! We can sort on those fields
5. Sign off :-D

Note: you will notice the tests only cover sorting by ISBN. I consider
it enough as sorting is a DB problem, and we only want to know if the
generated ORDER BY is valid for the underlying query, and MySQL would
complain if it wasn't the case.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d3dc05279c)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
2022-02-17 13:54:36 +00:00
..
Plugin Bug 29506: Make objects.search call search_limited if present 2022-01-11 21:49:56 +00:00
V1 Bug 29570: Fix sorting orders by biblioitems columns 2022-02-17 13:54:36 +00:00
V1.pm Bug 28189: (QA folloq-up) Fix fallback case 2021-05-12 17:39:36 +02:00