-
Bug
-
Resolution: Fixed
-
Major
-
2.0.8, 2.1.5, 2.2.2
-
PostgreSQL
-
MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_23_STABLE
-
wip-mdl-31654
-
-
Uploading users that have a column for a Custom Profile field which is a menu may fail because the data from the CSV is directly treated as a key in the Menu Class.
This means if you have user_profile_yearlevel = 9, it will return the value for key 9 or blank in custom profile field yearlevel which may or may not exist. If it did exist it could return the wrong value to be assigned to the yearlevel.
Reproduction steps:
- Create custom profile of type menu.
- Assign various values to the menu.
- Create a csv to upload a value to the menu.
- Update existing users and Existing user details from the file will work.
When the csv is processed you will see this error :-
Error writing to database
|
|
More information about this error
|
|
Debug info: ERROR: null value in column "data" violates not-null constraint
|
UPDATE mdl_user_info_data SET userid = $1,fieldid = $2,data = $3 WHERE id=$4
|
[array (
|
'userid' => '80',
|
'fieldid' => '4',
|
'data' => NULL,
|
0 => '384',
|
)]
|
Stack trace:
|
line 397 of /lib/dml/moodle_database.php: dml_write_exception thrown
|
line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
|
line 936 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
|
line 976 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->update_record_raw()
|
line 118 of /user/profile/lib.php: call to pgsql_native_moodle_database->update_record()
|
line 427 of /user/profile/lib.php: call to profile_field_base->edit_save_data()
|
line 572 of /admin/uploaduser.php: call to profile_save_data()
|