From 29f8d4e84480f464fea816d5d7c50f3de1471013 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Thu, 24 Aug 2006 21:41:20 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20345958:=20Do=20not=20throw=20an=20error?= =?UTF-8?q?=20if=20an=20inactive=20flag=20type=20is=20set=20to=20"X"=20whi?= =?UTF-8?q?le=20editing=20a=20bug=20-=20Patch=20by=20Fr=EF=BF=BDd=EF=BF=BD?= =?UTF-8?q?ric=20Buclin=20=20a=3Dmyk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webtools/bugzilla/Bugzilla/Flag.pm | 16 +++++----------- .../en/default/global/code-error.html.tmpl | 5 +++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/webtools/bugzilla/Bugzilla/Flag.pm b/webtools/bugzilla/Bugzilla/Flag.pm index 7888640f9617..de90170a3225 100644 --- a/webtools/bugzilla/Bugzilla/Flag.pm +++ b/webtools/bugzilla/Bugzilla/Flag.pm @@ -264,17 +264,6 @@ sub validate { # because the bug may be moved into another product meanwhile. # This check will be done later when creating new flags, see FormToNewFlags(). - # All new flags must belong to active flag types. - if (scalar(@flagtype_ids)) { - my $inactive_flagtypes = - $dbh->selectrow_array('SELECT 1 FROM flagtypes - WHERE id IN (' . join(',', @flagtype_ids) . ') - AND is_active = 0 ' . - $dbh->sql_limit(1)); - - ThrowCodeError('flag_type_inactive') if $inactive_flagtypes; - } - if (scalar(@flag_ids)) { # No reference to existing flags should exist when creating a new # attachment. @@ -315,6 +304,11 @@ sub validate { my $flag_type = new Bugzilla::FlagType($id); $flag_type || ThrowCodeError('flag_type_nonexistent', { id => $id }); + # Make sure the flag type is active. + unless ($flag_type->is_active) { + ThrowCodeError('flag_type_inactive', {'type' => $flag_type->name}); + } + _validate(undef, $flag_type, $status, \@requestees, $private_attachment, $bug_id, $attach_id); } diff --git a/webtools/bugzilla/template/en/default/global/code-error.html.tmpl b/webtools/bugzilla/template/en/default/global/code-error.html.tmpl index 0a9bcc867853..d5c5766b0974 100644 --- a/webtools/bugzilla/template/en/default/global/code-error.html.tmpl +++ b/webtools/bugzilla/template/en/default/global/code-error.html.tmpl @@ -223,8 +223,9 @@ is invalid. [% 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 %].