Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
3f5c73cc
Commit
3f5c73cc
authored
Aug 22, 2006
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 348537: Move bug status validation out of post_bug and into Bugzilla::Bug
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=bkor, a=myk
parent
dc9ce3a8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
18 deletions
+37
-18
Bug.pm
Bugzilla/Bug.pm
+35
-0
post_bug.cgi
post_bug.cgi
+2
-18
No files found.
Bugzilla/Bug.pm
View file @
3f5c73cc
...
@@ -102,6 +102,14 @@ use constant MAX_LINE_LENGTH => 254;
...
@@ -102,6 +102,14 @@ use constant MAX_LINE_LENGTH => 254;
# Used in ValidateComment(). Gives the max length allowed for a comment.
# Used in ValidateComment(). Gives the max length allowed for a comment.
use
constant
MAX_COMMENT_LENGTH
=>
65535
;
use
constant
MAX_COMMENT_LENGTH
=>
65535
;
# The statuses that are valid on enter_bug.cgi and post_bug.cgi.
# The order is important--see _check_bug_status
use
constant
VALID_ENTRY_STATUS
=>
qw(
UNCONFIRMED
NEW
ASSIGNED
)
;
#####################################################################
#####################################################################
sub
new
{
sub
new
{
...
@@ -253,6 +261,33 @@ sub _check_bug_file_loc {
...
@@ -253,6 +261,33 @@ sub _check_bug_file_loc {
return
$url
;
return
$url
;
}
}
sub
_check_bug_status
{
my
(
$status
,
$product
)
=
@_
;
my
$user
=
Bugzilla
->
user
;
my
@valid_statuses
=
VALID_ENTRY_STATUS
;
if
(
$user
->
in_group
(
'editbugs'
)
||
$user
->
in_group
(
'canconfirm'
))
{
# Default to NEW if the user with privs hasn't selected another status.
$status
||=
'NEW'
;
}
elsif
(
!
$product
->
votes_to_confirm
)
{
# Without privs, products that don't support UNCONFIRMED default to
# NEW.
$status
=
'NEW'
;
}
else
{
$status
=
'UNCONFIRMED'
;
}
# UNCONFIRMED becomes an invalid status if votes_to_confirm is 0,
# even if you are in editbugs.
shift
@valid_statuses
if
!
$product
->
votes_to_confirm
;
check_field
(
'bug_status'
,
$status
,
\
@valid_statuses
);
return
$status
;
}
sub
_check_comment
{
sub
_check_comment
{
my
(
$comment
)
=
@_
;
my
(
$comment
)
=
@_
;
...
...
post_bug.cgi
View file @
3f5c73cc
...
@@ -184,23 +184,8 @@ if (Bugzilla->params->{"useqacontact"}) {
...
@@ -184,23 +184,8 @@ if (Bugzilla->params->{"useqacontact"}) {
}
}
}
}
# Check the bug status.
$cgi
->
param
(
'bug_status'
,
Bugzilla::Bug::
_check_bug_status
(
# This order is important, see below.
scalar
$cgi
->
param
(
'bug_status'
),
$product
));
my
@valid_statuses
=
(
'UNCONFIRMED'
,
'NEW'
,
'ASSIGNED'
);
my
$bug_status
=
'UNCONFIRMED'
;
if
(
$user
->
in_group
(
'editbugs'
)
||
$user
->
in_group
(
'canconfirm'
))
{
# Default to NEW if the user with privs hasn't selected another status.
$bug_status
=
scalar
(
$cgi
->
param
(
'bug_status'
))
||
'NEW'
;
}
elsif
(
!
$product
->
votes_to_confirm
)
{
$bug_status
=
'NEW'
;
}
$cgi
->
param
(
-
name
=>
'bug_status'
,
-
value
=>
$bug_status
);
# Reject 'UNCONFIRMED' as a valid status if the product
# doesn't require votes to confirm its bugs.
shift
@valid_statuses
if
!
$product
->
votes_to_confirm
;
if
(
!
defined
$cgi
->
param
(
'target_milestone'
))
{
if
(
!
defined
$cgi
->
param
(
'target_milestone'
))
{
$cgi
->
param
(
-
name
=>
'target_milestone'
,
-
value
=>
$product
->
default_milestone
);
$cgi
->
param
(
-
name
=>
'target_milestone'
,
-
value
=>
$product
->
default_milestone
);
...
@@ -215,7 +200,6 @@ check_field('rep_platform', scalar $cgi->param('rep_platform'));
...
@@ -215,7 +200,6 @@ check_field('rep_platform', scalar $cgi->param('rep_platform'));
check_field
(
'bug_severity'
,
scalar
$cgi
->
param
(
'bug_severity'
));
check_field
(
'bug_severity'
,
scalar
$cgi
->
param
(
'bug_severity'
));
check_field
(
'priority'
,
scalar
$cgi
->
param
(
'priority'
));
check_field
(
'priority'
,
scalar
$cgi
->
param
(
'priority'
));
check_field
(
'op_sys'
,
scalar
$cgi
->
param
(
'op_sys'
));
check_field
(
'op_sys'
,
scalar
$cgi
->
param
(
'op_sys'
));
check_field
(
'bug_status'
,
scalar
$cgi
->
param
(
'bug_status'
),
\
@valid_statuses
);
check_field
(
'version'
,
scalar
$cgi
->
param
(
'version'
),
check_field
(
'version'
,
scalar
$cgi
->
param
(
'version'
),
[
map
(
$_
->
name
,
@
{
$product
->
versions
})]);
[
map
(
$_
->
name
,
@
{
$product
->
versions
})]);
check_field
(
'target_milestone'
,
scalar
$cgi
->
param
(
'target_milestone'
),
check_field
(
'target_milestone'
,
scalar
$cgi
->
param
(
'target_milestone'
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment