Commit b11f42e2 authored by Robert Lyon's avatar Robert Lyon

Show warn if nonexistant group is in group csv update bug #1187571

To test:
- Fresh install upload some groups via csv
- Add a new group to the csv and then try and upload with the 'Update
groups' option checked

should give broken 'page not found'

- Apply patch
- Add a new group to the csv and then try and upload with the 'Update
groups' option checked

should tell you the line where things are wrong in normal error.

Change-Id: Ifb7558c5c3b51f7fa0d6c677e7ef65badd1d0a24
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 191661df
......@@ -182,6 +182,12 @@ function uploadcsv_validate(Pieform $form, $values) {
$csverrors->add($i, get_string('uploadgroupcsverrorshortnamealreadytaken', 'admin', $i, $shortname));
}
}
else if ($values['updategroups']) {
// The groupname needs to exist
if (!record_exists('group', 'shortname', $shortname, 'institution', $institution)) {
$csverrors->add($i, get_string('uploadgroupcsverrorshortnamemissing', 'admin', $i, $shortname));
}
}
$shortnames[$shortname] = array(
'shortname' => $shortname,
'displayname' => $displayname,
......
......@@ -574,6 +574,7 @@ $string['uploadcsvpagedescription2institutionaladmin'] = '<p>You may use this fa
$string['uploadcsverrortoomanyusers'] = 'You have too many lines in your CSV file. Your file should not contain more than %s.';
$string['uploadgroupcsverrorgroupnamealreadyexists'] = 'Error on line %s of your file: The groupname "%s" already exists.';
$string['uploadgroupcsverrorinvalidshortname'] = 'Error on line %s of your file: The shortname "%s" is invalid.';
$string['uploadgroupcsverrorshortnamemissing'] = 'Error on line %s of your file: The group with the shortname "%s" does not exist.';
$string['uploadgroupcsverrorinvalidgrouptype'] = 'Error on line %s of your file: The grouptype "%s" is invalid.';
$string['uploadgroupcsverrorinvalideditroles'] = 'Error on line %s of your file: The value for editroles "%s" is invalid.';
$string['uploadgroupcsverrorshortnamealreadytaken'] = 'Error on line %s of your file: The shortname "%s" is already taken.';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment