-
Bug
-
Resolution: Fixed
-
Major
-
4.0.6
-
MOODLE_400_STABLE
-
MOODLE_400_STABLE, MOODLE_401_STABLE
-
MDL-77555-401 -
- Covered by automated tests (PHPUnit)
- In code, define a filter which uses at least one parameter
- Set the filter class to \core_reportbuilder\local\filters\number
- Create a report that includes this filter
- Try to filter by a range of values (or empty / not empty)
Expected result:
- Filter is applied without problems
Actual result:
- Error - ERROR: Incorrect number of query parameters. Expected 4, got 3
(This 'date' filter class is also affected).
Reason - these filter classes duplicate the SQL for the filter, leaving any embedded params unmodified, e.g. if the SQL was:
(SELECT COUNT(1) FROM {x} WHERE {x}.timedue > :rbparam1)
|
With params: ['rbparam1' => time()]
The final SQL generated is:
(SELECT COUNT(1) FROM {x} WHERE {x}.timedue > :rbparam1) >= :rbparam2 AND (SELECT COUNT(1) FROM {x} WHERE {x}.timedue > :rbparam1) <= :rbparam3
|
With params ['rbparam1' => time(), 'rbparam2' => 'value entered in filter form', 'rbparam3' => 'value entered in filter form]
- has a non-specific relationship to
-
MDL-81434 Applying the same condition/filter to custom report can throw DML exceptions
-
- Closed
-