Commit c0df3599 authored by travis%sedsystems.ca's avatar travis%sedsystems.ca

Bug 276838 : Eliminate use of $::unconfirmedstate

Patch by Max Kanat-Alexander <mkanat@kerio.com> r=wurblzap a=justdave
parent d286752d
...@@ -28,7 +28,7 @@ package Bugzilla::Bug; ...@@ -28,7 +28,7 @@ package Bugzilla::Bug;
use strict; use strict;
use Bugzilla::RelationSet; use Bugzilla::RelationSet;
use vars qw($unconfirmedstate $legal_keywords @legal_platform use vars qw($legal_keywords @legal_platform
@legal_priority @legal_severity @legal_opsys @legal_bugs_status @legal_priority @legal_severity @legal_opsys @legal_bugs_status
@settable_resolution %components %versions %target_milestone @settable_resolution %components %versions %target_milestone
@enterable_products %milestoneurl %prodmaxvotes); @enterable_products %milestoneurl %prodmaxvotes);
...@@ -258,7 +258,7 @@ sub initBug { ...@@ -258,7 +258,7 @@ sub initBug {
$self->{'milestoneurl'} = $::milestoneurl{$self->{product}}; $self->{'milestoneurl'} = $::milestoneurl{$self->{product}};
$self->{'isunconfirmed'} = ($self->{bug_status} eq $::unconfirmedstate); $self->{'isunconfirmed'} = ($self->{bug_status} eq 'UNCONFIRMED');
$self->{'isopened'} = &::IsOpenedState($self->{bug_status}); $self->{'isopened'} = &::IsOpenedState($self->{bug_status});
my @depends = EmitDependList("blocked", "dependson", $bug_id); my @depends = EmitDependList("blocked", "dependson", $bug_id);
......
...@@ -512,7 +512,7 @@ sub getEmailAttributes (\%\@$) { ...@@ -512,7 +512,7 @@ sub getEmailAttributes (\%\@$) {
my (@flags,@uniqueFlags,%alreadySeen) = (); my (@flags,@uniqueFlags,%alreadySeen) = ();
# Add a flag if the status of the bug is "unconfirmed". # Add a flag if the status of the bug is "unconfirmed".
if ($bug->{'bug_status'} eq $::unconfirmedstate) { if ($bug->{'bug_status'} eq 'UNCONFIRMED') {
push (@flags, 'Unconfirmed') push (@flags, 'Unconfirmed')
}; };
......
...@@ -251,13 +251,13 @@ sub CheckIfVotedConfirmed { ...@@ -251,13 +251,13 @@ sub CheckIfVotedConfirmed {
"WHERE bugs.bug_id = $id AND products.id = bugs.product_id"); "WHERE bugs.bug_id = $id AND products.id = bugs.product_id");
my ($votes, $status, $votestoconfirm, $everconfirmed) = (FetchSQLData()); my ($votes, $status, $votestoconfirm, $everconfirmed) = (FetchSQLData());
my $ret = 0; my $ret = 0;
if ($votes >= $votestoconfirm && $status eq $::unconfirmedstate) { if ($votes >= $votestoconfirm && $status eq 'UNCONFIRMED') {
SendSQL("UPDATE bugs SET bug_status = 'NEW', everconfirmed = 1 " . SendSQL("UPDATE bugs SET bug_status = 'NEW', everconfirmed = 1 " .
"WHERE bug_id = $id"); "WHERE bug_id = $id");
my $fieldid = GetFieldID("bug_status"); my $fieldid = GetFieldID("bug_status");
SendSQL("INSERT INTO bugs_activity " . SendSQL("INSERT INTO bugs_activity " .
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " . "(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
"($id,$who,now(),$fieldid,'$::unconfirmedstate','NEW')"); "($id,$who,now(),$fieldid,'UNCONFIRMED','NEW')");
if (!$everconfirmed) { if (!$everconfirmed) {
$fieldid = GetFieldID("everconfirmed"); $fieldid = GetFieldID("everconfirmed");
SendSQL("INSERT INTO bugs_activity " . SendSQL("INSERT INTO bugs_activity " .
......
...@@ -52,7 +52,6 @@ use vars qw($db_name ...@@ -52,7 +52,6 @@ use vars qw($db_name
@legal_severity @legal_severity
@settable_resolution @settable_resolution
@target_milestone @target_milestone
$unconfirmedstate
$userid $userid
@versions); @versions);
...@@ -947,7 +946,7 @@ if ($dotweak) { ...@@ -947,7 +946,7 @@ if ($dotweak) {
$vars->{'severities'} = \@::legal_severity; $vars->{'severities'} = \@::legal_severity;
$vars->{'resolutions'} = \@::settable_resolution; $vars->{'resolutions'} = \@::settable_resolution;
$vars->{'unconfirmedstate'} = $::unconfirmedstate; $vars->{'unconfirmedstate'} = 'UNCONFIRMED';
$vars->{'bugstatuses'} = [ keys %$bugstatuses ]; $vars->{'bugstatuses'} = [ keys %$bugstatuses ];
......
...@@ -44,7 +44,6 @@ use vars qw(@legal_bug_status @legal_resolution); ...@@ -44,7 +44,6 @@ use vars qw(@legal_bug_status @legal_resolution);
sub sillyness { sub sillyness {
my $zz; my $zz;
$zz = %::MFORM; $zz = %::MFORM;
$zz = $::unconfirmedstate;
} }
my %ctl = ( my %ctl = (
...@@ -1435,7 +1434,7 @@ if ($action eq 'update') { ...@@ -1435,7 +1434,7 @@ if ($action eq 'update') {
# 3. enough votes to confirm # 3. enough votes to confirm
SendSQL("SELECT bug_id FROM bugs " . SendSQL("SELECT bug_id FROM bugs " .
"WHERE product_id = $product_id " . "WHERE product_id = $product_id " .
" AND bug_status = '$::unconfirmedstate' " . " AND bug_status = 'UNCONFIRMED' " .
" AND votes >= $votestoconfirm"); " AND votes >= $votestoconfirm");
if (MoreSQLData()) { if (MoreSQLData()) {
print "<br>Checking unconfirmed bugs in this product for any which now have sufficient votes."; print "<br>Checking unconfirmed bugs in this product for any which now have sufficient votes.";
......
...@@ -43,7 +43,6 @@ use Bugzilla::Bug; ...@@ -43,7 +43,6 @@ use Bugzilla::Bug;
require "CGI.pl"; require "CGI.pl";
use vars qw( use vars qw(
$unconfirmedstate
$template $template
$vars $vars
@enterable_products @enterable_products
...@@ -454,7 +453,7 @@ if (FetchOneColumn()) { ...@@ -454,7 +453,7 @@ if (FetchOneColumn()) {
if (UserInGroup("editbugs") || UserInGroup("canconfirm")) { if (UserInGroup("editbugs") || UserInGroup("canconfirm")) {
push(@status, "NEW"); push(@status, "NEW");
} }
push(@status, $unconfirmedstate); push(@status, 'UNCONFIRMED');
} else { } else {
push(@status, "NEW"); push(@status, "NEW");
} }
......
...@@ -95,8 +95,6 @@ $::ENV{'PATH'} = ''; ...@@ -95,8 +95,6 @@ $::ENV{'PATH'} = '';
$::SIG{TERM} = 'IGNORE'; $::SIG{TERM} = 'IGNORE';
$::SIG{PIPE} = 'IGNORE'; $::SIG{PIPE} = 'IGNORE';
$::unconfirmedstate = "UNCONFIRMED";
# The following subroutine is for debugging purposes only. # The following subroutine is for debugging purposes only.
# Uncommenting this sub and the $::SIG{__DIE__} trap underneath it will # Uncommenting this sub and the $::SIG{__DIE__} trap underneath it will
# cause any fatal errors to result in a call stack trace to help track # cause any fatal errors to result in a call stack trace to help track
...@@ -959,7 +957,7 @@ sub GetBugLink { ...@@ -959,7 +957,7 @@ sub GetBugLink {
my ($pre, $title, $post) = ("", "", ""); my ($pre, $title, $post) = ("", "", "");
$title = $bug_state; $title = $bug_state;
if ($bug_state eq $::unconfirmedstate) { if ($bug_state eq 'UNCONFIRMED') {
$pre = "<i>"; $pre = "<i>";
$post = "</i>"; $post = "</i>";
} }
...@@ -1183,7 +1181,7 @@ sub IsOpenedState { ...@@ -1183,7 +1181,7 @@ sub IsOpenedState {
# is considered an open bug. # is considered an open bug.
sub OpenStates { sub OpenStates {
return ('NEW', 'REOPENED', 'ASSIGNED', $::unconfirmedstate); return ('NEW', 'REOPENED', 'ASSIGNED', 'UNCONFIRMED');
} }
......
...@@ -158,7 +158,7 @@ if (UserInGroup("canedit") || UserInGroup("canconfirm")) { ...@@ -158,7 +158,7 @@ if (UserInGroup("canedit") || UserInGroup("canconfirm")) {
$::FORM{'bug_status'} ||= "NEW"; $::FORM{'bug_status'} ||= "NEW";
} else { } else {
# Default to UNCONFIRMED if we are using it, NEW otherwise # Default to UNCONFIRMED if we are using it, NEW otherwise
$::FORM{'bug_status'} = $::unconfirmedstate; $::FORM{'bug_status'} = 'UNCONFIRMED';
SendSQL("SELECT votestoconfirm FROM products WHERE id = $product_id"); SendSQL("SELECT votestoconfirm FROM products WHERE id = $product_id");
if (!FetchOneColumn()) { if (!FetchOneColumn()) {
$::FORM{'bug_status'} = "NEW"; $::FORM{'bug_status'} = "NEW";
...@@ -182,7 +182,7 @@ CheckFormField(\%::FORM, 'rep_platform', \@::legal_platform); ...@@ -182,7 +182,7 @@ CheckFormField(\%::FORM, 'rep_platform', \@::legal_platform);
CheckFormField(\%::FORM, 'bug_severity', \@::legal_severity); CheckFormField(\%::FORM, 'bug_severity', \@::legal_severity);
CheckFormField(\%::FORM, 'priority', \@::legal_priority); CheckFormField(\%::FORM, 'priority', \@::legal_priority);
CheckFormField(\%::FORM, 'op_sys', \@::legal_opsys); CheckFormField(\%::FORM, 'op_sys', \@::legal_opsys);
CheckFormField(\%::FORM, 'bug_status', [$::unconfirmedstate, 'NEW']); CheckFormField(\%::FORM, 'bug_status', ['UNCONFIRMED', 'NEW']);
CheckFormField(\%::FORM, 'version', $::versions{$product}); CheckFormField(\%::FORM, 'version', $::versions{$product});
CheckFormField(\%::FORM, 'component', $::components{$product}); CheckFormField(\%::FORM, 'component', $::components{$product});
CheckFormField(\%::FORM, 'target_milestone', $::target_milestone{$product}); CheckFormField(\%::FORM, 'target_milestone', $::target_milestone{$product});
...@@ -198,7 +198,7 @@ foreach my $field (@bug_fields) { ...@@ -198,7 +198,7 @@ foreach my $field (@bug_fields) {
} }
if (exists $::FORM{'bug_status'} if (exists $::FORM{'bug_status'}
&& $::FORM{'bug_status'} ne $::unconfirmedstate) && $::FORM{'bug_status'} ne 'UNCONFIRMED')
{ {
push(@used_fields, "everconfirmed"); push(@used_fields, "everconfirmed");
$::FORM{'everconfirmed'} = 1; $::FORM{'everconfirmed'} = 1;
......
...@@ -411,7 +411,7 @@ sub CheckCanChangeField { ...@@ -411,7 +411,7 @@ sub CheckCanChangeField {
# *Only* users with "canconfirm" privs can confirm bugs. # *Only* users with "canconfirm" privs can confirm bugs.
if ($field eq "canconfirm" if ($field eq "canconfirm"
|| ($field eq "bug_status" || ($field eq "bug_status"
&& $oldvalue eq $::unconfirmedstate && $oldvalue eq 'UNCONFIRMED'
&& IsOpenedState($newvalue))) && IsOpenedState($newvalue)))
{ {
$PrivilegesRequired = 3; $PrivilegesRequired = 3;
...@@ -587,8 +587,7 @@ sub ChangeStatus { ...@@ -587,8 +587,7 @@ sub ChangeStatus {
# When reopening, we need to check whether the bug was ever # When reopening, we need to check whether the bug was ever
# confirmed or not # confirmed or not
$::query .= "bug_status = CASE WHEN everconfirmed = 1 THEN " . $::query .= "bug_status = CASE WHEN everconfirmed = 1 THEN " .
SqlQuote($str) . " ELSE " . SqlQuote($str) . " ELSE 'UNCONFIRMED' END";
SqlQuote($::unconfirmedstate) . " END";
} elsif (IsOpenedState($str)) { } elsif (IsOpenedState($str)) {
# Note that we cannot combine this with the above branch - here we # 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 # need to check if bugs.bug_status is open, (since we don't want to
...@@ -620,7 +619,7 @@ sub ChangeStatus { ...@@ -620,7 +619,7 @@ sub ChangeStatus {
$::query .= "bug_status = CASE WHEN bug_status IN($open_state) THEN " . $::query .= "bug_status = CASE WHEN bug_status IN($open_state) THEN " .
"(CASE WHEN everconfirmed = 1 THEN " . "(CASE WHEN everconfirmed = 1 THEN " .
SqlQuote($str) . " ELSE " . SqlQuote($str) . " ELSE " .
SqlQuote($::unconfirmedstate) . " END) ELSE " . " 'UNCONFIRMED' END) ELSE " .
"bug_status END"; "bug_status END";
} else { } else {
$::query .= "bug_status = " . SqlQuote($str); $::query .= "bug_status = " . SqlQuote($str);
...@@ -1188,7 +1187,7 @@ foreach my $id (@idlist) { ...@@ -1188,7 +1187,7 @@ foreach my $id (@idlist) {
|| $::FORM{'knob'} eq 'reassign') || $::FORM{'knob'} eq 'reassign')
{ {
$formhash{'assigned_to'} = $assignee; $formhash{'assigned_to'} = $assignee;
if ($oldhash{'bug_status'} eq $::unconfirmedstate) { if ($oldhash{'bug_status'} eq 'UNCONFIRMED') {
$formhash{'bug_status'} = $oldhash{'bug_status'}; $formhash{'bug_status'} = $oldhash{'bug_status'};
} }
} }
......
...@@ -28,8 +28,6 @@ use lib qw(.); ...@@ -28,8 +28,6 @@ use lib qw(.);
require "CGI.pl"; require "CGI.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
use vars qw($unconfirmedstate);
########################################################################### ###########################################################################
# General subs # General subs
########################################################################### ###########################################################################
...@@ -649,9 +647,7 @@ BugCheck("bugs WHERE bug_status NOT IN ($open_states) AND resolution = ''", ...@@ -649,9 +647,7 @@ BugCheck("bugs WHERE bug_status NOT IN ($open_states) AND resolution = ''",
Status("Checking statuses/everconfirmed"); Status("Checking statuses/everconfirmed");
my $sqlunconfirmed = SqlQuote($unconfirmedstate); BugCheck("bugs WHERE bug_status = 'UNCONFIRMED' AND everconfirmed = 1",
BugCheck("bugs WHERE bug_status = $sqlunconfirmed AND everconfirmed = 1",
"Bugs that are UNCONFIRMED but have everconfirmed set"); "Bugs that are UNCONFIRMED but have everconfirmed set");
# The below list of resolutions is hardcoded because we don't know if future # The below list of resolutions is hardcoded because we don't know if future
# resolutions will be confirmed, unconfirmed or maybeconfirmed. I suspect # resolutions will be confirmed, unconfirmed or maybeconfirmed. I suspect
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment