From: lpsolit%gmail.com <> Date: Fri, 25 Aug 2006 04:49:38 +0000 (+0000) Subject: Bug 345958: Do not throw an error if an inactive flag type is set to "X" while editin... X-Git-Tag: bugzilla-2.22.1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35e816d6ed6344439516d8a5a9aa3c56a4609ff0;p=thirdparty%2Fbugzilla.git Bug 345958: Do not throw an error if an inactive flag type is set to "X" while editing a bug - Patch by Frédéric Buclin r/a=myk --- diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm index 8b2202147c..6a525fd0e1 100644 --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -344,15 +344,6 @@ sub validate { # this bug/attachment. This check will be done later when # processing new flags, see Flag::FormToNewFlags(). - # All flag types have to be active - my $inactive_flagtypes = - $dbh->selectrow_array("SELECT 1 FROM flagtypes - WHERE id IN (" . join(',', @ids) . ") - AND is_active = 0 " . - $dbh->sql_limit(1)); - - ThrowCodeError("flag_type_inactive") if $inactive_flagtypes; - foreach my $id (@ids) { my $status = $cgi->param("flag_type-$id"); my @requestees = $cgi->param("requestee_type-$id"); @@ -365,6 +356,10 @@ sub validate { $flag_type || ThrowCodeError("flag_type_nonexistent", { id => $id }); + # Make sure the flag type is active. + $flag_type->{'is_active'} + || ThrowCodeError('flag_type_inactive', {'type' => $flag_type->{'name'}}); + # Make sure the value of the field is a valid status. grep($status eq $_, qw(X + - ?)) || ThrowCodeError("flag_status_invalid", diff --git a/template/en/default/global/code-error.html.tmpl b/template/en/default/global/code-error.html.tmpl index 4b2cc73276..d2b496ca20 100644 --- a/template/en/default/global/code-error.html.tmpl +++ b/template/en/default/global/code-error.html.tmpl @@ -210,8 +210,9 @@ a positive integer. [% ELSIF error == "flag_type_inactive" %] - [% title = "Inactive Flag Types" %] - Some flag types are inactive and cannot be used to create new flags. + [% title = "Inactive Flag Type" %] + The flag type [% type FILTER html %] is inactive and cannot be used + to create new flags. [% ELSIF error == "flag_type_nonexistent" %] There is no flag type with the ID [% id FILTER html %].