Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-27931 admin bulk user upload: convert city as required field. Cre…

…dit goes to Charles Fulton for supplying the patch.
  • Loading branch information...
commit 8252cd28485cfa6b562367e21f634ba32b4c3419 1 parent 020f0ff
rwijaya rwijaya authored
Showing with 9 additions and 4 deletions.
  1. +8 −0 admin/uploaduser.php
  2. +1 −4 admin/uploaduser_form.php
8 admin/uploaduser.php
View
@@ -915,6 +915,14 @@
$rowcols['status'][] = $stremailduplicate;
}
}
+
+ if (isset($rowcols['city'])) {
+ $rowcols['city'] = trim($rowcols['city']);
+ if (empty($rowcols['city'])) {
+ $rowcols['status'][] = get_string('fieldrequired', 'error', 'city');
+ }
+ }
+
$rowcols['status'] = implode('<br />', $rowcols['status']);
$data[] = $rowcols;
}
5 admin/uploaduser_form.php
View
@@ -264,6 +264,7 @@ function definition () {
} else {
$mform->setDefault('city', $CFG->defaultcity);
}
+ $mform->addRule('city', get_string('required'), 'required');
$mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
if (empty($CFG->country)) {
@@ -408,10 +409,6 @@ function validation($data, $files) {
if (!in_array('email', $columns) and empty($data['email'])) {
$errors['email'] = get_string('requiredtemplate', 'admin');
}
-
- if (!in_array('city', $columns) and empty($data['city'])) {
- $errors['city'] = get_string('required');
- }
}
return $errors;
Please sign in to comment.
Something went wrong with that request. Please try again.