Bug 68921 - Open/closed for components
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@930 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
668b491eb2
commit
bf617d96eb
|
@ -2091,7 +2091,7 @@ sub set_product {
|
|||
# other part of Bugzilla that checks $@.
|
||||
undef $@;
|
||||
Bugzilla->error_mode($old_error_mode);
|
||||
|
||||
|
||||
my $verified = $params->{change_confirmed};
|
||||
my %vars;
|
||||
if (!$verified || !$component_ok || !$version_ok || !$milestone_ok) {
|
||||
|
@ -2106,7 +2106,7 @@ sub set_product {
|
|||
$vars{component_ok} = $component_ok;
|
||||
$vars{version_ok} = $version_ok;
|
||||
$vars{milestone_ok} = $milestone_ok;
|
||||
$vars{components} = [map { $_->name } @{$product->components}];
|
||||
$vars{components} = [map { $_->name } @{$product->active_components}];
|
||||
$vars{milestones} = [map { $_->name } @{$product->milestones}];
|
||||
$vars{versions} = [map { $_->name } @{$product->versions}];
|
||||
}
|
||||
|
@ -3140,7 +3140,7 @@ sub choices {
|
|||
my %choices = (
|
||||
bug_status => $self->statuses_available,
|
||||
product => \@products,
|
||||
component => $self->product_obj->components,
|
||||
component => $self->product_obj->active_components,
|
||||
version => $self->product_obj->versions,
|
||||
target_milestone => $self->product_obj->milestones,
|
||||
);
|
||||
|
|
|
@ -46,6 +46,7 @@ use constant DB_COLUMNS => qw(
|
|||
description
|
||||
wiki_url
|
||||
default_version
|
||||
is_active
|
||||
);
|
||||
|
||||
use constant REQUIRED_CREATE_FIELDS => qw(
|
||||
|
@ -62,6 +63,7 @@ use constant UPDATE_COLUMNS => qw(
|
|||
description
|
||||
wiki_url
|
||||
default_version
|
||||
is_active
|
||||
);
|
||||
|
||||
use constant VALIDATORS => {
|
||||
|
@ -71,6 +73,7 @@ use constant VALIDATORS => {
|
|||
initialqacontact => \&_check_initialqacontact,
|
||||
description => \&_check_description,
|
||||
initial_cc => \&_check_cc_list,
|
||||
is_active => \&Bugzilla::Object::check_boolean,
|
||||
};
|
||||
|
||||
use constant UPDATE_VALIDATORS => {
|
||||
|
@ -321,6 +324,7 @@ sub _create_series {
|
|||
}
|
||||
}
|
||||
|
||||
sub set_is_active { $_[0]->set('is_active', $_[1]); }
|
||||
sub set_default_version { $_[0]->set('default_version', $_[1]); }
|
||||
sub set_wiki_url { $_[0]->set('wiki_url', $_[1]); }
|
||||
sub set_name { $_[0]->set('name', $_[1]); }
|
||||
|
@ -458,6 +462,7 @@ sub description { return $_[0]->{description}; }
|
|||
sub wiki_url { return $_[0]->{wiki_url}; }
|
||||
sub product_id { return $_[0]->{product_id}; }
|
||||
sub default_version { return $_[0]->{default_version}; }
|
||||
sub is_active { return $_[0]->{is_active}; }
|
||||
|
||||
###############################
|
||||
#### Subroutines ####
|
||||
|
|
|
@ -711,6 +711,22 @@ sub set_group_controls {
|
|||
$self->{check_group_controls} = 1;
|
||||
}
|
||||
|
||||
sub active_components
|
||||
{
|
||||
my $self = shift;
|
||||
if (!defined $self->{active_components})
|
||||
{
|
||||
my $ids = Bugzilla->dbh->selectcol_arrayref(q{
|
||||
SELECT id FROM components
|
||||
WHERE product_id = ? AND is_active = 1
|
||||
ORDER BY name}, undef, $self->id);
|
||||
|
||||
require Bugzilla::Component;
|
||||
$self->{active_components} = Bugzilla::Component->new_from_list($ids);
|
||||
}
|
||||
return $self->{active_components};
|
||||
}
|
||||
|
||||
sub components {
|
||||
my $self = shift;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
|
@ -891,7 +907,7 @@ sub flag_types
|
|||
foreach my $type ('bug', 'attachment')
|
||||
{
|
||||
my %flagtypes;
|
||||
foreach my $component (@{$self->components})
|
||||
foreach my $component (@{$self->active_components})
|
||||
{
|
||||
foreach my $flagtype (@{$component->flag_types->{$type}})
|
||||
{
|
||||
|
@ -979,7 +995,8 @@ Bugzilla::Product - Bugzilla product class.
|
|||
my $product = new Bugzilla::Product(1);
|
||||
my $product = new Bugzilla::Product({ name => 'AcmeProduct' });
|
||||
|
||||
my @components = $product->components();
|
||||
my @components = @{ $product->components() };
|
||||
my @active_components = @{ $product->active_components() };
|
||||
my $groups_controls = $product->group_controls();
|
||||
my @milestones = $product->milestones();
|
||||
my @versions = $product->versions();
|
||||
|
|
|
@ -832,8 +832,8 @@ sub can_enter_product {
|
|||
elsif (!$product->is_active) {
|
||||
ThrowUserError('product_disabled', { product => $product });
|
||||
}
|
||||
# It could have no components...
|
||||
elsif (!@{$product->components}) {
|
||||
# It could have no active components...
|
||||
elsif (!@{$product->active_components}) {
|
||||
ThrowUserError('missing_component', { product => $product });
|
||||
}
|
||||
# It could have no versions...
|
||||
|
|
|
@ -134,10 +134,11 @@ if ($action eq 'new') {
|
|||
default_version => $default_version,
|
||||
wiki_url => $wiki_url,
|
||||
initial_cc => \@initial_cc,
|
||||
is_active => scalar $cgi->param('is_active'),
|
||||
# XXX We should not be creating series for products that we
|
||||
# didn't create series for.
|
||||
create_series => 1,
|
||||
});
|
||||
});
|
||||
|
||||
$vars->{'message'} = 'component_created';
|
||||
$vars->{'comp'} = $component;
|
||||
|
@ -158,7 +159,7 @@ if ($action eq 'new') {
|
|||
if ($action eq 'del') {
|
||||
$vars->{'token'} = issue_session_token('delete_component');
|
||||
$vars->{'comp'} =
|
||||
Bugzilla::Component->check({ product => $product, name => $comp_name });
|
||||
Bugzilla::Component->check({ product => $product, name => $comp_name });
|
||||
$vars->{'product'} = $product;
|
||||
|
||||
$template->process("admin/components/confirm-delete.html.tmpl", $vars)
|
||||
|
@ -241,6 +242,7 @@ if ($action eq 'update') {
|
|||
$component->set_default_version($default_version);
|
||||
$component->set_wiki_url($wiki_url);
|
||||
$component->set_cc_list(\@initial_cc);
|
||||
$component->set_is_active(scalar $cgi->param('is_active'));
|
||||
my $changes = $component->update();
|
||||
|
||||
$vars->{'message'} = 'component_updated';
|
||||
|
|
|
@ -379,7 +379,7 @@ if ($cloned_bug_id) {
|
|||
$cloned_bug_id = $cloned_bug->id;
|
||||
}
|
||||
|
||||
if (scalar(@{$product->components}) == 1) {
|
||||
if (scalar(@{$product->active_components}) == 1) {
|
||||
# Only one component; just pick it.
|
||||
$cgi->param('component', $product->components->[0]->name);
|
||||
$cgi->param('version', $product->components->[0]->default_version);
|
||||
|
|
|
@ -52,6 +52,9 @@ push @{$schema->{products}->{FIELDS}}, notimetracking => {TYPE => 'BOOLEAN', NOT
|
|||
# Bug 53725 - Версия по умолчанию
|
||||
push @{$schema->{components}->{FIELDS}}, default_version => {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "''"};
|
||||
|
||||
# Bug 68921 - Закрытие компонента (так же как закрытие продукта), чтобы в него нельзя было ставить новые баги
|
||||
push @{$schema->{components}->{FIELDS}}, is_active => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 1};
|
||||
|
||||
# Bug 53617 - Ограничение Custom Fields двумя и более значениями контролирующего поля
|
||||
$schema->{fieldvaluecontrol} = {
|
||||
FIELDS => [
|
||||
|
|
|
@ -112,6 +112,12 @@ if (!$dbh->bz_column_info('components', 'default_version'))
|
|||
$dbh->bz_add_column('components', default_version => {TYPE => 'varchar(64)', NOTNULL => 1, DEFAULT => "''"});
|
||||
}
|
||||
|
||||
# Bug 68921 - Закрытие компонента (так же как закрытие продукта), чтобы в него нельзя было ставить новые баги
|
||||
if (!$dbh->bz_column_info('components', 'is_active'))
|
||||
{
|
||||
$dbh->bz_add_column('components', is_active => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 1});
|
||||
}
|
||||
|
||||
# Bug 53617 - Ограничение Custom Fields двумя и более значениями контролирующего поля
|
||||
my @standard_fields = qw(bug_status resolution priority bug_severity op_sys rep_platform);
|
||||
my $custom_fields = $dbh->selectall_arrayref(
|
||||
|
|
|
@ -103,6 +103,12 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Open for [% terms.bug %] entry:</td>
|
||||
<td><input type="checkbox" name="is_active" value="1"
|
||||
[% ' checked="checked"' IF comp.is_active %]>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="right">
|
||||
<label for="wiki_url">Wiki URL:</label>
|
||||
|
|
|
@ -113,6 +113,12 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">Open for [% terms.bug %] entry:</td>
|
||||
<td><input type="checkbox" name="is_active" value="1"
|
||||
[% ' checked="checked"' IF comp.is_active %]>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<label for="wiki_url">Wiki URL:</label>
|
||||
|
|
|
@ -44,20 +44,20 @@
|
|||
|
||||
var last_cc = "[% cc | js %]";
|
||||
var cc_rem = {}, cc_add = {};
|
||||
var initialowners = new Array([% product.components.size %]);
|
||||
var initialowners = new Array([% product.active_components.size %]);
|
||||
var last_initialowner;
|
||||
var initialccs = new Array([% product.components.size %]);
|
||||
var components = new Array([% product.components.size %]);
|
||||
var componentdefaultversions = new Array([% product.components.size %]);
|
||||
var initialccs = new Array([% product.active_components.size %]);
|
||||
var components = new Array([% product.active_components.size %]);
|
||||
var componentdefaultversions = new Array([% product.active_components.size %]);
|
||||
var last_component = -1;
|
||||
var comp_desc = new Array([% product.components.size %]);
|
||||
var flags = new Array([% product.components.size %]);
|
||||
var comp_desc = new Array([% product.active_components.size %]);
|
||||
var flags = new Array([% product.active_components.size %]);
|
||||
[% IF Param("useqacontact") %]
|
||||
var initialqacontacts = new Array([% product.components.size %]);
|
||||
var initialqacontacts = new Array([% product.active_components.size %]);
|
||||
var last_initialqacontact;
|
||||
[% END %]
|
||||
[% count = 0 %]
|
||||
[%- FOREACH c = product.components %]
|
||||
[%- FOREACH c = product.active_components %]
|
||||
components[[% count %]] = "[% c.name FILTER js %]";
|
||||
componentdefaultversions[[% count %]] = "[% c.default_version FILTER js %]";
|
||||
comp_desc[[% count %]] = "[% c.description FILTER html_light FILTER js %]";
|
||||
|
@ -331,7 +331,7 @@ TUI_hide_default('expert_fields');
|
|||
[% qa_contacts_list = user.get_userlist.clone %]
|
||||
[% END %]
|
||||
|
||||
[%- FOREACH c = product.components %]
|
||||
[%- FOREACH c = product.active_components %]
|
||||
<option value="[% c.name FILTER html %]"
|
||||
[% " selected=\"selected\"" IF c.name == default.component_ %]>
|
||||
[% c.name FILTER html -%]
|
||||
|
|
|
@ -256,6 +256,9 @@
|
|||
[% IF changes.wiki_url.defined %]
|
||||
<li>Wiki URL updated to '[% comp.wiki_url | html %]'</li>
|
||||
[% END %]
|
||||
[% IF changes.is_active.defined %]
|
||||
<li>Component is now [% changes.is_active.1 ? "open" : "closed" %] for bug entry.</li>
|
||||
[% END %]
|
||||
[% Hook.process('component_updated_fields') %]
|
||||
</ul>
|
||||
[% ELSE %]
|
||||
|
|
Loading…
Reference in New Issue