From ce2dca7ce56ff9806fa72d781c21e47fa750ef98 Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Thu, 12 Sep 2013 18:10:38 -0400 Subject: Bug 915830 - Tracking flags don't contain values --- extensions/TrackingFlags/Extension.pm | 19 +++++++++++++++++++ extensions/TrackingFlags/lib/Flag.pm | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/extensions/TrackingFlags/Extension.pm b/extensions/TrackingFlags/Extension.pm index b79faef61..0dc3248ac 100644 --- a/extensions/TrackingFlags/Extension.pm +++ b/extensions/TrackingFlags/Extension.pm @@ -546,4 +546,23 @@ sub mailer_before_send { } } +sub bug_check_can_change_field { + my ($self, $args) = @_; + my $field = $args->{'field'}; + my $old_value = $args->{'old_value'}; + my $new_value = $args->{'new_value'}; + my $priv_results = $args->{'priv_results'}; + + my $flag = Bugzilla::Extension::TrackingFlags::Flag->new( + { name => $field }); + $flag || return; + + # Used by show_bug to determine if field is visible so always allow + return if ($old_value == 0 && $new_value == 1); + + if (defined $new_value && !$flag->can_set_value($new_value)) { + push (@$priv_results, PRIVILEGES_REQUIRED_EMPOWERED); + } +} + __PACKAGE__->NAME; diff --git a/extensions/TrackingFlags/lib/Flag.pm b/extensions/TrackingFlags/lib/Flag.pm index f7eb674ee..aa3649643 100644 --- a/extensions/TrackingFlags/lib/Flag.pm +++ b/extensions/TrackingFlags/lib/Flag.pm @@ -429,7 +429,7 @@ sub type { return FIELD_TYPE_EXTENSION; } sub legal_values { return $_[0]->values; } sub custom { return 1; } sub in_new_bugmail { return 1; } -sub obsolete { return $_[0]->is_active ? 1 : 0; } +sub obsolete { return $_[0]->is_active ? 0 : 1; } sub buglist { return 1; } sub is_select { return 1; } sub is_abnormal { return 1; } -- cgit v1.2.3-24-g4f1b