_parse_dbic_query maps field names but did not convert values. When datetime or boolean filters are nested inside DBIC operators (-and, -or) in the q= parameter, attributes_from_api (which normally handles the conversion via _recursive_fixup) cannot reach them because it only iterates top-level keys. This patch fixes the issue in two places: 1. _parse_dbic_query (Query.pm): When a key maps to a known column (on the primary table or a related object), call _recursive_fixup to convert RFC3339 timestamps to MySQL format and booleans to 0/1. Related object instances are cached on the result_set to avoid repeated prefetch_whitelist lookups during recursive parsing. 2. Objects.pm: Move attributes_from_api to process named query params before merging with q= params. This avoids double-processing since q= values are already fixed up by _parse_dbic_query. Test plan: 1. Apply the regression tests from the previous commit 2. Run: $ prove t/Koha/REST/Plugin/Query.t $ prove t/db_dependent/Koha/REST/Plugin/Objects.t => FAIL: Tests fail! 3. Apply this patch 4. Repeat step 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> |
||
|---|---|---|
| .. | ||
| Auth | ||
| Exceptions.pm | ||
| Objects.pm | ||
| Pagination.pm | ||
| PluginRoutes.pm | ||
| Query.pm | ||
| Responses.pm | ||