bug_alias_to_id ValidateBugAlias ValidateBugID
RemoveVotes CheckIfVotedConfirmed
LogActivityEntry
+ is_open_state
);
#####################################################################
}
$self->{'isunconfirmed'} = ($self->{bug_status} eq 'UNCONFIRMED');
- $self->{'isopened'} = &::IsOpenedState($self->{bug_status});
+ $self->{'isopened'} = is_open_state($self->{bug_status});
return $self;
}
return $list_ref;
}
+# Tells you whether or not the argument is a valid "open" state.
+sub is_open_state {
+ my ($state) = @_;
+ return (grep($_ eq $state, BUG_STATE_OPEN) ? 1 : 0);
+}
+
sub ValidateTime {
my ($time, $field) = @_;
"FROM bugs, dependencies " .
"WHERE blocked IN (" . (join "," , @bug_list) . ") " .
"AND bug_id = dependson " .
- "AND bug_status IN ('" . (join "','", &::OpenStates()) . "') " .
+ "AND bug_status IN ('" . (join "','", BUG_STATE_OPEN) . "') " .
$dbh->sql_group_by('blocked'));
$sth->execute();
use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Util;
+use Bugzilla::Bug;
use Date::Parse;
use Date::Format;
$interestingchange = 0;
}
$thisdiff .= FormatTriple($fielddescription{$what}, $old, $new);
- if ($what eq 'bug_status' && &::IsOpenedState($old) ne &::IsOpenedState($new)) {
+ if ($what eq 'bug_status' && is_open_state($old) ne is_open_state($new)) {
$interestingchange = 1;
}
FIELD_TYPE_UNKNOWN
FIELD_TYPE_FREETEXT
+
+ BUG_STATE_OPEN
);
@Bugzilla::Constants::EXPORT_OK = qw(contenttypes);
use constant FIELD_TYPE_UNKNOWN => 0;
use constant FIELD_TYPE_FREETEXT => 1;
+# States that are considered to be "open" for bugs.
+use constant BUG_STATE_OPEN => ('NEW', 'REOPENED', 'ASSIGNED',
+ 'UNCONFIRMED');
+
1;
use Bugzilla::Group;
use Bugzilla::User;
use Bugzilla::Field;
+use Bugzilla::Bug;
use Date::Format;
use Date::Parse;
$params->delete('bug_status');
}
elsif ($bug_statuses[0] eq '__open__') {
- $params->param('bug_status', map(&::IsOpenedState($_) ? $_ : undef,
+ $params->param('bug_status', map(is_open_state($_) ? $_ : undef,
@::legal_bug_status));
}
elsif ($bug_statuses[0] eq "__closed__") {
- $params->param('bug_status', map(&::IsOpenedState($_) ? undef : $_,
+ $params->param('bug_status', map(is_open_state($_) ? undef : $_,
@::legal_bug_status));
}
}
use Bugzilla;
use Bugzilla::Config;
use Bugzilla::Error;
+use Bugzilla::Constants;
+use Bugzilla::Bug;
use base qw(Exporter);
@Bugzilla::Search::Quicksearch::EXPORT = qw(quicksearch);
my @words = splitString($searchstring);
my $searchComments = $#words < Param('quicksearch_comment_cutoff');
- my @openStates = &::OpenStates();
+ my @openStates = BUG_STATE_OPEN;
my @closedStates;
my (%states, %resolutions);
foreach (@::legal_bug_status) {
- push(@closedStates, $_) unless &::IsOpenedState($_);
+ push(@closedStates, $_) unless is_open_state($_);
}
foreach (@openStates) { $states{$_} = 1 }
if ($words[0] eq 'ALL') {
use Bugzilla::User;
use Bugzilla::Error;
use MIME::Base64;
+use Bugzilla::Bug;
# for time2str - replace by TT Date plugin??
use Date::Format ();
$pre = "<i>";
$post = "</i>";
}
- elsif (! &::IsOpenedState($bug_state)) {
+ elsif (!is_open_state($bug_state)) {
$pre = '<span class="bz_closed">';
$title .= " $bug_res";
$post = '</span>';
$vars->{'columns'} = $columns;
$vars->{'displaycolumns'} = \@displaycolumns;
-my @openstates = OpenStates();
+my @openstates = BUG_STATE_OPEN;
$vars->{'openstates'} = \@openstates;
$vars->{'closedstates'} = ['CLOSED', 'VERIFIED', 'RESOLVED'];
require Bugzilla::User;
import Bugzilla::User qw(insert_new_user);
+require Bugzilla::Bug;
+import Bugzilla::Bug qw(is_open_state);
+
# globals.pl clears the PATH, but File::Find uses Cwd::cwd() instead of
# Cwd::getcwd(), which we need to do because `pwd` isn't in the path - see
# http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2001-09/msg00115.html
$data{$fields[$i]}{$numbers[0]} = $numbers[$i + 1];
# Keep a total of the number of open bugs for this day
- if (IsOpenedState($fields[$i])) {
+ if (is_open_state($fields[$i])) {
$data{$open_name}{$numbers[0]} += $numbers[$i + 1];
}
}
join("&", map { "bug_status=" . url_quote($_) }
('UNCONFIRMED', 'NEW', 'ASSIGNED', 'REOPENED'));
my $open_bugs_query_base_new =
- join("&", map { "bug_status=" . url_quote($_) } OpenStates());
+ join("&", map { "bug_status=" . url_quote($_) } BUG_STATE_OPEN);
my $sth_openbugs_series =
$dbh->prepare("SELECT series_id FROM series
WHERE query IN (?, ?)");
require "globals.pl";
use Bugzilla;
use Bugzilla::Constants;
+use Bugzilla::Bug;
# Suppress "used only once" warnings.
use vars
my @open_status;
my @closed_status;
foreach my $status (@::legal_bug_status) {
- IsOpenedState($status) ? push(@open_status, $status)
+ is_open_state($status) ? push(@open_status, $status)
: push(@closed_status, $status);
}
$vars->{'open_status'} = \@open_status;
# For localisation reasons, we get the name of the "global" subcategory
# and the title of the "open" query from the submitted form.
- my @openedstatuses = OpenStates();
+ my @openedstatuses = BUG_STATE_OPEN;
my $query =
join("&", map { "bug_status=" . url_quote($_) } @openedstatuses);
push(@series, [$open_name, $query]);
return $name;
}
-# Determines if the given bug_status string represents an "Opened" bug. This
-# routine ought to be parameterizable somehow, as people tend to introduce
-# new states into Bugzilla.
-
-sub IsOpenedState {
- my ($state) = (@_);
- if (grep($_ eq $state, OpenStates())) {
- return 1;
- }
- return 0;
-}
-
-# This sub will return an array containing any status that
-# is considered an open bug.
-
-sub OpenStates {
- return ('NEW', 'REOPENED', 'ASSIGNED', 'UNCONFIRMED');
-}
-
############# Live code below here (that is, not subroutine defs) #############
use Bugzilla;
my $valid_status = check_field('bug_status',
scalar $bug_fields{'bug_status'},
\@::legal_bug_status, ERR_LEVEL );
- my $is_open = IsOpenedState($bug_fields{'bug_status'});
+ my $is_open = is_open_state($bug_fields{'bug_status'});
my $status = $bug_fields{'bug_status'} || undef;
my $resolution = $bug_fields{'resolution'} || undef;
if ($field eq "canconfirm"
|| ($field eq "bug_status"
&& $oldvalue eq 'UNCONFIRMED'
- && IsOpenedState($newvalue)))
+ && is_open_state($newvalue)))
{
$PrivilegesRequired = 3;
return $UserInCanConfirmGroupSet;
# confirmed or not
$::query .= "bug_status = CASE WHEN everconfirmed = 1 THEN " .
SqlQuote($str) . " ELSE 'UNCONFIRMED' END";
- } elsif (IsOpenedState($str)) {
+ } elsif (is_open_state($str)) {
# Note that we cannot combine this with the above branch - here we
# need to check if bugs.bug_status is open, (since we don't want to
# reopen closed bugs when reassigning), while above the whole point
# This also relies on the fact that confirming and accepting have
# already called DoConfirm before this is called
- my @open_state = map(SqlQuote($_), OpenStates());
+ my @open_state = map(SqlQuote($_), BUG_STATE_OPEN);
my $open_state = join(", ", @open_state);
# If we are changing everconfirmed to 1, we have to take this change
}
if ($col eq 'bug_status'
- && IsOpenedState($old) ne IsOpenedState($new))
+ && is_open_state($old) ne is_open_state($new))
{
$check_dep_bugs = 1;
}
Status("Checking statuses/resolutions");
-my @open_states = map(SqlQuote($_), OpenStates());
+my @open_states = map(SqlQuote($_), BUG_STATE_OPEN);
my $open_states = join(', ', @open_states);
BugCheck("bugs WHERE bug_status IN ($open_states) AND resolution != ''",
push(@params, "shape=box");
}
- if (IsOpenedState($stat)) {
+ if (is_open_state($stat)) {
push(@params, "color=green");
}
WHERE bugs.bug_id = ?", undef, $id);
}
- $bug->{'open'} = $bug->{'exists'} && IsOpenedState($bug->{'status'});
+ $bug->{'open'} = $bug->{'exists'} && is_open_state($bug->{'status'});
$bug->{'dependencies'} = [];
return $bug;
push (@bugs, { id => $id,
summary => $summary,
count => $count,
- opened => IsOpenedState($status) });
+ opened => is_open_state($status) });
}
# In case we didn't populate this earlier (i.e. an error, or