MDL-77400 reportbuilder: Fix enrolment status return type

This commit is contained in:
Dani Palou 2023-02-28 09:06:33 +01:00
parent 9ee4f8db8b
commit aec31e312a

View File

@ -69,13 +69,19 @@ class enrolment {
*
* @param string $value
* @param stdClass $row
* @return lang_string|null
* @return string|null
*/
public static function enrolment_status(string $value, stdClass $row): ?lang_string {
public static function enrolment_status(string $value, stdClass $row): ?string {
if (!$row->userid) {
return null;
}
$statusvalues = self::enrolment_values();
return $statusvalues[(int) $value] ?? null;
$value = (int) $value;
if (!array_key_exists($value, $statusvalues)) {
return null;
}
return (string) $statusvalues[$value];
}
}