]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 387672: Move BUG_STATE_OPEN and is_open_state() into Status.pm - Patch by FrÃ...
authorlpsolit%gmail.com <>
Tue, 9 Oct 2007 15:34:41 +0000 (15:34 +0000)
committerlpsolit%gmail.com <>
Tue, 9 Oct 2007 15:34:41 +0000 (15:34 +0000)
15 files changed:
Bugzilla/Bug.pm
Bugzilla/BugMail.pm
Bugzilla/Config/BugChange.pm
Bugzilla/Config/Common.pm
Bugzilla/Search.pm
Bugzilla/Search/Quicksearch.pm
Bugzilla/Status.pm
Bugzilla/Template.pm
buglist.cgi
config.cgi
editproducts.cgi
process_bug.cgi
reports.cgi
sanitycheck.cgi
showdependencygraph.cgi

index e1b4a6e55e6f1fea2c326d4a40b4246637550a8a..c394ea8a81d48bba5daaa0755e2f15cc61e37ed2 100755 (executable)
@@ -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) = @_;
 
index d29ffaf1e18980b06c3425e3dbcfc305ce34bb7e..e771a98769291449e4d56525647af9aa1e31db9f 100644 (file)
@@ -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;
             }
index 65b2aec964f3bd7fe752796c1df2f5602b03282c..aec6e2428a37e69befe3c715415dfc555df215dc 100644 (file)
@@ -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);
   };
index 2e5e7d15d4d5a72fbf97af31e7183ae176ebaa60..03e97d6a19ab59e5add5d7934ea509d6462894e2 100644 (file)
@@ -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);
     }
index 33ccc9d9e5f1effebe45fbbaba87cc32c28ddc87..bb6d9af3444721cf51d20ddc4c0ddb572bf848d8 100644 (file)
@@ -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;
index 884479e50a896e588051d51ff465af7531f67324..b9bd4a6ae57e777d0b7b7ea31f6c3ef6bf7bc2f6 100644 (file)
@@ -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;
 
index 9af0f043cbb714638ff5746c1aa9888b8d60b10f..65baf04b8a815deab3f3b06d2e050dd0be9b50a0 100644 (file)
@@ -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);
 
index d8e23c939843271837e519fb5d509664af8d32a4..0f08662e0c9f7d456423166fe3e6bd24823a2fc4 100644 (file)
@@ -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;
index 73649f7852a6ebb036ff819e58b66f8eef758d87..71b6fd14f463caa461daa719f40bf1b2cc906f0f 100755 (executable)
@@ -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
index 29d1cb8cb57b51eb5c4f36e7e79907985da523f7..84bcb9038e7c3408b14f0fa89f382a50074a19a6 100755 (executable)
@@ -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);
index 9be85ded9f0cb82828f5b1ec4530a5a3552d4d0b..c3b29747c89305434be9e74e7d80223ba172cf7e 100755 (executable)
@@ -48,6 +48,7 @@ use Bugzilla::Group;
 use Bugzilla::User;
 use Bugzilla::Field;
 use Bugzilla::Token;
+use Bugzilla::Status;
 
 #
 # Preliminary checks:
index 0d76a5c7010356ae164684d7e746db2580eb1760..3e1246e755e519d9fb75ddc55cc580564270f46c 100755 (executable)
@@ -58,6 +58,7 @@ use Bugzilla::Product;
 use Bugzilla::Component;
 use Bugzilla::Keyword;
 use Bugzilla::Flag;
+use Bugzilla::Status;
 
 use Storable qw(dclone);
 
index 065e6d73a1bd2c26154ae520ae17b7ebb44b428c..7ed396935f1bad5ca83f638aac388e047381c187 100755 (executable)
@@ -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");
index ef92256a20cb72d79c1e0810a2a04a9183e7141b..3d718a0dc84bdef7a9675c4a6ccf763177a04f4c 100755 (executable)
@@ -32,7 +32,7 @@ use Bugzilla;
 use Bugzilla::Constants;
 use Bugzilla::Util;
 use Bugzilla::Error;
-use Bugzilla::Bug;
+use Bugzilla::Status;
 
 ###########################################################################
 # General subs
index c4d371f45b5aacf35300e253b8c67375ab8923a4..30d7ebac1c6b81ac43608bcdd0348995979832d5 100755 (executable)
@@ -32,6 +32,7 @@ use Bugzilla::Constants;
 use Bugzilla::Util;
 use Bugzilla::Error;
 use Bugzilla::Bug;
+use Bugzilla::Status;
 
 Bugzilla->login();