RemoveVotes CheckIfVotedConfirmed
LogActivityEntry
is_open_state
+ editable_bug_fields
);
#####################################################################
$dbh->do("UPDATE bugs SET delta_ts = ? WHERE bug_id = ?",
undef, $timestamp, $bugid);
}
+
+# 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") {
+ my $location = lsearch(\@fields, $remove);
+ splice(@fields, $location, 1);
+ }
+ # Sorted because the old @::log_columns variable, which this replaces,
+ # was sorted.
+ return sort(@fields);
+}
+
# This method is private and is not to be used outside of the Bug class.
sub EmitDependList {
my ($myfield, $targetfield, $bug_id) = (@_);
}
my %values = %{$dbh->selectrow_hashref(
- 'SELECT ' . join(',', @::log_columns) . ',
+ 'SELECT ' . join(',', editable_bug_fields()) . ',
lastdiffed AS start, LOCALTIMESTAMP(0) AS end
FROM bugs WHERE bug_id = ?',
undef, $id)};
</warning>
<para>
- For a list of possible field names, look in
- <filename>data/versioncache</filename> for the list called
- <filename>@::log_columns</filename>. If you need help writing custom
- rules for your organization, ask in the newsgroup.
+ For a list of possible field names, look at the bugs table in the
+ database. If you need help writing custom rules for your organization,
+ ask in the newsgroup.
</para>
</section>
sub GenerateVersionTable {
my $dbh = Bugzilla->dbh;
- @::log_columns = $dbh->bz_table_columns('bugs');
-
- foreach my $i ("bug_id", "creation_ts", "delta_ts", "lastdiffed") {
- my $w = lsearch(\@::log_columns, $i);
- if ($w >= 0) {
- splice(@::log_columns, $w, 1);
- }
- }
- @::log_columns = (sort(@::log_columns));
-
@::legal_priority = get_legal_field_values("priority");
@::legal_severity = get_legal_field_values("bug_severity");
@::legal_platform = get_legal_field_values("rep_platform");
print $fh "#\n";
require Data::Dumper;
- print $fh (Data::Dumper->Dump([\@::log_columns],
- ['*::log_columns']));
print $fh (Data::Dumper->Dump([\@::legal_priority, \@::legal_severity,
\@::legal_platform, \@::legal_opsys,
my $vars = {};
$vars->{'use_keywords'} = 1 if Bugzilla::Keyword::keyword_count();
+my @editable_bug_fields = editable_bug_fields();
+
my $requiremilestone = 0;
######################################################################
sub SnapShotBug {
my ($id) = (@_);
my @row = $dbh->selectrow_array(q{SELECT delta_ts, } .
- join(',', @::log_columns).q{ FROM bugs WHERE bug_id = ?},
+ join(',', @editable_bug_fields).q{ FROM bugs WHERE bug_id = ?},
undef, $id);
$delta_ts = shift @row;
my @oldvalues = SnapShotBug($id);
my %oldhash;
my %formhash;
- foreach my $col (@::log_columns) {
+ foreach my $col (@editable_bug_fields) {
# Consider NULL db entries to be equivalent to the empty string
$oldvalues[$i] = defined($oldvalues[$i]) ? $oldvalues[$i] : '';
# Convert the deadline taken from the DB into the YYYY-MM-DD format
$formhash{'bug_status'} = $oldhash{'bug_status'};
}
}
- foreach my $col (@::log_columns) {
+ foreach my $col (@editable_bug_fields) {
# The 'resolution' field is checked by ChangeResolution(),
# i.e. only if we effectively use it.
next if ($col eq 'resolution');
my @newvalues = SnapShotBug($id);
my %newhash;
$i = 0;
- foreach my $col (@::log_columns) {
+ foreach my $col (@editable_bug_fields) {
# Consider NULL db entries to be equivalent to the empty string
$newvalues[$i] = defined($newvalues[$i]) ? $newvalues[$i] : '';
# Convert the deadline to the YYYY-MM-DD format.
# $msgs will store emails which have to be sent to voters, if any.
my $msgs;
- foreach my $c (@::log_columns) {
+ foreach my $c (@editable_bug_fields) {
my $col = $c; # We modify it, don't want to modify array
# values in place.
my $old = shift @oldvalues;
require "globals.pl";
+use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Search;
use Bugzilla::User;
@legal_platform
@legal_priority
@legal_severity
- @log_columns
);
my $cgi = Bugzilla->cgi;
# This is what happens when you have variables whose definition depends
# on the DB schema, and then the underlying schema changes...
-foreach my $val (@::log_columns) {
+foreach my $val (editable_bug_fields()) {
if ($val eq 'classification_id') {
$val = 'classification';
} elsif ($val eq 'product_id') {