From efacaaf6ee6b79fca5f256bc29c338b9e51e8c5d Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 9 Mar 2006 07:53:56 +0000 Subject: =?UTF-8?q?Bug=20323912:=20When=20a=20group=20cannot=20be=20delete?= =?UTF-8?q?d=20because=20it=20is=20in=20used,=20ThrowUserError()=20should?= =?UTF-8?q?=20be=20called=20-=20Patch=20by=20Fr=C3=A9d=C3=A9ric=20Buclin?= =?UTF-8?q?=20=20r=3DGavinS=20a=3Dmyk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editgroups.cgi | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'editgroups.cgi') 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) -- cgit v1.2.1