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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
e3837b96
Commit
e3837b96
authored
Jul 13, 2007
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 388022: Use Bugzilla::Bug to set/update custom fields in process_bug.cgi
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
parent
5ab86735
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
24 deletions
+42
-24
Bug.pm
Bugzilla/Bug.pm
+35
-17
process_bug.cgi
process_bug.cgi
+3
-7
code-error.html.tmpl
template/en/default/global/code-error.html.tmpl
+4
-0
No files found.
Bugzilla/Bug.pm
View file @
e3837b96
...
...
@@ -133,12 +133,19 @@ sub VALIDATORS {
status_whiteboard
=>
\&
_check_status_whiteboard
,
};
my
@select_fields
=
Bugzilla
->
get_fields
({
custom
=>
1
,
obsolete
=>
0
,
type
=>
FIELD_TYPE_SINGLE_SELECT
});
foreach
my
$field
(
@select_fields
)
{
$validators
->
{
$field
->
name
}
=
\&
_check_select_field
;
# Set up validators for custom fields.
my
@custom_fields
=
Bugzilla
->
get_fields
({
custom
=>
1
,
obsolete
=>
0
});
foreach
my
$field
(
@custom_fields
)
{
my
$validator
;
if
(
$field
->
type
==
FIELD_TYPE_SINGLE_SELECT
)
{
$validator
=
\&
_check_select_field
;
}
else
{
$validator
=
\&
_check_freetext_field
;
}
$validators
->
{
$field
->
name
}
=
$validator
;
}
return
$validators
;
};
...
...
@@ -147,18 +154,22 @@ use constant UPDATE_VALIDATORS => {
resolution
=>
\&
_check_resolution
,
};
use
constant
UPDATE_COLUMNS
=>
qw(
everconfirmed
bug_file_loc
bug_severity
bug_status
op_sys
priority
rep_platform
resolution
short_desc
status_whiteboard
)
;
sub
UPDATE_COLUMNS
{
my
@columns
=
qw(
everconfirmed
bug_file_loc
bug_severity
bug_status
op_sys
priority
rep_platform
resolution
short_desc
status_whiteboard
)
;
push
(
@columns
,
Bugzilla
->
custom_field_names
);
return
@columns
;
};
# This is used by add_comment to know what we validate before putting in
# the DB.
...
...
@@ -896,6 +907,8 @@ sub _check_estimated_time {
return
$_
[
0
]
->
_check_time
(
$_
[
1
],
'estimated_time'
);
}
sub
_check_freetext_field
{
return
defined
$_
[
1
]
?
trim
(
$_
[
1
])
:
''
;
}
sub
_check_groups
{
my
(
$invocant
,
$product
,
$group_ids
)
=
@_
;
...
...
@@ -1169,6 +1182,11 @@ sub _set_global_validator {
# "Set" Methods #
#################
sub
set_custom_field
{
my
(
$self
,
$field
,
$value
)
=
@_
;
ThrowCodeError
(
'field_not_custom'
,
{
field
=>
$field
})
if
!
$field
->
custom
;
$self
->
set
(
$field
->
name
,
$value
);
}
sub
set_dependencies
{
my
(
$self
,
$dependson
,
$blocked
)
=
@_
;
(
$dependson
,
$blocked
)
=
$self
->
_check_dependencies
(
$dependson
,
$blocked
);
...
...
process_bug.cgi
View file @
e3837b96
...
...
@@ -591,12 +591,7 @@ foreach my $field (Bugzilla->get_fields({custom => 1, obsolete => 0})) {
&&
(
!
$cgi
->
param
(
'dontchange'
)
||
$cgi
->
param
(
$fname
)
ne
$cgi
->
param
(
'dontchange'
)))
{
DoComma
();
$::query
.=
"$fname = ?"
;
my
$value
=
$cgi
->
param
(
$fname
);
check_field
(
$fname
,
$value
)
if
(
$field
->
type
==
FIELD_TYPE_SINGLE_SELECT
);
trick_taint
(
$value
);
push
(
@values
,
$value
);
$_
->
set_custom_field
(
$field
,
$cgi
->
param
(
$fname
))
foreach
@bug_objects
;
}
}
...
...
@@ -1397,7 +1392,8 @@ foreach my $id (@idlist) {
# Bugzilla::Bug does these for us already.
next
if
grep
(
$_
eq
$col
,
qw(keywords op_sys rep_platform priority
bug_severity short_desc
status_whiteboard bug_file_loc)
);
status_whiteboard bug_file_loc)
,
Bugzilla
->
custom_field_names
);
if
(
$col
eq
'product'
)
{
# If some votes have been removed, RemoveVotes() returns
...
...
template/en/default/global/code-error.html.tmpl
View file @
e3837b96
...
...
@@ -150,6 +150,10 @@
Cannot seem to handle <code>[% field FILTER html %]</code>
and <code>[% type FILTER html %]</code> together.
[% ELSIF error == "field_not_custom" %]
'[% field.description FILTER html %]' ([% field.name FILTER html %])
is not a custom field.
[% ELSIF error == "gd_not_installed" %]
[% admindocslinks = {'installation.html#install-perlmodules' => 'Installing Perl modules necessary for Charting'} %]
Charts will not work without the GD Perl module being installed.
...
...
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