From a83e476438d44ebe967a115d8d7685b832e7a9c8 Mon Sep 17 00:00:00 2001 From: "bugreport%peshkin.net" <> Date: Wed, 12 May 2004 06:17:05 +0000 Subject: Bug 231975: Avoid naming new product groups the same as existing groups and do not rename product groups on product rename. r=jouni, a=justdave --- editproducts.cgi | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index b3ab7e1a2..79fed4411 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -363,10 +363,14 @@ if ($action eq 'new') { # product as well. -JMR, 2/16/00 if (Param("makeproductgroups")) { # Next we insert into the groups table + my $productgroup = $product; + while (GroupExists($productgroup)) { + $productgroup .= '_'; + } SendSQL("INSERT INTO groups " . "(name, description, isbuggroup, last_changed) " . "VALUES (" . - SqlQuote($product) . ", " . + SqlQuote($productgroup) . ", " . SqlQuote("Access to bugs in the $product product") . ", 1, NOW())"); SendSQL("SELECT last_insert_id()"); my $gid = FetchOneColumn(); @@ -383,25 +387,6 @@ if ($action eq 'new') { "($gid, $product_id, " . Param("useentrygroupdefault") . ", " . CONTROLMAPDEFAULT . ", " . CONTROLMAPNA . ", 0)"); - - # Permit the new product to use any non-product bug groups. - SendSQL("SELECT groups.id, products.id IS NULL FROM groups " . - "LEFT JOIN products " . - "ON groups.name = products.name " . - "WHERE isactive != 0 AND isbuggroup != 0 "); - while (MoreSQLData()) { - my ($grpid, $nonproductgroup) = FetchSQLData(); - if ($nonproductgroup) { - PushGlobalSQLState(); - SendSQL("INSERT INTO group_control_map " . - "(group_id, product_id, entry, " . - "membercontrol, othercontrol, canedit) VALUES " . - "($grpid, $product_id, 0, " . - CONTROLMAPSHOWN . ", " . - CONTROLMAPNA . ", 0)"); - PopGlobalSQLState(); - } - } } # Insert default charting queries for this product. @@ -1191,16 +1176,6 @@ if ($action eq 'update') { } SendSQL("UPDATE products SET name=$qp WHERE id=$product_id"); - # Need to do an update to groups as well. If there is - # a corresponding bug group, we want to update it so it will - # match in the future. If there is no group, this - # update statement will do nothing, so no harm done. -JMR, 3/8/00 - SendSQL("UPDATE groups " . - "SET name = $qp, " . - "description = " . - SqlQuote("Access to bugs in the $product product") . - " WHERE name = $qpold"); - print "Updated product name.
\n"; } unlink "$datadir/versioncache"; -- cgit v1.2.3-24-g4f1b