Commit 2c162df1 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't get angry when zero members are removed from an institution

parent 6bd382df
......@@ -165,6 +165,9 @@ function institutionusers_submit(Pieform $form, $values) {
if ($dataerror) {
$SESSION->add_error_msg(get_string('errorupdatinginstitutionusers', 'admin'));
redirect($url);
} else if (empty($values['users'])) {
$SESSION->add_ok_msg(get_string('nousersupdated', 'admin'));
redirect($url);
}
if ($values['usertype'] == 'members') {
......@@ -193,7 +196,7 @@ function institutionusers_submit(Pieform $form, $values) {
db_begin();
if ($action == 'removeMembers') {
$institution->removeMembers($values['users']);
} else if (!empty($values['users'])) {
} else {
foreach ($values['users'] as $id) {
$institution->{$action}($id);
}
......
......@@ -361,6 +361,7 @@ $string['currentmembers'] = 'Current Members';
$string['userstoberemoved'] = 'Users to be removed';
$string['removeusers'] = 'Remove Users';
$string['declinerequests'] = 'Decline requests';
$string['nousersupdated'] = 'No users were updated';
$string['institutionusersupdated_addUserAsMember'] = 'Users added';
$string['institutionusersupdated_declineRequestFromUser'] = 'Requests declined';
......
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