aboutsummaryrefslogtreecommitdiffstats
path: root/editgroups.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-03-09 07:53:56 +0000
committerlpsolit%gmail.com <>2006-03-09 07:53:56 +0000
commitefacaaf6ee6b79fca5f256bc29c338b9e51e8c5d (patch)
treeb489c7f5292b4c6519ea2b3d5fd855359bba3003 /editgroups.cgi
parent3cacaab9c9b2d09970fcf901d554d06f0ef16ce2 (diff)
downloadbugs-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar
bugs-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.gz
bugs-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.bz2
bugs-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.xz
bugs-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-xeditgroups.cgi47
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)