diff options
author | 2006-03-09 07:53:56 +0000 | |
---|---|---|
committer | 2006-03-09 07:53:56 +0000 | |
commit | efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d (patch) | |
tree | b489c7f5292b4c6519ea2b3d5fd855359bba3003 /editgroups.cgi | |
parent | Bug 313256: Update CSS for attachment comment in real time to private comment... (diff) | |
download | bugzilla-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.gz bugzilla-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.bz2 bugzilla-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.zip |
Bug 323912: When a group cannot be deleted because it is in used, ThrowUserError() should be called - Patch by Frédéric Buclin <LpSolit@gmail.com> r=GavinS a=myk
Diffstat (limited to 'editgroups.cgi')
-rwxr-xr-x | editgroups.cgi | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/editgroups.cgi b/editgroups.cgi index 026d85b93..a2b33b3f9 100755 --- a/editgroups.cgi +++ b/editgroups.cgi @@ -426,32 +426,31 @@ if ($action eq 'delete') { $cantdelete = 1; } - if (!$cantdelete) { - $dbh->do('UPDATE flagtypes SET grant_group_id = ? - WHERE grant_group_id = ?', - undef, (undef, $gid)); - $dbh->do('UPDATE flagtypes SET request_group_id = ? - WHERE request_group_id = ?', - undef, (undef, $gid)); - $dbh->do('DELETE FROM user_group_map WHERE group_id = ?', - undef, $gid); - $dbh->do('DELETE FROM group_group_map - WHERE grantor_id = ? OR member_id = ?', - undef, ($gid, $gid)); - $dbh->do('DELETE FROM bug_group_map WHERE group_id = ?', - undef, $gid); - $dbh->do('DELETE FROM group_control_map WHERE group_id = ?', - undef, $gid); - $dbh->do('DELETE FROM whine_schedules - WHERE mailto_type = ? AND mailto = ?', - undef, (MAILTO_GROUP, $gid)); - $dbh->do('DELETE FROM groups WHERE id = ?', - undef, $gid); - } - $vars->{'gid'} = $gid; $vars->{'name'} = $name; - $vars->{'cantdelete'} = $cantdelete; + + ThrowUserError('group_cannot_delete', $vars) if $cantdelete; + + $dbh->do('UPDATE flagtypes SET grant_group_id = ? + WHERE grant_group_id = ?', + undef, (undef, $gid)); + $dbh->do('UPDATE flagtypes SET request_group_id = ? + WHERE request_group_id = ?', + undef, (undef, $gid)); + $dbh->do('DELETE FROM user_group_map WHERE group_id = ?', + undef, $gid); + $dbh->do('DELETE FROM group_group_map + WHERE grantor_id = ? OR member_id = ?', + undef, ($gid, $gid)); + $dbh->do('DELETE FROM bug_group_map WHERE group_id = ?', + undef, $gid); + $dbh->do('DELETE FROM group_control_map WHERE group_id = ?', + undef, $gid); + $dbh->do('DELETE FROM whine_schedules + WHERE mailto_type = ? AND mailto = ?', + undef, (MAILTO_GROUP, $gid)); + $dbh->do('DELETE FROM groups WHERE id = ?', + undef, $gid); print $cgi->header(); $template->process("admin/groups/deleted.html.tmpl", $vars) |