MDL-78807 reportbuilder: ensure report base conditions are non-empty.

This commit is contained in:
Paul Holden
2023-08-02 13:50:50 +01:00
parent a1d5d1b2f7
commit e4e7e59d90
3 changed files with 83 additions and 3 deletions
+7 -3
View File
@@ -225,16 +225,20 @@ abstract class base {
}
/**
* Define more complex clause that will always be applied to the report query
* Define more complex/non-empty clause to apply to the report query
*
* @param string $where
* @param array $params Note that the param names should be generated by {@see database::generate_param_name}
*/
final public function add_base_condition_sql(string $where, array $params = []): void {
// Validate parameters always, so that potential errors are caught early.
database::validate_params($params);
$this->sqlwheres[] = trim($where);
$this->sqlparams = $params + $this->sqlparams;
if ($where !== '') {
$this->sqlwheres[] = trim($where);
$this->sqlparams = $params + $this->sqlparams;
}
}
/**