summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authorbbaetz%student.usyd.edu.au <>2002-08-12 14:42:42 +0200
committerbbaetz%student.usyd.edu.au <>2002-08-12 14:42:42 +0200
commit61ddf0a32846fdf2607043d94af1a0a86b80f6fc (patch)
tree714517b4c6b9e33b10a12aa5a4b99641bcafefef /process_bug.cgi
parent17b301e76d886afd5be8f4e9919afb4446e49405 (diff)
downloadbugzilla-61ddf0a32846fdf2607043d94af1a0a86b80f6fc.tar.gz
bugzilla-61ddf0a32846fdf2607043d94af1a0a86b80f6fc.tar.xz
Bug 43600 - Convert products/components to use ids instead of names.
Initial attempt by jake@bugzilla.org, updated by me r=joel, preed
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi68
1 files changed, 58 insertions, 10 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index d13f51b6c..0a1ff2728 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -174,7 +174,8 @@ sub CheckonComment( $ ) {
# and make the user verify the version, component, target milestone,
# and bug groups if so.
if ( $::FORM{'id'} ) {
- SendSQL("SELECT product FROM bugs WHERE bug_id = $::FORM{'id'}");
+ SendSQL("SELECT name FROM products, bugs " .
+ "WHERE products.id = bugs.product_id AND bug_id = $::FORM{'id'}");
$::oldproduct = FetchSQLData();
}
if ((($::FORM{'id'} && $::FORM{'product'} ne $::oldproduct)
@@ -503,8 +504,8 @@ if($::usergroupset ne '0') {
}
foreach my $field ("rep_platform", "priority", "bug_severity",
- "summary", "component", "bug_file_loc", "short_desc",
- "product", "version", "op_sys",
+ "summary", "bug_file_loc", "short_desc",
+ "version", "op_sys",
"target_milestone", "status_whiteboard") {
if (defined $::FORM{$field}) {
if ($::FORM{$field} ne $::dontchange) {
@@ -514,6 +515,41 @@ foreach my $field ("rep_platform", "priority", "bug_severity",
}
}
+my $prod_id; # Remember, can't use this for mass changes
+if ($::FORM{'product'} ne $::dontchange) {
+ $prod_id = get_product_id($::FORM{'product'});
+ if (! $prod_id) {
+ DisplayError("The <tt>" . html_quote($::FORM{'product'}) .
+ "</tt> product doesn't exist.");
+ exit;
+ }
+ DoComma();
+ $::query .= "product_id = $prod_id";
+} else {
+ SendSQL("SELECT DISTINCT product_id FROM bugs WHERE bug_id IN (" .
+ join(',', @idlist) . ") LIMIT 2");
+ $prod_id = FetchOneColumn();
+ $prod_id = undef if (FetchOneColumn());
+}
+
+my $comp_id; # Remember, can't use this for mass changes
+if ($::FORM{'component'} ne $::dontchange) {
+ if (!defined $prod_id) {
+ ThrowUserError("You cannot change the component from a list of bugs " .
+ "covering more than one product");
+ }
+ $comp_id = get_component_id($prod_id,
+ $::FORM{'component'});
+ if (! $comp_id) {
+ DisplayError("The <tt>" . html_quote($::FORM{'component'}) .
+ "</tt> component doesn't exist in the <tt>" .
+ html_quote($::FORM{'product'}) . "</tt> product");
+ exit;
+ }
+ DoComma();
+ $::query .= "component_id = $comp_id";
+}
+
# If this installation uses bug aliases, and the user is changing the alias,
# add this change to the query.
if (Param("usebugaliases") && defined($::FORM{'alias'})) {
@@ -708,17 +744,15 @@ SWITCH: for ($::FORM{'knob'}) {
DoConfirm();
}
ChangeStatus('NEW');
- SendSQL("select initialowner from components where program=" .
- SqlQuote($::FORM{'product'}) . " and value=" .
- SqlQuote($::FORM{'component'}));
+ SendSQL("SELECT initialowner FROM components " .
+ "WHERE components.id = $comp_id");
my $newid = FetchOneColumn();
my $newname = DBID_to_name($newid);
DoComma();
$::query .= "assigned_to = $newid";
if (Param("useqacontact")) {
- SendSQL("select initialqacontact from components where program=" .
- SqlQuote($::FORM{'product'}) .
- " and value=" . SqlQuote($::FORM{'component'}));
+ SendSQL("SELECT initialqacontact FROM components " .
+ "WHERE components.id = $comp_id");
my $qacontact = FetchOneColumn();
if (defined $qacontact && $qacontact != 0) {
DoComma();
@@ -923,8 +957,9 @@ foreach my $id (@idlist) {
SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " .
"cc AS selectVisible_cc $write, " .
"profiles $write, dependencies $write, votes $write, " .
+ "products READ, components READ, " .
"keywords $write, longdescs $write, fielddefs $write, " .
- "keyworddefs READ, groups READ, attachments READ, products READ");
+ "keyworddefs READ, groups READ, attachments READ");
my @oldvalues = SnapShotBug($id);
my %oldhash;
my $i = 0;
@@ -1270,6 +1305,19 @@ foreach my $id (@idlist) {
}
if ($old ne $new) {
+ # Products and components are now stored in the DB using ID's
+ # We need to translate this to English before logging it
+ if ($col eq 'product_id') {
+ $old = get_product_name($old);
+ $new = get_product_name($new);
+ $col = 'product';
+ }
+ if ($col eq 'component_id') {
+ $old = get_component_name($old);
+ $new = get_component_name($new);
+ $col = 'component';
+ }
+
# save off the old value for passing to processmail so the old
# owner can be notified
#