Skip to content

Commit

Permalink
Merge branch 'MDL-76471' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed May 29, 2023
2 parents 4ed782d + 5961c2d commit 42f930e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
16 changes: 16 additions & 0 deletions course/tests/reportbuilder/datasource/participants_test.php
Expand Up @@ -25,6 +25,7 @@
use core_reportbuilder\local\filters\date;
use core_reportbuilder\local\filters\duration;
use core_reportbuilder\local\filters\select;
use core_reportbuilder\local\filters\text;
use core_reportbuilder_generator;
use core_reportbuilder_testcase;
use grade_item;
Expand Down Expand Up @@ -296,6 +297,21 @@ public function datasource_filters_provider(): array {
],
['Lionel', 'Kira', 'Luna'],
],
[
'enrol:customname',
[
'enrol:customname_operator' => text::IS_EMPTY,
],
['Luna', 'Kira', 'Lionel'],
],
[
'enrol:customname',
[
'enrol:customname_operator' => text::IS_EQUAL_TO,
'enrol:customname_value' => 'All night long'
],
[],
],
[
'role:name',
[
Expand Down
12 changes: 11 additions & 1 deletion enrol/classes/reportbuilder/local/entities/enrol.php
Expand Up @@ -20,7 +20,7 @@
use lang_string;
use stdClass;
use core_reportbuilder\local\entities\base;
use core_reportbuilder\local\filters\{boolean_select, date, duration, select};
use core_reportbuilder\local\filters\{boolean_select, date, duration, select, text};
use core_reportbuilder\local\helpers\format;
use core_reportbuilder\local\report\{column, filter};

Expand Down Expand Up @@ -205,6 +205,16 @@ protected function get_all_filters(): array {
}, enrol_get_plugins(true));
});

// Custom name filter.
$filters[] = (new filter(
text::class,
'customname',
new lang_string('custominstancename', 'core_enrol'),
$this->get_entity_name(),
"{$enrolalias}.name"
))
->add_joins($this->get_joins());

// Enabled filter.
$filters[] = (new filter(
boolean_select::class,
Expand Down

0 comments on commit 42f930e

Please sign in to comment.