mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
Merge branch 'MDL-82475' of https://github.com/paulholden/moodle
This commit is contained in:
commit
5d5cedc8ff
@ -125,8 +125,9 @@ class user_profile_fields {
|
||||
END";
|
||||
}
|
||||
|
||||
$columns[] = (new column(
|
||||
'profilefield_' . core_text::strtolower($profilefield->field->shortname),
|
||||
$columnname = 'profilefield_' . core_text::strtolower($profilefield->field->shortname);
|
||||
$columns[$columnname] = (new column(
|
||||
$columnname,
|
||||
new lang_string('customfieldcolumn', 'core_reportbuilder', $profilefield->display_name(false)),
|
||||
$this->entityname
|
||||
))
|
||||
@ -152,7 +153,7 @@ class user_profile_fields {
|
||||
->set_is_available($profilefield->is_visible());
|
||||
}
|
||||
|
||||
return $columns;
|
||||
return array_values($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,9 +211,10 @@ class user_profile_fields {
|
||||
$userinfoparams[$paramdefault] = $fielddefault;
|
||||
}
|
||||
|
||||
$filtername = 'profilefield_' . core_text::strtolower($profilefield->field->shortname);
|
||||
$filter = (new filter(
|
||||
$classname,
|
||||
'profilefield_' . core_text::strtolower($profilefield->field->shortname),
|
||||
$filtername,
|
||||
new lang_string('customfieldcolumn', 'core_reportbuilder', $profilefield->display_name(false)),
|
||||
$this->entityname,
|
||||
$userinfosql,
|
||||
@ -227,10 +229,10 @@ class user_profile_fields {
|
||||
$filter->set_options_callback(fn(): array => $profilefield->options);
|
||||
}
|
||||
|
||||
$filters[] = $filter;
|
||||
$filters[$filtername] = $filter;
|
||||
}
|
||||
|
||||
return $filters;
|
||||
return array_values($filters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -87,6 +87,13 @@ final class user_profile_fields_test extends core_reportbuilder_testcase {
|
||||
$userentity->get_entity_name(),
|
||||
))->get_columns();
|
||||
|
||||
// Create a field which will duplicate one of the subsequently generated fields (case-insensitive shortname).
|
||||
$this->getDataGenerator()->create_custom_profile_field([
|
||||
'shortname' => 'CHECKBOX',
|
||||
'name' => 'Duplicate checkbox field',
|
||||
'datatype' => 'checkbox',
|
||||
]);
|
||||
|
||||
// Add new custom profile fields.
|
||||
$userprofilefields = $this->generate_userprofilefields();
|
||||
|
||||
@ -207,6 +214,13 @@ final class user_profile_fields_test extends core_reportbuilder_testcase {
|
||||
$userentity->get_entity_name(),
|
||||
))->get_filters();
|
||||
|
||||
// Create a field which will duplicate one of the subsequently generated fields (case-insensitive shortname).
|
||||
$this->getDataGenerator()->create_custom_profile_field([
|
||||
'shortname' => 'CHECKBOX',
|
||||
'name' => 'Duplicate checkbox field',
|
||||
'datatype' => 'checkbox',
|
||||
]);
|
||||
|
||||
// Add new custom profile fields.
|
||||
$userprofilefields = $this->generate_userprofilefields();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user