MDL-85286 reportbuilder: schedule report filter by enabled state.

This commit is contained in:
Paul Holden
2025-08-18 10:59:44 +01:00
parent 2b96047622
commit 606bb89188
2 changed files with 35 additions and 11 deletions
@@ -26,14 +26,10 @@ use stdClass;
use core_reportbuilder\permission;
use core_reportbuilder\system_report;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\filters\date;
use core_reportbuilder\local\filters\text;
use core_reportbuilder\local\filters\{boolean_select, date, text};
use core_reportbuilder\local\helpers\format;
use core_reportbuilder\local\models\report;
use core_reportbuilder\local\models\schedule;
use core_reportbuilder\local\report\action;
use core_reportbuilder\local\report\column;
use core_reportbuilder\local\report\filter;
use core_reportbuilder\local\models\{report, schedule};
use core_reportbuilder\local\report\{action, column, filter};
use core_reportbuilder\output\schedule_name_editable;
/**
@@ -253,14 +249,23 @@ class report_schedules extends system_report {
protected function add_filters(): void {
$tablealias = $this->get_main_table_alias();
// Enabled filter.
$this->add_filter(new filter(
boolean_select::class,
'enabled',
new lang_string('enabled', 'core_admin'),
$this->get_schedule_entity_name(),
"{$tablealias}.enabled",
));
// Name filter.
$this->add_filter((new filter(
$this->add_filter(new filter(
text::class,
'name',
new lang_string('name'),
$this->get_schedule_entity_name(),
"{$tablealias}.name"
)));
));
// Time last sent filter.
$this->add_filter((new filter(
@@ -1,4 +1,4 @@
@core_reportbuilder @javascript
@core @core_reportbuilder @javascript
Feature: Manage custom report schedules
In order ot manage custom report schedules
As an admin
@@ -107,7 +107,25 @@ Feature: Manage custom report schedules
| Time last sent |
| Time next send |
Scenario: Toggle report schedule
Scenario: Filter report schedules by enabled state
Given the following "core_reportbuilder > Schedules" exist:
| report | name | enabled |
| My report | My schedule 1 | 1 |
| My report | My schedule 2 | 0 |
And I am on the "My report" "reportbuilder > Editor" page logged in as "admin"
And I click on the "Schedules" dynamic tab
When I click on "Filters" "button"
And I set the field "Enabled operator" in the "Enabled" "core_reportbuilder > Filter" to "Yes"
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
Then I should see "Filters applied"
And I should see "My schedule 1" in the "Report schedules" "table"
And I should not see "My schedule 2" in the "Report schedules" "table"
And I set the field "Enabled operator" in the "Enabled" "core_reportbuilder > Filter" to "No"
And I click on "Apply" "button" in the "[data-region='report-filters']" "css_element"
And I should not see "My schedule 1" in the "Report schedules" "table"
And I should see "My schedule 2" in the "Report schedules" "table"
Scenario: Toggle report schedule enabled state
Given the following "core_reportbuilder > Schedules" exist:
| report | name |
| My report | My schedule |
@@ -116,6 +134,7 @@ Feature: Manage custom report schedules
When I click on "Disable schedule" "field" in the "My schedule" "table_row"
Then the "class" attribute of "My schedule" "table_row" should contain "text-muted"
And I click on "Enable schedule" "field" in the "My schedule" "table_row"
And the "class" attribute of "My schedule" "table_row" should be set
Scenario: Edit report schedule
Given the following "core_reportbuilder > Schedules" exist: