summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorendico%mozilla.org <>2000-07-14 08:12:49 +0200
committerendico%mozilla.org <>2000-07-14 08:12:49 +0200
commit65695473717fdcadbcc85cac9c469231f352c739 (patch)
treeb5486ebe797e96143e40ca38a08cff2f8288d9fe
parent17c6ef4af4c9c781d6d7a07be420762dfd065703 (diff)
downloadbugzilla-65695473717fdcadbcc85cac9c469231f352c739.tar.gz
bugzilla-65695473717fdcadbcc85cac9c469231f352c739.tar.xz
Bug moving code is now fully implemented. To use it, turn on the param and set the move related params.
-rw-r--r--bug_form.pl34
-rwxr-xr-xbuglist.cgi20
-rw-r--r--defparams.pl38
-rwxr-xr-ximportxml.pl237
-rwxr-xr-xmove.pl59
-rwxr-xr-xprocess_bug.cgi12
6 files changed, 288 insertions, 112 deletions
diff --git a/bug_form.pl b/bug_form.pl
index fea6848d8..4e09e7d98 100644
--- a/bug_form.pl
+++ b/bug_form.pl
@@ -423,6 +423,9 @@ if ($status eq $::unconfirmedstate) {
}
}
+my $movers = Param("movers");
+$movers =~ s/\s?,\s?/|/g;
+$movers =~ s/@/\@/g;
if ($canedit || $::userid == $assignedtoid ||
$::userid == $reporterid || $::userid == $qacontactid) {
@@ -472,6 +475,22 @@ if ($canedit || $::userid == $assignedtoid ||
print "&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=checkbox NAME=compconfirm> and confirm bug (change status to <b>NEW</b>)<BR>";
}
$knum++;
+ } elsif ( Param("move-enabled") && ($bug{'resolution'} eq "MOVED") ) {
+ if ( (defined $::COOKIE{"Bugzilla_login"})
+ && ($::COOKIE{"Bugzilla_login"} =~ /($movers)/) ){
+ print "<INPUT TYPE=radio NAME=knob VALUE=reopen> Reopen bug<br>\n";
+ $knum++;
+ if ($status eq "RESOLVED") {
+ print "<INPUT TYPE=radio NAME=knob VALUE=verify>
+ Mark bug as <b>VERIFIED</b><br>\n";
+ $knum++;
+ }
+ if ($status ne "CLOSED") {
+ print "<INPUT TYPE=radio NAME=knob VALUE=close>
+ Mark bug as <b>CLOSED</b><br>\n";
+ $knum++;
+ }
+ }
} else {
print "<INPUT TYPE=radio NAME=knob VALUE=reopen> Reopen bug<br>\n";
$knum++;
@@ -491,14 +510,25 @@ if ($canedit || $::userid == $assignedtoid ||
print "
<INPUT TYPE=\"submit\" VALUE=\"Commit\">
<INPUT TYPE=\"reset\" VALUE=\"Reset\">
-<INPUT TYPE=hidden name=form_name VALUE=process_bug>
+<INPUT TYPE=\"hidden\" name=\"form_name\" VALUE=\"process_bug\">
<P>
<FONT size=\"+1\"><B>
<A HREF=\"show_activity.cgi?id=$id\">View Bug Activity</A>
&nbsp; | &nbsp;
<A HREF=\"long_list.cgi?buglist=$id\">Format For Printing</A>
</B></FONT><BR>
-</FORM>
+";
+
+if ( Param("move-enabled") && (defined $::COOKIE{"Bugzilla_login"}) && ($::COOKIE{"Bugzilla_login"} =~ /($movers)/) ){
+ print "
+<P>
+<INPUT TYPE=\"SUBMIT\" NAME=\"action\" VALUE=\""
+ . Param("move-button-text") . "\">";
+}
+
+print "</FORM>";
+
+print "
<table><tr><td align=left><B>Description:</B></td>
<td align=right width=100%>Opened: $bug{'creation_ts'}</td></tr></table>
<HR>
diff --git a/buglist.cgi b/buglist.cgi
index fca19ba51..7a02233dd 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -1277,7 +1277,6 @@ document.write(\" <input type=button value=\\\"Uncheck All\\\" onclick=\\\"SetCh
value_quote($::dontchange) . "\"></TD>
</TR>";
}
-
if (@::legal_keywords) {
print qq{
@@ -1394,8 +1393,21 @@ To make changes to a bunch of bugs at once:
comment explaining what you're doing.)
<li> Click the below \"Commit\" button.
</ol></font>
-<INPUT TYPE=SUBMIT VALUE=Commit>
-</FORM><hr>\n";
+<INPUT TYPE=SUBMIT VALUE=Commit>";
+
+ my $movers = Param("movers");
+ $movers =~ s/\s?,\s?/|/g;
+ $movers =~ s/@/\@/g;
+
+ if ( Param("move-enabled")
+ && (defined $::COOKIE{"Bugzilla_login"})
+ && ($::COOKIE{"Bugzilla_login"} =~ /($movers)/) ){
+ print "<P>";
+ print "<INPUT TYPE=\"SUBMIT\" NAME=\"action\" VALUE=\"";
+ print Param("move-button-text") . "\">";
+ }
+
+ print "</FORM><hr>\n";
}
@@ -1425,8 +1437,10 @@ if ($count > 0) {
}
print qq{&nbsp;&nbsp;\n};
print qq{<NOBR><A HREF="query.cgi?$::buffer">Edit this query</A></NOBR>\n};
+
print "</FORM>\n";
}
+
PutFooter();
if ($serverpush) {
diff --git a/defparams.pl b/defparams.pl
index f3ee43a6c..57bda0c89 100644
--- a/defparams.pl
+++ b/defparams.pl
@@ -560,5 +560,41 @@ DefParam("supportwatchers",
" about) another's bugs. Useful for people going on vacation, and" .
" QA folks watching particular developers' bugs",
"b", 0 );
-1;
+
+DefParam("move-enabled",
+ "If this is on, Bugzilla will allow certain people to move bugs to the defined database.",
+ "b",
+ 0);
+DefParam("move-button-text",
+ "The text written on the Move button. Explain where the bug is being moved to.",
+ "t",
+ 'Move To Bugscape');
+DefParam("move-to-url",
+ "The URL of the database we allow some of our bugs to be moved to.",
+ "t",
+ '');
+DefParam("move-to-address",
+ "To move bugs, an email is sent to the target database. This is the email address that database
+ uses to listen for incoming bugs.",
+ "t",
+ 'bugzilla-import');
+DefParam("moved-from-address",
+ "To move bugs, an email is sent to the target database. This is the email address from which
+ this mail, and error messages are sent.",
+ "t",
+ 'bugzilla-admin');
+DefParam("movers",
+ "A list of people with permission to move bugs and reopen moved bugs (in case the move operation fails).",
+ "t",
+ '');
+DefParam("moved-default-product",
+ "Bugs moved from other databases to here are assigned to this product.",
+ "t",
+ '');
+DefParam("moved-default-component",
+ "Bugs moved from other databases to here are assigned to this component.",
+ "t",
+ '');
+
+1;
diff --git a/importxml.pl b/importxml.pl
index a05b69c82..b4b27b1e0 100755
--- a/importxml.pl
+++ b/importxml.pl
@@ -67,6 +67,7 @@ sub sillyness {
my $zz;
$zz = %::components;
$zz = %::versions;
+ $zz = %::keywordsbyname;
$zz = @::legal_bug_status;
$zz = @::legal_opsys;
$zz = @::legal_platform;
@@ -94,7 +95,9 @@ sub MailMessage {
my $to = join (", ", @recipients);
my $header = "To: $to\n";
- $header.= "From: Bugzilla <bugzilla\@beefaroni>\n";
+ my $from = Param("moved-from-address");
+ $from =~ s/@/\@/g;
+ $header.= "From: Bugzilla <$from>\n";
$header.= "Subject: $subject\n\n";
open(SENDMAIL,
@@ -180,6 +183,17 @@ if (defined $tree->[1][0]->{'exporter'}) {
exit;
}
+
+unless ( Param("move-enabled") ) {
+ my $subject = "Error: bug importing is disabled here";
+ my $message = "Cannot import these bugs because importing is disabled\n";
+ $message .= "at this site. For more info, contact ";
+ $message .= Param("maintainer") . ".\n";
+ my @to = (Param("maintainer"), $maintainer, $exporter);
+ MailMessage ($subject, $message, @to);
+ exit;
+}
+
my $exporterid = DBname_to_id($exporter);
if ( ! $exporterid ) {
my $subject = "Bug import error: invalid exporter";
@@ -187,7 +201,7 @@ if ( ! $exporterid ) {
$message .= "bugs here does not have an account in this database.\n";
$message .= "\n\nPlease re-open the original bug.\n";
$message .= "\n\n$xml";
- my @to = (Param("maintainer"), $maintainer);
+ my @to = (Param("maintainer"), $maintainer, $exporter);
MailMessage ($subject, $message, @to);
exit;
}
@@ -233,7 +247,7 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
foreach my $field (qw (dependson product bug_status priority cc version
bug_id rep_platform short_desc assigned_to bug_file_loc resolution
delta_ts component reporter urlbase target_milestone bug_severity
- creation_ts qa_contact keyword status_whiteboard op_sys blocks)) {
+ creation_ts qa_contact keywords status_whiteboard op_sys blocks)) {
$all_fields{$field} = "x";
}
@@ -294,15 +308,13 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
$long_description .= "$sorted_descs[$z]->{'bug_when'}";
$long_description .= " ----\n\n";
}
- $long_description .= "$sorted_descs[$z]->{'thetext'}\n";
+ $long_description .= UnQuoteXMLChars($sorted_descs[$z]->{'thetext'});
+ $long_description .= "\n";
}
-
my $comments;
- my $query = "INSERT INTO bugs (\n";
- my $values = "VALUES (\n";
- $comments .= "\n\n------- Bug Moved by $exporter ";
+ $comments .= "\n\n------- Bug moved to this database by $exporter ";
$comments .= time2str("%Y-%m-%d %H:%M", time);
$comments .= " -------\n\n";
$comments .= "This bug previously known as bug $bug_fields{'bug_id'} at ";
@@ -318,56 +330,85 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
$comments .= "Bug blocks bug(s) $bug_fields{'blocks'}.\n";
}
-
- foreach my $field ( qw(creation_ts delta_ts keywords status_whiteboard) ) {
+ my @query = ();
+ my @values = ();
+ foreach my $field ( qw(creation_ts delta_ts status_whiteboard) ) {
if ( (defined $bug_fields{$field}) && ($bug_fields{$field}) ){
- $query .= "$field,\n";
- $values .= SqlQuote($bug_fields{$field}) . ",\n";
+ push (@query, "$field");
+ push (@values, SqlQuote($bug_fields{$field}));
}
}
if ( (defined $bug_fields{'bug_file_loc'}) && ($bug_fields{'bug_file_loc'}) ){
- $query .= "bug_file_loc,\n";
- $values .= SqlQuote(UnQuoteXMLChars($bug_fields{'bug_file_loc'})) . ",\n";
+ push (@query, "bug_file_loc");
+ push (@values, SqlQuote(UnQuoteXMLChars($bug_fields{'bug_file_loc'})));
}
if ( (defined $bug_fields{'short_desc'}) && ($bug_fields{'short_desc'}) ){
- $query .= "short_desc,\n";
- $values .= SqlQuote(UnQuoteXMLChars($bug_fields{'short_desc'})) . ",\n";
+ push (@query, "short_desc");
+ push (@values, SqlQuote(UnQuoteXMLChars($bug_fields{'short_desc'})) );
}
+
+ my $prod;
+ my $comp;
+ my $default_prod = Param("moved-default-product");
+ my $default_comp = Param("moved-default-component");
+ if ( (defined ($bug_fields{'product'})) &&
+ (defined ($bug_fields{'component'})) ) {
+ $prod = $bug_fields{'product'};
+ $comp = $bug_fields{'component'};
+ } else {
+ $prod = $default_prod;
+ $comp = $default_comp;
+ }
+
my @product;
- if (defined ($bug_fields{'product'}) &&
- (@product = grep /^$bug_fields{'product'}$/i, @::legal_product) ){
- $query .= "product,\n";
- $values .= SqlQuote($product[0]) . ",\n";
+ my @component;
+ if ((@product = grep /^$prod$/i, @::legal_product) &&
+ (@component = grep /^$comp$/i, @{$::components{$product[0]}}) ) {
+ push (@query, "product");
+ push (@values, SqlQuote($product[0]) );
+ push (@query, "component");
+ push (@values, SqlQuote($component[0]) );
+ } elsif ((@product = grep /^$default_prod$/i, @::legal_product) &&
+ (@component = grep /^$default_comp$/i, @{$::components{$product[0]}}) ) {
+ push (@query, "product");
+ push (@values, SqlQuote($product[0]) );
+ push (@query, "component");
+ push (@values, SqlQuote($component[0]) );
} else {
- $query .= "product,\n";
- $values .= "\'From Bugzilla\',\n";
- $product[0] = "From Bugzilla";
- $err .= "Unknown product $bug_fields{'product'}. ";
- $err .= "Moving to default product \"From Bugzilla\".\n";
+ my $subject = "Bug import error: invalid default product or component";
+ my $message = "Cannot import these bugs because an invalid default ";
+ $message .= "product and/or component was defined for the target db.\n";
+ $message .= Param("maintainer") . " needs to fix the definitions of ";
+ $message .= "moved-default-product and moved-default-component.\n";
+ $message .= "\n\nPlease re-open the original bug.\n";
+ $message .= "\n\n$xml";
+ my @to = (Param("maintainer"), $maintainer, $exporter);
+ MailMessage ($subject, $message, @to);
+ exit;
}
if (defined ($::versions{$product[0]} ) &&
(my @version = grep /^$bug_fields{'version'}$/i,
@{$::versions{$product[0]}}) ){
- $values .= SqlQuote($version[0]) . ",\n";
- $query .= "version,\n";
+ push (@values, SqlQuote($version[0]) );
+ push (@query, "version");
} else {
- $query .= "version,\n";
- $values .= "\'@{$::versions{$product[0]}}->[0]\',\n";
+ push (@query, "version");
+ push (@values, SqlQuote(@{$::versions{$product[0]}}->[0]));
$err .= "Unknown version $bug_fields{'version'} in product $product[0]. ";
$err .= "Setting version to \"@{$::versions{$product[0]}}->[0]\".\n";
}
if (defined ($bug_fields{'priority'}) &&
(my @priority = grep /^$bug_fields{'priority'}$/i, @::legal_priority) ){
- $values .= SqlQuote($priority[0]) . ",\n";
- $query .= "priority,\n";
+ push (@values, SqlQuote($priority[0]) );
+ push (@query, "priority");
} else {
- $values .= "\'P3\',\n";
- $query .= "priority,\n";
+ push (@values, SqlQuote("P3"));
+ push (@query, "priority");
$err .= "Unknown priority ";
$err .= (defined $bug_fields{'priority'})?$bug_fields{'priority'}:"unknown";
$err .= ". Setting to default priority \"P3\".\n";
@@ -375,11 +416,11 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
if (defined ($bug_fields{'rep_platform'}) &&
(my @platform = grep /^$bug_fields{'rep_platform'}$/i, @::legal_platform) ){
- $values .= SqlQuote($platform[0]) . ",\n";
- $query .= "rep_platform,\n";
+ push (@values, SqlQuote($platform[0]) );
+ push (@query, "rep_platform");
} else {
- $values .= "\'Other\',\n";
- $query .= "rep_platform,\n";
+ push (@values, SqlQuote("Other") );
+ push (@query, "rep_platform");
$err .= "Unknown platform ";
$err .= (defined $bug_fields{'rep_platform'})?
$bug_fields{'rep_platform'}:"unknown";
@@ -388,45 +429,28 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
if (defined ($bug_fields{'op_sys'}) &&
(my @opsys = grep /^$bug_fields{'op_sys'}$/i, @::legal_opsys) ){
- $values .= SqlQuote($opsys[0]) . ",\n";
- $query .= "op_sys,\n";
+ push (@values, SqlQuote($opsys[0]) );
+ push (@query, "op_sys");
} else {
- $values .= "\'other\',\n";
- $query .= "op_sys,\n";
+ push (@values, SqlQuote("other"));
+ push (@query, "op_sys");
$err .= "Unknown operating system ";
$err .= (defined $bug_fields{'op_sys'})?$bug_fields{'op_sys'}:"unknown";
$err .= ". Setting to default OS \"other\".\n";
}
- my @component;
- if (defined ($::components{$product[0]} ) &&
- (@component = grep /^$bug_fields{'component'}$/i,
- @{$::components{$product[0]}}) ){
- $values .= SqlQuote($component[0]) . ",\n";
- $query .= "component,\n";
- } else {
- $component[0] = $::components{$product[0]}->[0];
- $values .= SqlQuote($component[0]) . ",\n";
- $query .= "component,\n";
- $err .= "Unknown component \"";
- $err .= (defined $bug_fields{'component'})?$bug_fields{'component'}:"unknown";
- $err .= "\" in product \"$product[0]\".\n";
- $err .= " Setting to this product\'s first component, ";
- $err .= "\'$::components{$product[0]}->[0]\'.\n";
- }
-
if (Param("usetargetmilestone")) {
if (defined ($::target_milestone{$product[0]} ) &&
(my @tm = grep /^$bug_fields{'target_milestone'}$/i,
@{$::target_milestone{$product[0]}}) ){
- $values .= SqlQuote($tm[0]) . ",\n";
- $query .= "target_milestone,\n";
+ push (@values, SqlQuote($tm[0]) );
+ push (@query, "target_milestone");
} else {
SendSQL("SELECT defaultmilestone FROM products " .
"WHERE product = " . SqlQuote($product[0]));
my $tm = FetchOneColumn();
- $values .= "\'$tm\',\n";
- $query .= "target_milestone,\n";
+ push (@values, SqlQuote($tm));
+ push (@query, "target_milestone");
$err .= "Unknown milestone \"";
$err .= (defined $bug_fields{'target_milestone'})?
$bug_fields{'target_milestone'}:"unknown";
@@ -439,11 +463,11 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
if (defined ($bug_fields{'bug_severity'}) &&
(my @severity= grep /^$bug_fields{'bug_severity'}$/i,
@::legal_severity) ){
- $values .= SqlQuote($severity[0]) . ",\n";
- $query .= "bug_severity,\n";
+ push (@values, SqlQuote($severity[0]) );
+ push (@query, "bug_severity");
} else {
- $values .= "\'normal',\n";
- $query .= "bug_severity,\n";
+ push (@values, SqlQuote("normal"));
+ push (@query, "bug_severity");
$err .= "Unknown severity ";
$err .= (defined $bug_fields{'bug_severity'})?
$bug_fields{'bug_severity'}:"unknown";
@@ -452,11 +476,11 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
my $reporterid = DBname_to_id($bug_fields{'reporter'});
if ( ($bug_fields{'reporter'}) && ( $reporterid ) ) {
- $values .= "'$reporterid',\n";
- $query .= "reporter,\n";
+ push (@values, SqlQuote($reporterid));
+ push (@query, "reporter");
} else {
- $values .= "'$exporterid',\n";
- $query .= "reporter,\n";
+ push (@values, SqlQuote($exporterid));
+ push (@query, "reporter");
$err .= "The original reporter of this bug does not have\n";
$err .= " an account here. Reassigning to the person who moved\n";
$err .= " it here, $exporter.\n";
@@ -470,11 +494,11 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
my $changed_owner = 0;
if ( ($bug_fields{'assigned_to'}) &&
( DBname_to_id($bug_fields{'assigned_to'})) ) {
- $values .= "'" . DBname_to_id($bug_fields{'assigned_to'}) . "',\n";
- $query .= "assigned_to,\n";
+ push (@values, SqlQuote(DBname_to_id($bug_fields{'assigned_to'})));
+ push (@query, "assigned_to");
} else {
- $values .= "'" . $exporterid . "',\n";
- $query .= "assigned_to,\n";
+ push (@values, SqlQuote($exporterid) );
+ push (@query, "assigned_to");
$changed_owner = 1;
$err .= "The original owner of this bug does not have\n";
$err .= " an account here. Reassigning to the person who moved\n";
@@ -489,8 +513,8 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
my @resolution;
if (defined ($bug_fields{'resolution'}) &&
(@resolution= grep /^$bug_fields{'resolution'}$/i, @::legal_resolution) ){
- $values .= SqlQuote($resolution[0]) . ",\n";
- $query .= "resolution,\n";
+ push (@values, SqlQuote($resolution[0]) );
+ push (@query, "resolution");
} elsif ( (defined $bug_fields{'resolution'}) && (!$resolution[0]) ){
$err .= "Unknown resolution \"$bug_fields{'resolution'}\".\n";
}
@@ -499,8 +523,8 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
# resolution is set, which indicates that the bug should be closed.
#
if ( ($changed_owner) && (!$resolution[0]) ) {
- $values .= "\'NEW\',\n";
- $query .= "bug_status,\n";
+ push (@values, SqlQuote("NEW"));
+ push (@query, "bug_status");
$err .= "Bug assigned to new owner, setting status to \"NEW\".\n";
$err .= " Previous status was \"";
$err .= (defined $bug_fields{'bug_status'})?
@@ -508,8 +532,8 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
$err .= "\".\n";
} elsif ( (defined ($bug_fields{'resolution'})) && (!$resolution[0]) ){
#if the resolution was illegal then set status to NEW
- $values .= "\'NEW\',\n";
- $query .= "bug_status,\n";
+ push (@values, SqlQuote("NEW"));
+ push (@query, "bug_status");
$err .= "Resolution was invalid. Setting status to \"NEW\".\n";
$err .= " Previous status was \"";
$err .= (defined $bug_fields{'bug_status'})?
@@ -518,12 +542,12 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
} elsif (defined ($bug_fields{'bug_status'}) &&
(my @status = grep /^$bug_fields{'bug_status'}$/i, @::legal_bug_status) ){
#if a bug status was set then use it, if its legal
- $values .= SqlQuote($status[0]) . ",\n";
- $query .= "bug_status,\n";
+ push (@values, SqlQuote($status[0]));
+ push (@query, "bug_status");
} else {
# if all else fails, make the bug new
- $values .= "\'NEW\',\n";
- $query .= "bug_status,\n";
+ push (@values, SqlQuote("NEW"));
+ push (@query, "bug_status");
$err .= "Unknown status ";
$err .= (defined $bug_fields{'bug_status'})?
$bug_fields{'bug_status'}:"unknown";
@@ -534,21 +558,26 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
my $qa_contact;
if ( (defined $bug_fields{'qa_contact'}) &&
($qa_contact = DBname_to_id($bug_fields{'qa_contact'})) ){
- $values .= "'$qa_contact'";
- $query .= "qa_contact\n";
+ push (@values, SqlQuote($qa_contact));
+ push (@query, "qa_contact");
} else {
SendSQL("select initialqacontact from components where program=" .
SqlQuote($product[0]) .
" and value=" . SqlQuote($component[0]) );
$qa_contact = FetchOneColumn();
- $values .= SqlQuote(DBname_to_id($qa_contact)) . "\n";
- $query .= "qa_contact\n";
+ push (@values, SqlQuote(DBname_to_id($qa_contact)) );
+ push (@query, "qa_contact");
$err .= "Setting qa contact to the default for this product.\n";
$err .= " This bug either had no qa contact or an invalid one.\n";
}
}
- $query .= ") $values )\n";
+
+ my $query = "INSERT INTO bugs (\n"
+ . join (",\n", @query)
+ . "\n) VALUES (\n"
+ . join (",\n", @values)
+ . "\n)\n";
SendSQL($query);
SendSQL("select LAST_INSERT_ID()");
my $id = FetchOneColumn();
@@ -562,6 +591,24 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
}
}
+ if (defined ($bug_fields{'keywords'})) {
+ my %keywordseen;
+ foreach my $keyword (split(/[\s,]+/, $bug_fields{'keywords'})) {
+ if ($keyword eq '') {
+ next;
+ }
+ my $i = $::keywordsbyname{$keyword};
+ if (!$i) {
+ $err .= "Skipping unknown keyword: $keyword.\n";
+ next;
+ }
+ if (!$keywordseen{$i}) {
+ SendSQL("INSERT INTO keywords (bug_id, keywordid) VALUES ($id, $i)");
+ $keywordseen{$i} = 1;
+ }
+ }
+ }
+
$long_description .= "\n" . $comments;
if ($err) {
$long_description .= "\n$err\n";
@@ -570,13 +617,17 @@ for (my $k=1 ; $k <= $bugqty ; $k++) {
SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext) VALUES " .
"($id, $exporterid, now(), " . SqlQuote($long_description) . ")");
- $log .= "Bug $bug_fields{'bug_id'}\@$urlbase imported as bug $id.\n";
+ $log .= "Bug $urlbase/show_bug.cgi?id=$bug_fields{'bug_id'} ";
+ $log .= "imported as bug $id.\n";
+ $log .= Param("urlbase") . "/show_bug.cgi?id=$id\n\n";
if ($err) {
- $log .= "The following problems were encountered importing this bug.\n";
- $log .= "You may have to set certain fields in the new bug by hand.\n";
+ $log .= "The following problems were encountered creating bug $id.\n";
+ $log .= "You may have to set certain fields in the new bug by hand.\n\n";
$log .= $err;
- $log .= "\n\n";
+ $log .= "\n\n\n";
}
+
+ system("./processmail", $id, $exporter);
}
my $subject = "$bugqty bug(s) successfully moved from $urlbase to "
diff --git a/move.pl b/move.pl
index f6b404645..aed6649a4 100755
--- a/move.pl
+++ b/move.pl
@@ -27,6 +27,12 @@ use Bug;
require "CGI.pl";
$::lockcount = 0;
+unless ( Param("move-enabled") ) {
+ print "\n<P>Sorry. Bug moving is not enabled here. ";
+ print "If you need to move a bug, contact " . Param("maintainer");
+ exit;
+}
+
ConnectToDatabase();
sub Log {
@@ -65,14 +71,22 @@ sub Unlock {
}
if ( !defined $::FORM{'buglist'} ) {
- print "To move bugs, perform a ";
+ print "Content-type: text/html\n\n";
+ PutHeader("Move Bugs");
+ print "Move bugs either from the bug display page or perform a ";
print "<A HREF=\"query.cgi\">query</A> and change several bugs at once.\n";
+ print "If you don't see the move button, then you either aren't ";
+ print "logged in or aren't permitted to.";
+ PutFooter();
exit;
}
confirm_login();
my $exporter = $::COOKIE{"Bugzilla_login"};
-unless ($exporter =~ /(lchaing\@netscape.com|leger\@netscape.com|endico\@mozilla.org|dmose\@mozilla.org)/) {
+my $movers = Param("movers");
+$movers =~ s/\w?,\w?/|/g;
+$movers =~ s/@/\@/g;
+unless ($exporter =~ /($movers)/) {
print "Content-type: text/html\n\n";
PutHeader("Move Bugs");
print "<P>You do not have permission to move bugs<P>\n";
@@ -88,15 +102,32 @@ foreach my $id (split(/:/, $::FORM{'buglist'})) {
my $bug = new Bug($id, $::userid);
$xml .= $bug->emitXML;
if (!$bug->error) {
- SendSQL("UPDATE bugs SET bug_status =\"MOVED\" where bug_id=\"$id\"");
- SendSQL("UPDATE bugs SET resolution =\"\" where bug_id=\"$id\"");
- my $exp = $exporter;
- $exp =~ s/@/\@/;
- my $comment = "Bug moved to http://bugscape.netscape.com/ by $exp.\n";
+ my $exporterid = DBNameToIdAndCheck($exporter);
+
+ my $fieldid = GetFieldID("bug_status");
+ my $cur_status= $bug->bug_status;
+ SendSQL("INSERT INTO bugs_activity " .
+ "(bug_id,who,bug_when,fieldid,oldvalue,newvalue) VALUES " .
+ "($id,$exporterid,now(),$fieldid,'$cur_status','RESOLVED')");
+ my $fieldid = GetFieldID("resolution");
+ my $cur_res= $bug->resolution;
+ SendSQL("INSERT INTO bugs_activity " .
+ "(bug_id,who,bug_when,fieldid,oldvalue,newvalue) VALUES " .
+ "($id,$exporterid,now(),$fieldid,'$cur_res','MOVED')");
+
+ SendSQL("UPDATE bugs SET bug_status =\"RESOLVED\" where bug_id=\"$id\"");
+ SendSQL("UPDATE bugs SET resolution =\"MOVED\" where bug_id=\"$id\"");
+
+ my $comment = "Bug moved to " . Param("move-to-url") . ".\n\n";
+ $comment .= "If the move succeeded, $exporter will recieve a mail\n";
+ $comment .= "containing the number of the new bug in the other database.\n";
+ $comment .= "If all went well, please mark this bug verified, and paste\n";
+ $comment .= "in a link to the new bug. Otherwise, reopen this bug.\n";
SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext) VALUES " .
- "($id, " . DBNameToIdAndCheck($exporter)
- . ", now(), " . SqlQuote($comment) . ")");
- print "Bug $id moved to http://bugscape.netscape.com/.<BR>\n";
+ "($id, $exporterid, now(), " . SqlQuote($comment) . ")");
+
+ print "<P>Bug $id moved to " . Param("move-to-url") . ".<BR>\n";
+ system("./processmail", $id, $exporter);
}
}
print "<P>\n";
@@ -106,9 +137,12 @@ my $buglist = $::FORM{'buglist'};
$buglist =~ s/:/,/g;
my $host = Param("urlbase");
$host =~ s#http://([^/]+)/.*#$1#;
-my $to = "endico\@localhost";
+my $to = Param("move-to-address");
+$to =~ s/@/\@/;
my $msg = "To: $to\n";
-$msg .= "From: Bugzilla <bugzilla\@$host>\n";
+my $from = Param("moved-from-address");
+$from =~ s/@/\@/;
+$msg .= "From: Bugzilla <" . $from . ">\n";
$msg .= "Subject: Moving bug(s) $buglist\n\n";
$msg .= $xml . "\n";
@@ -120,4 +154,3 @@ close SENDMAIL;
my $logstr = "XML: bugs $buglist sent to $to";
Log($logstr);
-
diff --git a/process_bug.cgi b/process_bug.cgi
index 689034bd9..3479710f1 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -255,6 +255,18 @@ if (defined $::FORM{'id'}) {
}
}
+my $action = '';
+if (defined $::FORM{action}) {
+ $action = trim($::FORM{action});
+}
+if ($action eq Param("move-button-text")) {
+ $::FORM{'buglist'} = join (":", @idlist);
+ do "move.pl" || die "Error executing move.cgi: $!";
+ PutFooter();
+ exit;
+}
+
+
if (!defined $::FORM{'who'}) {
$::FORM{'who'} = $::COOKIE{'Bugzilla_login'};
}