Koha-clms/Koha/Schema
Martin Renvoize dcb423b766
Bug 42443: (QA follow-up) Add DBIC relationship aliases on Branchtransfer
The REST framework resolves _order_by parameters and embed prefetches by
walking prefetch_whitelist, which is built from DBIC relationship names.
The auto-generated relationships use the FK column names (itemnumber,
frombranch, tobranch), but the API exposes them as item, from_library,
and to_library. Sorting by item.biblio.title etc. threw a 500 because
those names were not in the whitelist.

Adding belongs_to aliases below the DO NOT MODIFY line bridges the API
names to the DBIC names, matching the convention used by other Koha
schema result classes (e.g. Koha::Schema::Result::Item).

Also updates the relation methods in Koha::Item::Transfer to use the new
aliases consistently, so the accessor names line up across both layers.

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-04 11:23:39 +00:00
..
Component Bug 38136: Refactor database translations (alternative) 2026-04-15 11:37:14 -06:00
Loader Bug 41076: Adjust our perl tidiness for v20250105 2026-02-05 09:03:51 -07:00
Result Bug 42443: (QA follow-up) Add DBIC relationship aliases on Branchtransfer 2026-09-04 11:23:39 +00:00
ExceptionMapper.pm Bug 42391: (follow-up) Rename ExceptionTranslator to ExceptionMapper 2026-07-20 12:44:55 +00:00