Commit c08eabfa authored by Dave Lawrence's avatar Dave Lawrence

Bug 752946 - Moving a bug into another product lists inactive components, milestones and versions

r/a=LpSolit
parent 52c4af9c
...@@ -1465,8 +1465,13 @@ sub _check_component { ...@@ -1465,8 +1465,13 @@ sub _check_component {
$name || ThrowUserError("require_component"); $name || ThrowUserError("require_component");
my $product = blessed($invocant) ? $invocant->product_obj my $product = blessed($invocant) ? $invocant->product_obj
: $params->{product}; : $params->{product};
my $obj = Bugzilla::Component->check({ product => $product, name => $name }); my $old_comp = blessed($invocant) ? $invocant->component
return $obj; : $params->{component};
my $object = Bugzilla::Component->check({ product => $product, name => $name });
if ($object->name ne $old_comp && !$object->is_active) {
ThrowUserError('value_inactive', { class => ref($object), value => $name });
}
return $object;
} }
sub _check_creation_ts { sub _check_creation_ts {
...@@ -1924,10 +1929,15 @@ sub _check_target_milestone { ...@@ -1924,10 +1929,15 @@ sub _check_target_milestone {
my ($invocant, $target, undef, $params) = @_; my ($invocant, $target, undef, $params) = @_;
my $product = blessed($invocant) ? $invocant->product_obj my $product = blessed($invocant) ? $invocant->product_obj
: $params->{product}; : $params->{product};
my $old_target = blessed($invocant) ? $invocant->target_milestone
: $params->{target_milestone};
$target = trim($target); $target = trim($target);
$target = $product->default_milestone if !defined $target; $target = $product->default_milestone if !defined $target;
my $object = Bugzilla::Milestone->check( my $object = Bugzilla::Milestone->check(
{ product => $product, name => $target }); { product => $product, name => $target });
if ($object->name ne $old_target && !$object->is_active) {
ThrowUserError('value_inactive', { class => ref($object), value => $target });
}
return $object->name; return $object->name;
} }
...@@ -1950,8 +1960,12 @@ sub _check_version { ...@@ -1950,8 +1960,12 @@ sub _check_version {
$version = trim($version); $version = trim($version);
my $product = blessed($invocant) ? $invocant->product_obj my $product = blessed($invocant) ? $invocant->product_obj
: $params->{product}; : $params->{product};
my $object = my $old_vers = blessed($invocant) ? $invocant->version
Bugzilla::Version->check({ product => $product, name => $version }); : $params->{version};
my $object = Bugzilla::Version->check({ product => $product, name => $version });
if ($object->name ne $old_vers && !$object->is_active) {
ThrowUserError('value_inactive', { class => ref($object), value => $version });
}
return $object->name; return $object->name;
} }
...@@ -2510,9 +2524,9 @@ sub _set_product { ...@@ -2510,9 +2524,9 @@ sub _set_product {
milestone => $milestone_ok ? $self->target_milestone milestone => $milestone_ok ? $self->target_milestone
: $product->default_milestone : $product->default_milestone
}; };
$vars{components} = [map { $_->name } @{$product->components}]; $vars{components} = [map { $_->name } grep($_->is_active, @{$product->components})];
$vars{milestones} = [map { $_->name } @{$product->milestones}]; $vars{milestones} = [map { $_->name } grep($_->is_active, @{$product->milestones})];
$vars{versions} = [map { $_->name } @{$product->versions}]; $vars{versions} = [map { $_->name } grep($_->is_active, @{$product->versions})];
} }
if (!$verified) { if (!$verified) {
......
...@@ -1722,6 +1722,11 @@ ...@@ -1722,6 +1722,11 @@
[% title = "Unknown Tab" %] [% title = "Unknown Tab" %]
There is no tab named <code>[% current_tab_name FILTER html %]</code>. There is no tab named <code>[% current_tab_name FILTER html %]</code>.
[% ELSIF error == "value_inactive" %]
[% title = "Value is Not Active" %]
[% type = BLOCK %][% INCLUDE object_name class = class %][% END %]
The [% type FILTER html %] value '[% value FILTER html %]' is not active.
[% ELSIF error == "version_already_exists" %] [% ELSIF error == "version_already_exists" %]
[% title = "Version Already Exists" %] [% title = "Version Already Exists" %]
[% admindocslinks = {'versions.html' => 'Administering versions'} %] [% admindocslinks = {'versions.html' => 'Administering versions'} %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment