From: lpsolit%gmail.com <> Date: Wed, 10 Jan 2007 00:16:54 +0000 (+0000) Subject: Bug 365444: Obsolete custom fields are shown in e-mail notifications for new bugs... X-Git-Tag: bugzilla-2.23.4~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed06de9de3117f8894872495e973ff812212ff91;p=thirdparty%2Fbugzilla.git Bug 365444: Obsolete custom fields are shown in e-mail notifications for new bugs, despite they shouldn't - Patch by Frédéric Buclin r=mkanat a=myk --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 841b6f14f8..43c430ac13 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1384,7 +1384,10 @@ sub update_comment { # Represents which fields from the bugs table are handled by process_bug.cgi. sub editable_bug_fields { my @fields = Bugzilla->dbh->bz_table_columns('bugs'); - foreach my $remove ("bug_id", "creation_ts", "delta_ts", "lastdiffed") { + # Obsolete custom fields are not editable. + my @obsolete_fields = Bugzilla->get_fields({obsolete => 1, custom => 1}); + @obsolete_fields = map { $_->name } @obsolete_fields; + foreach my $remove ("bug_id", "creation_ts", "delta_ts", "lastdiffed", @obsolete_fields) { my $location = lsearch(\@fields, $remove); splice(@fields, $location, 1); } diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index ca7e20b1e4..9b70da03e5 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -99,15 +99,14 @@ sub Send { my $msg = ""; my $dbh = Bugzilla->dbh; - - my $fields = $dbh->selectall_arrayref('SELECT name, description, mailhead - FROM fielddefs ORDER BY sortkey'); - - foreach my $fielddef (@$fields) { - my ($field, $description, $mailhead) = @$fielddef; - push(@headerlist, $field); - $defmailhead{$field} = $mailhead; - $fielddescription{$field} = $description; + + # XXX - These variables below are useless. We could use field object + # methods directly. But we first have to implement a cache in + # Bugzilla->get_fields to avoid querying the DB all the time. + foreach my $field (Bugzilla->get_fields({obsolete => 0})) { + push(@headerlist, $field->name); + $defmailhead{$field->name} = $field->in_new_bugmail; + $fielddescription{$field->name} = $field->description; } my %values = %{$dbh->selectrow_hashref(