https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42591

            Bug ID: 42591
           Summary: current_item_level_holds+count is not sortable on the
                    API
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: REST API
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]
        Depends on: 41950

The current_item_level_holds+count embed on the acquisitions orders endpoint
cannot be sorted because the underlying query is too complex for a single DBIC
relationship.

Koha::Acquisition::Order->current_item_level_holds requires:
1. Getting item numbers from aqorders_items for the order
2. Getting the biblio for the order
3. Querying holds on that biblio filtered by reservedate <= NOW() +
ConfirmFutureHolds AND itemnumber IN (those items)

This involves a syspref-dependent date calculation and a multi-table
correlation that cannot be expressed as a DBIC relationship coderef. A possible
approach would be a raw SQL subquery override mechanism in
_build_count_subquery, or accepting that this embed remains display-only (not
sortable).

Test plan:
prove t/db_dependent/api/v1/acquisitions_orders.t


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950
[Bug 41950] Make +count embeds sortable by using SQL-level COUNT subqueries
-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to