diff options
author | mkanat%kerio.com <> | 2006-03-07 06:42:09 +0100 |
---|---|---|
committer | mkanat%kerio.com <> | 2006-03-07 06:42:09 +0100 |
commit | 93ed3ae8b3523b9e62597d1cc49de1f715648925 (patch) | |
tree | 691aa59ef033d8f23b920842558c68c52bae43f3 /Bugzilla | |
parent | eb411e0d6a8848ff925ca13f42a04da1a7591284 (diff) | |
download | bugzilla-93ed3ae8b3523b9e62597d1cc49de1f715648925.tar.gz bugzilla-93ed3ae8b3523b9e62597d1cc49de1f715648925.tar.xz |
Bug 282628: Move OpenStates and IsOpenedState out of globals.pl
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=wicked, a=myk
Diffstat (limited to 'Bugzilla')
-rwxr-xr-x | Bugzilla/Bug.pm | 11 | ||||
-rw-r--r-- | Bugzilla/BugMail.pm | 3 | ||||
-rw-r--r-- | Bugzilla/Constants.pm | 6 | ||||
-rw-r--r-- | Bugzilla/Search.pm | 5 | ||||
-rw-r--r-- | Bugzilla/Search/Quicksearch.pm | 6 | ||||
-rw-r--r-- | Bugzilla/Template.pm | 3 |
6 files changed, 26 insertions, 8 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f297ec681..43f5a1285 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -54,6 +54,7 @@ use base qw(Exporter); bug_alias_to_id ValidateBugAlias ValidateBugID RemoveVotes CheckIfVotedConfirmed LogActivityEntry + is_open_state ); ##################################################################### @@ -203,7 +204,7 @@ sub initBug { } $self->{'isunconfirmed'} = ($self->{bug_status} eq 'UNCONFIRMED'); - $self->{'isopened'} = &::IsOpenedState($self->{bug_status}); + $self->{'isopened'} = is_open_state($self->{bug_status}); return $self; } @@ -758,6 +759,12 @@ sub EmitDependList { 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) = @_; @@ -979,7 +986,7 @@ sub CountOpenDependencies { "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(); diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index e20fb5f61..2b76a211a 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -37,6 +37,7 @@ use Bugzilla::User; use Bugzilla::Constants; use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Util; +use Bugzilla::Bug; use Date::Parse; use Date::Format; @@ -309,7 +310,7 @@ sub ProcessOneBug { $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; } diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index afb621f78..0b612cbba 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -94,6 +94,8 @@ use base qw(Exporter); FIELD_TYPE_UNKNOWN FIELD_TYPE_FREETEXT + + BUG_STATE_OPEN ); @Bugzilla::Constants::EXPORT_OK = qw(contenttypes); @@ -256,4 +258,8 @@ use constant SENDMAIL_EXE => '/usr/lib/sendmail.exe'; 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; diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 9b6c5bca7..0914d69b0 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -41,6 +41,7 @@ use Bugzilla::Constants; use Bugzilla::Group; use Bugzilla::User; use Bugzilla::Field; +use Bugzilla::Bug; use Date::Format; use Date::Parse; @@ -186,11 +187,11 @@ sub init { $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)); } } diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm index 365e56469..4d9958c63 100644 --- a/Bugzilla/Search/Quicksearch.pm +++ b/Bugzilla/Search/Quicksearch.pm @@ -26,6 +26,8 @@ use strict; use Bugzilla; use Bugzilla::Config; use Bugzilla::Error; +use Bugzilla::Constants; +use Bugzilla::Bug; use base qw(Exporter); @Bugzilla::Search::Quicksearch::EXPORT = qw(quicksearch); @@ -153,12 +155,12 @@ sub 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') { diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 2a83a4bea..edfc037c6 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -40,6 +40,7 @@ use Bugzilla::Util; use Bugzilla::User; use Bugzilla::Error; use MIME::Base64; +use Bugzilla::Bug; # for time2str - replace by TT Date plugin?? use Date::Format (); @@ -415,7 +416,7 @@ sub get_bug_link { $pre = "<i>"; $post = "</i>"; } - elsif (! &::IsOpenedState($bug_state)) { + elsif (!is_open_state($bug_state)) { $pre = '<span class="bz_closed">'; $title .= " $bug_res"; $post = '</span>'; |