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: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
                CC: [email protected]
  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.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to