зеркало из https://github.com/mozilla/pjs.git
Bug 222564 - The chart made when creating a new Product/Component is not public. Patch by gerv; r=kiko, a=justdave.
This commit is contained in:
Родитель
17d421faf3
Коммит
982db96808
|
@ -39,17 +39,22 @@ sub new {
|
|||
|
||||
if ($#_ == 0) {
|
||||
if (ref($_[0])) {
|
||||
# We've been given a CGI object
|
||||
# We've been given a CGI object to create a new Series from.
|
||||
$self->readParametersFromCGI($_[0]);
|
||||
$self->createInDatabase();
|
||||
}
|
||||
else {
|
||||
# We've been given a series_id.
|
||||
# We've been given a series_id, which should represent an existing
|
||||
# Series.
|
||||
$self->initFromDatabase($_[0]);
|
||||
}
|
||||
}
|
||||
elsif ($#_ >= 3) {
|
||||
$self->initFromParameters(@_);
|
||||
elsif ($#_ == 6) {
|
||||
# We've been given a load of parameters to create a new Series from.
|
||||
# We don't get given a series_id; we generate that for ourselves
|
||||
# when we call createInDatabase(). So we pass -1 here.
|
||||
$self->initFromParameters(-1, @_);
|
||||
$self->createInDatabase();
|
||||
}
|
||||
else {
|
||||
die("Bad parameters passed in - invalid number of args \($#_\)($_)");
|
||||
|
@ -77,7 +82,11 @@ sub initFromDatabase {
|
|||
"WHERE series.series_id = $series_id");
|
||||
|
||||
if (@series) {
|
||||
# Note that we calculate $self->{'public'} ourselves instead of passing
|
||||
# it as the last parameter in @series; this is because isSubscribed()
|
||||
# requires the rest of the object to be set up correctly.
|
||||
$self->initFromParameters(@series);
|
||||
$self->{'public'} = $self->isSubscribed(0);
|
||||
}
|
||||
else {
|
||||
&::ThrowCodeError("invalid_series_id", { 'series_id' => $series_id });
|
||||
|
@ -87,14 +96,9 @@ sub initFromDatabase {
|
|||
sub initFromParameters {
|
||||
my $self = shift;
|
||||
|
||||
# The first four parameters are compulsory, unless you immediately call
|
||||
# createInDatabase(), in which case series_id can be left off.
|
||||
($self->{'series_id'}, $self->{'category'}, $self->{'subcategory'},
|
||||
$self->{'name'}, $self->{'creator'}, $self->{'frequency'},
|
||||
$self->{'query'}) = @_;
|
||||
|
||||
$self->{'public'} = $self->isSubscribed(0);
|
||||
$self->{'subscribed'} = $self->isSubscribed($::userid);
|
||||
$self->{'query'}, $self->{'public'}) = @_;
|
||||
}
|
||||
|
||||
sub createInDatabase {
|
||||
|
|
|
@ -3713,10 +3713,9 @@ if (!$series_exists) {
|
|||
|
||||
foreach my $field (@fields) {
|
||||
# Create a Series for each field in this product
|
||||
my $series = new Bugzilla::Series(-1, $product, $all_name,
|
||||
my $series = new Bugzilla::Series($product, $all_name,
|
||||
$field, $::userid, 1,
|
||||
$queries{$field});
|
||||
$series->createInDatabase();
|
||||
$queries{$field}, 1);
|
||||
$seriesids{$field} = $series->{'series_id'};
|
||||
}
|
||||
|
||||
|
@ -3724,10 +3723,9 @@ if (!$series_exists) {
|
|||
# the same set as new products (see editproducts.cgi.)
|
||||
my @openedstatuses = ("UNCONFIRMED", "NEW", "ASSIGNED", "REOPENED");
|
||||
my $query = join("&", map { "bug_status=$_" } @openedstatuses);
|
||||
my $series = new Bugzilla::Series(-1, $product, $all_name,
|
||||
my $series = new Bugzilla::Series($product, $all_name,
|
||||
$open_name, $::userid, 1,
|
||||
$query_prod . $query);
|
||||
$series->createInDatabase();
|
||||
$query_prod . $query, 1);
|
||||
|
||||
# Now, we attempt to read in historical data, if any
|
||||
# Convert the name in the same way that collectstats.pl does
|
||||
|
|
|
@ -465,13 +465,9 @@ if ($action eq 'new') {
|
|||
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,
|
||||
my $series = new Bugzilla::Series($product, $component,
|
||||
$sdata->[0], $::userid, 1,
|
||||
$sdata->[1]);
|
||||
$series->createInDatabase();
|
||||
$sdata->[1], 1);
|
||||
}
|
||||
|
||||
# Make versioncache flush
|
||||
|
|
|
@ -426,14 +426,9 @@ if ($action eq 'new') {
|
|||
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'},
|
||||
my $series = new Bugzilla::Series($product, $::FORM{'subcategory'},
|
||||
$sdata->[0], $::userid, 1,
|
||||
$sdata->[1] . "&product=$product");
|
||||
$series->createInDatabase();
|
||||
$sdata->[1] . "&product=$product", 1);
|
||||
}
|
||||
|
||||
# Make versioncache flush
|
||||
|
|
|
@ -123,7 +123,7 @@ function subcatSelected() {
|
|||
|
||||
<td>
|
||||
[% IF series.creator != 0 %]
|
||||
[% IF series.subscribed %]
|
||||
[% IF series.isSubscribed(user.id) %]
|
||||
<input type="submit" value="Unsubscribe" style="width: 12ex;"
|
||||
name="action-unsubscribe[% series.series_id %]">
|
||||
[% ELSE %]
|
||||
|
@ -134,7 +134,7 @@ function subcatSelected() {
|
|||
</td>
|
||||
|
||||
<td align="center">
|
||||
[% IF user.userid == series.creator OR UserInGroup("admin") %]
|
||||
[% IF user.id == series.creator OR UserInGroup("admin") %]
|
||||
<a href="chart.cgi?action=edit&series_id=
|
||||
[% series.series_id %]">Edit</a>
|
||||
[% END %]
|
||||
|
|
Загрузка…
Ссылка в новой задаче