summaryrefslogtreecommitdiffstats
path: root/editgroups.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-03-09 08:53:56 +0100
committerlpsolit%gmail.com <>2006-03-09 08:53:56 +0100
commitefacaaf6ee6b79fca5f256bc29c338b9e51e8c5d (patch)
treeb489c7f5292b4c6519ea2b3d5fd855359bba3003 /editgroups.cgi
parent3cacaab9c9b2d09970fcf901d554d06f0ef16ce2 (diff)
downloadbugzilla-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.gz
bugzilla-efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d.tar.xz
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)