From 4f6b75a65628b0d86c760309dd81dd03f5c6d308 Mon Sep 17 00:00:00 2001
From: "gerv%gerv.net" <>
Date: Thu, 26 Jun 2003 06:22:50 +0000
Subject: Bug 16009 - generic charting. Patch by gerv; r,a=justdave.
---
editcomponents.cgi | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
(limited to 'editcomponents.cgi')
diff --git a/editcomponents.cgi b/editcomponents.cgi
index 74e0debe8..018c89cdf 100755
--- a/editcomponents.cgi
+++ b/editcomponents.cgi
@@ -31,6 +31,8 @@ use lib ".";
require "CGI.pl";
require "globals.pl";
+use Bugzilla::Series;
+
# Shut up misguided -w warnings about "used only once". For some reason,
# "use vars" chokes on me when I try it here.
@@ -352,6 +354,8 @@ if ($action eq 'add') {
print "\n
\n";
print "\n";
print "\n";
+ print "\n";
+ print "\n";
print "";
my $other = $localtrailer;
@@ -440,6 +444,32 @@ if ($action eq 'new') {
SqlQuote($initialownerid) . "," .
SqlQuote($initialqacontactid) . ")");
+ # Insert default charting queries for this product.
+ # If they aren't using charting, this won't do any harm.
+ GetVersionTable();
+
+ my @series;
+ my $prodcomp = "&product=$product&component=$component";
+
+ # For localisation reasons, we get the title of the queries from the
+ # submitted form.
+ my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
+ my $statuses = join("&", map { "bug_status=$_" } @openedstatuses);
+ push(@series, [$::FORM{'open_name'}, $statuses . $prodcomp]);
+
+ my $resolved = "field0-0-0=resolution&type0-0-0=notequals&value0-0-0=---";
+ push(@series, [$::FORM{'closed_name'}, $resolved . $prodcomp]);
+
+ foreach my $sdata (@series) {
+ # We create the series with an nonsensical series_id, which is
+ # guaranteed not to exist. This is OK, because we immediately call
+ # createInDatabase().
+ my $series = new Bugzilla::Series(-1, $product, $component,
+ $sdata->[0], $::userid, 1,
+ $sdata->[1]);
+ $series->createInDatabase();
+ }
+
# Make versioncache flush
unlink "data/versioncache";
--
cgit v1.2.3-24-g4f1b