summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-10-09 17:34:41 +0200
committerlpsolit%gmail.com <>2007-10-09 17:34:41 +0200
commit1b8e4cadbdab2e8a335c9f1186a301e493a9a8b3 (patch)
treefa2b295246b059f0a3524c74972566c14b59ce1f
parent73553366455cb23a6df1847d67bde74386c87742 (diff)
downloadbugzilla-1b8e4cadbdab2e8a335c9f1186a301e493a9a8b3.tar.gz
bugzilla-1b8e4cadbdab2e8a335c9f1186a301e493a9a8b3.tar.xz
Bug 387672: Move BUG_STATE_OPEN and is_open_state() into Status.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
-rwxr-xr-xBugzilla/Bug.pm13
-rw-r--r--Bugzilla/BugMail.pm3
-rw-r--r--Bugzilla/Config/BugChange.pm2
-rw-r--r--Bugzilla/Config/Common.pm2
-rw-r--r--Bugzilla/Search.pm2
-rw-r--r--Bugzilla/Search/Quicksearch.pm2
-rw-r--r--Bugzilla/Status.pm17
-rw-r--r--Bugzilla/Template.pm4
-rwxr-xr-xbuglist.cgi3
-rwxr-xr-xconfig.cgi2
-rwxr-xr-xeditproducts.cgi1
-rwxr-xr-xprocess_bug.cgi1
-rwxr-xr-xreports.cgi2
-rwxr-xr-xsanitycheck.cgi2
-rwxr-xr-xshowdependencygraph.cgi1
15 files changed, 31 insertions, 26 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index e1b4a6e55..c394ea8a8 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -53,7 +53,6 @@ use base qw(Bugzilla::Object Exporter);
bug_alias_to_id ValidateBugID
RemoveVotes CheckIfVotedConfirmed
LogActivityEntry
- BUG_STATE_OPEN is_open_state
editable_bug_fields
SPECIAL_STATUS_WORKFLOW_ACTIONS
);
@@ -223,12 +222,6 @@ use constant SPECIAL_STATUS_WORKFLOW_ACTIONS => qw(
clearresolution
);
-sub BUG_STATE_OPEN {
- # XXX - We should cache this list.
- my $dbh = Bugzilla->dbh;
- return @{$dbh->selectcol_arrayref('SELECT value FROM bug_status WHERE is_open = 1')};
-}
-
#####################################################################
sub new {
@@ -2428,12 +2421,6 @@ 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) = @_;
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index d29ffaf1e..e771a9876 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -40,6 +40,7 @@ use Bugzilla::Bug;
use Bugzilla::Classification;
use Bugzilla::Product;
use Bugzilla::Component;
+use Bugzilla::Status;
use Bugzilla::Mailer;
use Date::Parse;
@@ -308,7 +309,7 @@ sub Send {
}
$thisdiff .= FormatTriple($fielddescription{$what}, $old, $new);
if ($what eq 'bug_status'
- && Bugzilla::Bug::is_open_state($old) ne Bugzilla::Bug::is_open_state($new))
+ && is_open_state($old) ne is_open_state($new))
{
$interestingchange = 1;
}
diff --git a/Bugzilla/Config/BugChange.pm b/Bugzilla/Config/BugChange.pm
index 65b2aec96..aec6e2428 100644
--- a/Bugzilla/Config/BugChange.pm
+++ b/Bugzilla/Config/BugChange.pm
@@ -48,7 +48,7 @@ sub get_param_list {
# and bug_status.is_open is not yet defined (hence the eval), so we use
# the bug statuses above as they are still hardcoded.
eval {
- my @current_closed_states = map {$_->name} Bugzilla::Status::closed_bug_statuses();
+ my @current_closed_states = map {$_->name} closed_bug_statuses();
# If no closed state was found, use the default list above.
@closed_bug_statuses = @current_closed_states if scalar(@current_closed_states);
};
diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm
index 2e5e7d15d..03e97d6a1 100644
--- a/Bugzilla/Config/Common.pm
+++ b/Bugzilla/Config/Common.pm
@@ -170,7 +170,7 @@ sub check_opsys {
sub check_bug_status {
my $bug_status = shift;
- my @closed_bug_statuses = map {$_->name} Bugzilla::Status::closed_bug_statuses();
+ my @closed_bug_statuses = map {$_->name} closed_bug_statuses();
if (lsearch(\@closed_bug_statuses, $bug_status) < 0) {
return "Must be a valid closed status: one of " . join(', ', @closed_bug_statuses);
}
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 33ccc9d9e..bb6d9af34 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -40,7 +40,7 @@ use Bugzilla::Constants;
use Bugzilla::Group;
use Bugzilla::User;
use Bugzilla::Field;
-use Bugzilla::Bug;
+use Bugzilla::Status;
use Bugzilla::Keyword;
use Date::Format;
diff --git a/Bugzilla/Search/Quicksearch.pm b/Bugzilla/Search/Quicksearch.pm
index 884479e50..b9bd4a6ae 100644
--- a/Bugzilla/Search/Quicksearch.pm
+++ b/Bugzilla/Search/Quicksearch.pm
@@ -26,7 +26,7 @@ use strict;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Keyword;
-use Bugzilla::Bug;
+use Bugzilla::Status;
use Bugzilla::Field;
use Bugzilla::Util;
diff --git a/Bugzilla/Status.pm b/Bugzilla/Status.pm
index 9af0f043c..65baf04b8 100644
--- a/Bugzilla/Status.pm
+++ b/Bugzilla/Status.pm
@@ -22,7 +22,8 @@ use strict;
package Bugzilla::Status;
-use base qw(Bugzilla::Object);
+use base qw(Bugzilla::Object Exporter);
+@Bugzilla::Status::EXPORT = qw(BUG_STATE_OPEN is_open_state closed_bug_statuses);
################################
##### Initialization #####
@@ -54,6 +55,18 @@ sub is_open { return $_[0]->{'is_open'}; }
##### Methods ####
###############################
+sub BUG_STATE_OPEN {
+ # XXX - We should cache this list.
+ my $dbh = Bugzilla->dbh;
+ return @{$dbh->selectcol_arrayref('SELECT value FROM bug_status WHERE is_open = 1')};
+}
+
+# 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 closed_bug_statuses {
my @bug_statuses = Bugzilla::Status->get_all;
@bug_statuses = grep { !$_->is_open } @bug_statuses;
@@ -154,7 +167,7 @@ Bugzilla::Status - Bug status class.
my $bug_status = new Bugzilla::Status({name => 'ASSIGNED'});
my $bug_status = new Bugzilla::Status(4);
- my @closed_bug_statuses = Bugzilla::Status::closed_bug_statuses();
+ my @closed_bug_statuses = closed_bug_statuses();
Bugzilla::Status::add_missing_bug_status_transitions($bug_status);
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index d8e23c939..0f08662e0 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -40,9 +40,9 @@ use Bugzilla::Install::Util qw(template_include_path);
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Error;
-use MIME::Base64;
-use Bugzilla::Bug;
+use Bugzilla::Status;
+use MIME::Base64;
# for time2str - replace by TT Date plugin??
use Date::Format ();
use File::Find;
diff --git a/buglist.cgi b/buglist.cgi
index 73649f785..71b6fd14f 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -46,6 +46,7 @@ use Bugzilla::Bug;
use Bugzilla::Product;
use Bugzilla::Keyword;
use Bugzilla::Field;
+use Bugzilla::Status;
use Date::Parse;
@@ -1111,7 +1112,7 @@ $vars->{'columns'} = $columns;
$vars->{'displaycolumns'} = \@displaycolumns;
$vars->{'openstates'} = [BUG_STATE_OPEN];
-$vars->{'closedstates'} = [map {$_->name} Bugzilla::Status::closed_bug_statuses()];
+$vars->{'closedstates'} = [map {$_->name} closed_bug_statuses()];
# The list of query fields in URL query string format, used when creating
# URLs to the same query results page with different parameters (such as
diff --git a/config.cgi b/config.cgi
index 29d1cb8cb..84bcb9038 100755
--- a/config.cgi
+++ b/config.cgi
@@ -34,7 +34,7 @@ use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Keyword;
-use Bugzilla::Bug;
+use Bugzilla::Status;
use Bugzilla::Field;
my $user = Bugzilla->login(LOGIN_OPTIONAL);
diff --git a/editproducts.cgi b/editproducts.cgi
index 9be85ded9..c3b29747c 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -48,6 +48,7 @@ use Bugzilla::Group;
use Bugzilla::User;
use Bugzilla::Field;
use Bugzilla::Token;
+use Bugzilla::Status;
#
# Preliminary checks:
diff --git a/process_bug.cgi b/process_bug.cgi
index 0d76a5c70..3e1246e75 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -58,6 +58,7 @@ use Bugzilla::Product;
use Bugzilla::Component;
use Bugzilla::Keyword;
use Bugzilla::Flag;
+use Bugzilla::Status;
use Storable qw(dclone);
diff --git a/reports.cgi b/reports.cgi
index 065e6d73a..7ed396935 100755
--- a/reports.cgi
+++ b/reports.cgi
@@ -43,7 +43,7 @@ use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Util;
use Bugzilla::Error;
-use Bugzilla::Bug;
+use Bugzilla::Status;
eval "use GD";
$@ && ThrowCodeError("gd_not_installed");
diff --git a/sanitycheck.cgi b/sanitycheck.cgi
index ef92256a2..3d718a0dc 100755
--- a/sanitycheck.cgi
+++ b/sanitycheck.cgi
@@ -32,7 +32,7 @@ use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Util;
use Bugzilla::Error;
-use Bugzilla::Bug;
+use Bugzilla::Status;
###########################################################################
# General subs
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index c4d371f45..30d7ebac1 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -32,6 +32,7 @@ use Bugzilla::Constants;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Bug;
+use Bugzilla::Status;
Bugzilla->login();