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. --- editproducts.cgi | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'editproducts.cgi') diff --git a/editproducts.cgi b/editproducts.cgi index 423f028fe..55089d9ae 100755 --- a/editproducts.cgi +++ b/editproducts.cgi @@ -33,9 +33,11 @@ use vars qw ($template $vars); use Bugzilla::Constants; require "CGI.pl"; require "globals.pl"; +use Bugzilla::Series; # Shut up misguided -w warnings about "used only once". "use vars" just # doesn't work for me. +use vars qw(@legal_bug_status @legal_resolution); sub sillyness { my $zz; @@ -272,6 +274,8 @@ if ($action eq 'add') { print "\n
\n"; print "\n"; print "\n"; + print "\n"; + print "\n"; print ""; my $other = $localtrailer; @@ -349,7 +353,7 @@ if ($action eq 'new') { # If we're using bug groups, then we need to create a group for this # product as well. -JMR, 2/16/00 - if(Param("makeproductgroups")) { + if (Param("makeproductgroups")) { # Next we insert into the groups table SendSQL("INSERT INTO groups " . "(name, description, isbuggroup, last_changed) " . @@ -390,8 +394,39 @@ if ($action eq 'new') { PopGlobalSQLState(); } } + } - + # Insert default charting queries for this product. + # If they aren't using charting, this won't do any harm. + GetVersionTable(); + + my @series; + + # We do every status, every resolution, and an "opened" one as well. + foreach my $bug_status (@::legal_bug_status) { + push(@series, [$bug_status, "bug_status=$bug_status"]); + } + + foreach my $resolution (@::legal_resolution) { + next if !$resolution; + push(@series, [$resolution, "resolution=$resolution"]); + } + + # For localisation reasons, we get the name of the "global" subcategory + # and the title of the "open" query from the submitted form. + my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED"); + my $query = join("&", map { "bug_status=$_" } @openedstatuses); + push(@series, [$::FORM{'open_name'}, $query]); + + 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, + $::FORM{'subcategory'}, + $sdata->[0], $::userid, 1, + $sdata->[1] . "&product=$product"); + $series->createInDatabase(); } # Make versioncache flush -- cgit v1.2.3-24-g4f1b