MDL-40683 fix user upload form validation problem

This commit is contained in:
Petr Škoda
2013-10-29 12:05:29 +01:00
parent d147e833c0
commit c3f0f2fd79
+5 -2
View File
@@ -376,12 +376,15 @@ class admin_uploaduser_form2 extends moodleform {
// look for other required data
if ($optype != UU_USER_UPDATE) {
$requiredusernames = useredit_get_required_name_fields();
$errors['uutype'] = '';
$missing = array();
foreach ($requiredusernames as $requiredusername) {
if (!in_array($requiredusername, $columns)) {
$errors['uutype'] .= ' ' . get_string('missingfield', 'error', $requiredusername);
$missing[] = get_string('missingfield', 'error', $requiredusername);;
}
}
if ($missing) {
$errors['uutype'] = implode('<br />', $missing);
}
if (!in_array('email', $columns) and empty($data['email'])) {
$errors['email'] = get_string('requiredtemplate', 'tool_uploaduser');
}