Bug 88525 - Fix for "static" values (---)

git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1440 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2011-10-24 12:16:25 +00:00
parent cc3e56e884
commit 50a28a8f4a
4 changed files with 13 additions and 10 deletions

View File

@ -517,8 +517,10 @@ sub restricted_legal_values
{
my $hash = Bugzilla->fieldvaluecontrol_hash->{$self->value_field_id}->{values}->{$self->id};
$self->{restricted_legal_values}->{$controller_value} = [
grep { !exists $hash->{$_->id} || !%{$hash->{$_->id}} || $hash->{$_->id}->{$controller_value} }
@{$self->legal_values}
grep {
$_->name eq '---' || !exists $hash->{$_->id} ||
!%{$hash->{$_->id}} || $hash->{$_->id}->{$controller_value}
} @{$self->legal_values}
];
}
return $self->{restricted_legal_values}->{$controller_value};

View File

@ -185,14 +185,16 @@ if ($action eq 'edit') {
if ($action eq 'update') {
check_token_data($token, 'edit_field_value');
$vars->{'value_old'} = $value->name;
my $visibility_values;
if (!($value->is_static || $value->is_default)) {
$value->set_is_active($cgi->param('is_active'));
$value->set_name($cgi->param('value_new'));
$visibility_values = [ $cgi->param('visibility_value_id') ];
}
$value->set_name($cgi->param('value_new'));
$value->set_sortkey($cgi->param('sortkey'));
$vars->{'changes'} = $value->update();
my $ch = $value->set_visibility_values([ $cgi->param('visibility_value_id') ]);
$vars->{'changes'}->{'visibility_values'} = $ch if defined $ch;
my $ch = $value->set_visibility_values($visibility_values);
$vars->{'changes'}->{'visibility_values'} = $ch if $visibility_values && $ch;
delete_token($token);
$vars->{'message'} = 'field_value_updated';
display_field_values($vars);

View File

@ -682,7 +682,7 @@ foreach my $row (@$grouplist) {
'description' => $description
};
push @groups, $group;
push @groups, $group;
}
$vars->{'group'} = \@groups;
@ -697,5 +697,5 @@ my $format = $template->get_format("bug/create/create",
$cgi->send_header($format->{'ctype'});
$template->process($format->{'template'}, $vars)
|| ThrowTemplateError($template->error());
|| ThrowTemplateError($template->error());
exit;

View File

@ -56,7 +56,7 @@
<td>[% IF value.is_open %]Open[% ELSE %]Closed[% END %]</td>
</tr>
[% END %]
[% IF field.value_field %]
[% IF field.value_field && !value.is_static %]
<tr>
<th align="right">
Only appears when [%+ field.value_field.description FILTER html %] is set to:
@ -68,7 +68,6 @@
<tr>
<td></td><td>
<select name="visibility_value_id" id="visibility_value_id" multiple="multiple" size="15">
<option></option>
[% FOREACH field_value = field.value_field.legal_values %]
[% NEXT IF field_value.name == '' %]
<option value="[% field_value.id FILTER none %]" [% ' selected="selected"' IF value.has_visibility_value(field_value.id, 0) %]>