Merge branch 'wip-MDL-40408-master' of git://github.com/marinaglancy/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 10 Jul 2017 13:36:40 +0000 (14:36 +0100)
committerDan Poltawski <dan@moodle.com>
Mon, 10 Jul 2017 13:36:40 +0000 (14:36 +0100)
mod/data/import.php

index 27b1010..03f4815 100644 (file)
@@ -114,9 +114,14 @@ if (!$formdata = $form->get_data()) {
         $rawfields = $DB->get_records('data_fields', array('dataid' => $data->id), '', 'name, id, type');
         $fields = array();
         $errorfield = '';
+        $safetoskipfields = array(get_string('user'), get_string('username'), get_string('email'),
+            get_string('timeadded', 'data'), get_string('timemodified', 'data'),
+            get_string('approved', 'data'));
         foreach ($fieldnames as $name => $id) {
             if (!isset($rawfields[$name])) {
-                $errorfield .= "'$name' ";
+                if (!in_array($name, $safetoskipfields)) {
+                    $errorfield .= "'$name' ";
+                }
             } else {
                 $field = $rawfields[$name];
                 require_once("$CFG->dirroot/mod/data/field/$field->type/field.class.php");