[Bug 43189] New: Action logs API returns 500 when filtering by date
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43189 Bug ID: 43189 Summary: Action logs API returns 500 when filtering by date Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: Laura.escamilla@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Target Milestone: --- When using Tools → Log viewer, filtering action logs by a date range can cause the Action Logs API to return a 500 Internal Server Error. On a partner site running 25.11.06, the API request fails with: DBIx::Class::Exception: DBIx::Class::Storage::DBI::_prepare_sth(): DBI Exception: DBD::mysql::db prepare_cached failed: Column 'timestamp' in WHERE is ambiguous From investigating the generated API filters, the date filter is currently built using the unqualified field: filters.timestamp = { ">=": params.datefrom + "T00:00:00Z", "<=": params.dateto + "T23:59:59Z", }; whereas the query already qualifies the sort column as me.timestamp. Qualifying the filter in the same way appears to resolve the ambiguity: filters["me.timestamp"] = { ">=": params.datefrom + "T00:00:00Z", "<=": params.dateto + "T23:59:59Z", }; I have been able to reproduce this consistently on a partner site running 25.11.06, but I have not yet found a reliable way to reproduce it on a clean main installation. It appears to depend on the generated query and/or data that causes additional joins, resulting in the ambiguous timestamp column. More eyes on this would be great! Thank you! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org