mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-10-03 07:55:22 -04:00
fix: translate the DateTime filter term to StartDateTime for the events API
loadEventData() builds the API URL straight from the filter form's terms and translated only one attribute name, Monitor to MonitorId. But montagereview.php expresses both of its time bounds as the DateTime pseudo-attribute, which is a filter-engine concept rather than an Events column: Filter.php resolves 'DateTime' and 'StartDateTime' to the same E.StartDateTime, and groups them together everywhere else it special-cases date attributes. The API takes real column names and silently ignores a term it cannot resolve, so the two bounds were dropped and the view got page one of every event ever recorded instead of the requested window. Both requests return 200, which is why nothing surfaced. Measured against a live install for the 2026-08-28 00:00:00 to 01:00:00 window: DateTime >=/<= -> 757 rows, first event 2025-04-26 16:29:55 StartDateTime >=/<= -> 300 rows, 00:00:59 to 00:59:59 Translate DateTime the same way Monitor is already translated. Rewriting the form element is safe for the PHP path too, since Filter.php treats the two names identically.
This commit is contained in:
1 parent
56030724ed
commit
a3b1ab558b
1 file changed
+6
@@ -1317,6 +1317,12 @@ function loadEventData(e) {
|
||||
const op = this.form.elements[op_name];
|
||||
if (attr) {
|
||||
if (attr.value==='Monitor') attr.value='MonitorId';
|
||||
// DateTime is a filter-engine pseudo-attribute, not an Events
|
||||
// column: Filter.php resolves 'DateTime' and 'StartDateTime' to the
|
||||
// same E.StartDateTime. The API takes column names, and silently
|
||||
// ignores a term it cannot resolve rather than erroring, so leaving
|
||||
// it as DateTime returns every event ever instead of the window.
|
||||
if (attr.value==='DateTime') attr.value='StartDateTime';
|
||||
let urlVal = val;
|
||||
// Normalize date/time values to YYYY-MM-DD HH:mm:ss for the API URL.
|
||||
// Locale formats using / as separator break the URL path.
|
||||
|
||||
Reference in new issue
Block a user