mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'MDL-82475-404' of https://github.com/paulholden/moodle into MOODLE_404_STABLE
This commit is contained in:
commit
83c6906e75
@ -155,8 +155,9 @@ class user_profile_fields {
|
||||
$columnfieldsql = $DB->sql_order_by_text($columnfieldsql, 1024);
|
||||
}
|
||||
|
||||
$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
|
||||
))
|
||||
@ -176,7 +177,7 @@ class user_profile_fields {
|
||||
->set_is_available($profilefield->is_visible());
|
||||
}
|
||||
|
||||
return $columns;
|
||||
return array_values($columns);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -221,9 +222,10 @@ class user_profile_fields {
|
||||
break;
|
||||
}
|
||||
|
||||
$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,
|
||||
$fieldsql,
|
||||
@ -238,10 +240,10 @@ class user_profile_fields {
|
||||
$filter->set_options_callback(fn(): array => $profilefield->options);
|
||||
}
|
||||
|
||||
$filters[] = $filter;
|
||||
$filters[$filtername] = $filter;
|
||||
}
|
||||
|
||||
return $filters;
|
||||
return array_values($filters);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,6 +91,13 @@ 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();
|
||||
|
||||
@ -210,6 +217,13 @@ 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