Add specific UI for enabling/disabling empty versions and milestones
parent
211a0dfa26
commit
4f519ad5b6
|
@ -1021,18 +1021,25 @@ sub update_visibility_values
|
|||
}
|
||||
my $del = [ keys %$h ];
|
||||
return 0 if !@$add && !@$del;
|
||||
if (@$del)
|
||||
{
|
||||
Bugzilla->dbh->do(
|
||||
"DELETE FROM fieldvaluecontrol WHERE field_id=? AND value_id=?".
|
||||
" AND visibility_value_id IN (".join(", ", @$del).")",
|
||||
undef, $self->id, $controlled_value_id
|
||||
);
|
||||
}
|
||||
$self->delete_visibility_values($controlled_value_id, $del, 1);
|
||||
$self->add_visibility_values($controlled_value_id, $add);
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub delete_visibility_values
|
||||
{
|
||||
my $self = shift;
|
||||
my ($controlled_value_id, $visibility_value_ids, $dont_touch) = @_;
|
||||
return 0 if !@$visibility_value_ids;
|
||||
my $ok = Bugzilla->dbh->do(
|
||||
"DELETE FROM fieldvaluecontrol WHERE field_id=? AND value_id=?".
|
||||
" AND visibility_value_id IN (".join(", ", map { int($_) } @$visibility_value_ids).")",
|
||||
undef, $self->id, $controlled_value_id
|
||||
);
|
||||
$self->touch if !$dont_touch;
|
||||
return $ok;
|
||||
}
|
||||
|
||||
sub add_visibility_values
|
||||
{
|
||||
my $self = shift;
|
||||
|
|
|
@ -87,6 +87,17 @@ unless ($action)
|
|||
exit;
|
||||
}
|
||||
|
||||
#
|
||||
# action='change_empty' -> Enable/disable empty milestone
|
||||
#
|
||||
if ($action eq 'change_empty' && Bugzilla->get_field('target_milestone')->null_field_id == Bugzilla->get_field('product')->id)
|
||||
{
|
||||
my $f = ($ARGS->{allow_empty} ? 'add' : 'delete').'_visibility_values';
|
||||
Bugzilla->get_field('target_milestone')->$f(FLAG_NULLABLE, [ $product->id ]);
|
||||
print Bugzilla->cgi->redirect('editmilestones.cgi?product='.url_quote($product->name));
|
||||
exit;
|
||||
}
|
||||
|
||||
#
|
||||
# action='add' -> present form for parameters for new milestone
|
||||
#
|
||||
|
|
|
@ -88,6 +88,17 @@ unless ($action)
|
|||
exit;
|
||||
}
|
||||
|
||||
#
|
||||
# action='change_empty' -> Enable/disable empty version
|
||||
#
|
||||
if ($action eq 'change_empty' && Bugzilla->get_field('version')->null_field_id == Bugzilla->get_field('product')->id)
|
||||
{
|
||||
my $f = ($ARGS->{allow_empty} ? 'add' : 'delete').'_visibility_values';
|
||||
Bugzilla->get_field('version')->$f(FLAG_NULLABLE, [ $product->id ]);
|
||||
print Bugzilla->cgi->redirect('editversions.cgi?product='.url_quote($product->name));
|
||||
exit;
|
||||
}
|
||||
|
||||
#
|
||||
# action='add' -> present form for parameters for new version
|
||||
#
|
||||
|
|
|
@ -77,6 +77,21 @@
|
|||
})
|
||||
%]
|
||||
|
||||
[% vf = Bugzilla.get_field('target_milestone') %]
|
||||
[% IF vf.null_field.name == 'product' %]
|
||||
<p>
|
||||
[% IF !vf.nullable %]
|
||||
Empty milestone (---) <a href="editfields.cgi?action=edit&field=target_milestone">disabled globally</a>.
|
||||
[% ELSE %]
|
||||
<form action="?action=change_empty&product=[% product.name | url_quote %]" method="POST">
|
||||
Empty milestone (---) is [% vf.null_visibility_values.${product.id} ? 'enabled' : 'disabled' %] in this product.
|
||||
<input type="hidden" name="allow_empty" value="[% vf.null_visibility_values.${product.id} ? 0 : 1 %]" />
|
||||
<input type="submit" value="[% vf.null_visibility_values.${product.id} ? 'Disable' : 'Enable' %] empty milestone" />
|
||||
</form>
|
||||
[% END %]
|
||||
</p>
|
||||
[% END %]
|
||||
|
||||
[% Hook.process('before_table') %]
|
||||
|
||||
[% PROCESS admin/table.html.tmpl
|
||||
|
|
|
@ -71,6 +71,21 @@
|
|||
})
|
||||
%]
|
||||
|
||||
[% vf = Bugzilla.get_field('version') %]
|
||||
[% IF vf.null_field.name == 'product' %]
|
||||
<p>
|
||||
[% IF !vf.nullable %]
|
||||
Empty version (---) <a href="editfields.cgi?action=edit&field=version">disabled globally</a>.
|
||||
[% ELSE %]
|
||||
<form action="?action=change_empty&product=[% product.name | url_quote %]" method="POST">
|
||||
Empty version (---) is [% vf.null_visibility_values.${product.id} ? 'enabled' : 'disabled' %] in this product.
|
||||
<input type="hidden" name="allow_empty" value="[% vf.null_visibility_values.${product.id} ? 0 : 1 %]" />
|
||||
<input type="submit" value="[% vf.null_visibility_values.${product.id} ? 'Disable' : 'Enable' %] empty version" />
|
||||
</form>
|
||||
[% END %]
|
||||
</p>
|
||||
[% END %]
|
||||
|
||||
[% Hook.process('before_table') %]
|
||||
|
||||
[% PROCESS admin/table.html.tmpl
|
||||
|
|
Loading…
Reference in New Issue