From 33b49fe9c9127992ab86d8347afe17e98868f37e Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 18 Jul 2017 11:03:17 +0800 Subject: [PATCH] MDL-38129 gradeexport: custom profile fields case problem Do not use custom pfofile field name as a field alias in DB query, use field id instead. DML lowercases all column aliases and fields with uppercase letters no longer match. --- grade/lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grade/lib.php b/grade/lib.php index 81ca522cf04..575353b2cbd 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -191,7 +191,7 @@ class graded_users_iterator { LEFT JOIN (SELECT * FROM {user_info_data} WHERE fieldid = :cf$customfieldscount) cf$customfieldscount ON u.id = cf$customfieldscount.userid"; - $userfields .= ", cf$customfieldscount.data AS customfield_{$field->shortname}"; + $userfields .= ", cf$customfieldscount.data AS customfield_{$field->customid}"; $params['cf'.$customfieldscount] = $field->customid; $customfieldscount++; } @@ -3191,7 +3191,7 @@ abstract class grade_helper { */ public static function get_user_field_value($user, $field) { if (!empty($field->customid)) { - $fieldname = 'customfield_' . $field->shortname; + $fieldname = 'customfield_' . $field->customid; if (!empty($user->{$fieldname}) || is_numeric($user->{$fieldname})) { $fieldvalue = $user->{$fieldname}; } else {