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
3776f86e
Commit
3776f86e
authored
Feb 27, 2014
by
Simon Green
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 466178 - Add an INTEGER custom field type
r=glob, a=justdave
parent
64f44ef1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
3 deletions
+39
-3
Bug.pm
Bugzilla/Bug.pm
+24
-0
Constants.pm
Bugzilla/Constants.pm
+4
-2
Field.pm
Bugzilla/Field.pm
+1
-0
field.html.tmpl
template/en/default/bug/field.html.tmpl
+3
-1
field-descs.none.tmpl
template/en/default/global/field-descs.none.tmpl
+1
-0
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+6
-0
No files found.
Bugzilla/Bug.pm
View file @
3776f86e
...
@@ -158,6 +158,9 @@ sub VALIDATORS {
...
@@ -158,6 +158,9 @@ sub VALIDATORS {
elsif
(
$field
->
type
==
FIELD_TYPE_TEXTAREA
)
{
elsif
(
$field
->
type
==
FIELD_TYPE_TEXTAREA
)
{
$validator
=
\&
_check_textarea_field
;
$validator
=
\&
_check_textarea_field
;
}
}
elsif
(
$field
->
type
==
FIELD_TYPE_INTEGER
)
{
$validator
=
\&
_check_integer_field
;
}
else
{
else
{
$validator
=
\&
_check_default_field
;
$validator
=
\&
_check_default_field
;
}
}
...
@@ -2110,6 +2113,27 @@ sub _check_textarea_field {
...
@@ -2110,6 +2113,27 @@ sub _check_textarea_field {
return
$text
;
return
$text
;
}
}
sub
_check_integer_field
{
my
(
$invocant
,
$value
,
$field
)
=
@_
;
$value
=
defined
(
$value
)
?
trim
(
$value
)
:
''
;
if
(
$value
eq
''
)
{
return
0
;
}
my
$orig_value
=
$value
;
if
(
!
detaint_signed
(
$value
))
{
ThrowUserError
(
"number_not_integer"
,
{
field
=>
$field
,
num
=>
$orig_value
});
}
elsif
(
$value
>
MAX_INT_32
)
{
ThrowUserError
(
"number_too_large"
,
{
field
=>
$field
,
num
=>
$orig_value
,
max_num
=>
MAX_INT_32
});
}
return
$value
;
}
sub
_check_relationship_loop
{
sub
_check_relationship_loop
{
# Generates a dependency tree for a given bug. Calls itself recursively
# Generates a dependency tree for a given bug. Calls itself recursively
# to generate sub-trees for the bug's dependencies.
# to generate sub-trees for the bug's dependencies.
...
...
Bugzilla/Constants.pm
View file @
3776f86e
...
@@ -111,8 +111,9 @@ use Memoize;
...
@@ -111,8 +111,9 @@ use Memoize;
FIELD_TYPE_BUG_ID
FIELD_TYPE_BUG_ID
FIELD_TYPE_BUG_URLS
FIELD_TYPE_BUG_URLS
FIELD_TYPE_KEYWORDS
FIELD_TYPE_KEYWORDS
FIELD_TYPE_INTEGER
FIELD_TYPE_HIGHEST_PLUS_ONE
FIELD_TYPE_HIGHEST_PLUS_ONE
EMPTY_DATETIME_REGEX
EMPTY_DATETIME_REGEX
ABNORMAL_SELECTS
ABNORMAL_SELECTS
...
@@ -398,9 +399,10 @@ use constant FIELD_TYPE_BUG_ID => 6;
...
@@ -398,9 +399,10 @@ use constant FIELD_TYPE_BUG_ID => 6;
use
constant
FIELD_TYPE_BUG_URLS
=>
7
;
use
constant
FIELD_TYPE_BUG_URLS
=>
7
;
use
constant
FIELD_TYPE_KEYWORDS
=>
8
;
use
constant
FIELD_TYPE_KEYWORDS
=>
8
;
use
constant
FIELD_TYPE_DATE
=>
9
;
use
constant
FIELD_TYPE_DATE
=>
9
;
use
constant
FIELD_TYPE_INTEGER
=>
10
;
# Add new field types above this line, and change the below value in the
# Add new field types above this line, and change the below value in the
# obvious fashion
# obvious fashion
use
constant
FIELD_TYPE_HIGHEST_PLUS_ONE
=>
1
0
;
use
constant
FIELD_TYPE_HIGHEST_PLUS_ONE
=>
1
1
;
use
constant
EMPTY_DATETIME_REGEX
=>
qr/^[0\-:\sA-Za-z]+$/
;
use
constant
EMPTY_DATETIME_REGEX
=>
qr/^[0\-:\sA-Za-z]+$/
;
...
...
Bugzilla/Field.pm
View file @
3776f86e
...
@@ -153,6 +153,7 @@ use constant SQL_DEFINITIONS => {
...
@@ -153,6 +153,7 @@ use constant SQL_DEFINITIONS => {
FIELD_TYPE_DATETIME
,
{
TYPE
=>
'DATETIME'
},
FIELD_TYPE_DATETIME
,
{
TYPE
=>
'DATETIME'
},
FIELD_TYPE_DATE
,
{
TYPE
=>
'DATE'
},
FIELD_TYPE_DATE
,
{
TYPE
=>
'DATE'
},
FIELD_TYPE_BUG_ID
,
{
TYPE
=>
'INT3'
},
FIELD_TYPE_BUG_ID
,
{
TYPE
=>
'INT3'
},
FIELD_TYPE_INTEGER
,
{
TYPE
=>
'INT4'
,
NOTNULL
=>
1
,
DEFAULT
=>
0
},
};
};
# Field definitions for the fields that ship with Bugzilla.
# Field definitions for the fields that ship with Bugzilla.
...
...
template/en/default/bug/field.html.tmpl
View file @
3776f86e
...
@@ -35,11 +35,13 @@
...
@@ -35,11 +35,13 @@
[% Hook.process('start_field_column') %]
[% Hook.process('start_field_column') %]
[% IF editable %]
[% IF editable %]
[% SWITCH field.type %]
[% SWITCH field.type %]
[% CASE constants.FIELD_TYPE_FREETEXT %]
[% CASE [ constants.FIELD_TYPE_FREETEXT
constants.FIELD_TYPE_INTEGER ] %]
<input id="[% field.name FILTER html %]" class="text_input"
<input id="[% field.name FILTER html %]" class="text_input"
name="[% field.name FILTER html %]"
name="[% field.name FILTER html %]"
value="[% value FILTER html %]" size="40"
value="[% value FILTER html %]" size="40"
maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]"
maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]"
[% ' pattern="\d+"' IF field.type == constants.FIELD_TYPE_INTEGER %]
[% ' aria-required="true"' IF field.is_mandatory %]>
[% ' aria-required="true"' IF field.is_mandatory %]>
[% CASE [constants.FIELD_TYPE_DATETIME, constants.FIELD_TYPE_DATE] %]
[% CASE [constants.FIELD_TYPE_DATETIME, constants.FIELD_TYPE_DATE] %]
[% size = (field.type == constants.FIELD_TYPE_DATE) ? 10 : 20 %]
[% size = (field.type == constants.FIELD_TYPE_DATE) ? 10 : 20 %]
...
...
template/en/default/global/field-descs.none.tmpl
View file @
3776f86e
...
@@ -41,6 +41,7 @@
...
@@ -41,6 +41,7 @@
[% field_types = { ${constants.FIELD_TYPE_UNKNOWN} => "Unknown Type",
[% field_types = { ${constants.FIELD_TYPE_UNKNOWN} => "Unknown Type",
${constants.FIELD_TYPE_FREETEXT} => "Free Text",
${constants.FIELD_TYPE_FREETEXT} => "Free Text",
${constants.FIELD_TYPE_INTEGER} => "Integer",
${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down",
${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down",
${constants.FIELD_TYPE_MULTI_SELECT} => "Multiple-Selection Box",
${constants.FIELD_TYPE_MULTI_SELECT} => "Multiple-Selection Box",
${constants.FIELD_TYPE_TEXTAREA} => "Large Text Box",
${constants.FIELD_TYPE_TEXTAREA} => "Large Text Box",
...
...
template/en/default/global/user-error.html.tmpl
View file @
3776f86e
...
@@ -1366,6 +1366,12 @@
...
@@ -1366,6 +1366,12 @@
Either no products have been defined to enter [% terms.bugs %] against or you have not
Either no products have been defined to enter [% terms.bugs %] against or you have not
been given access to any.
been given access to any.
[% ELSIF error == "number_not_integer" %]
[% title = "Integer Value Required" %]
The value '[% num FILTER html %]' in the
<em>[% field_descs.$field FILTER html %]</em> field
is not an integer value (i.e. a whole number).
[% ELSIF error == "number_not_numeric" %]
[% ELSIF error == "number_not_numeric" %]
[% title = "Numeric Value Required" %]
[% title = "Numeric Value Required" %]
The value '[% num FILTER html %]' in the
The value '[% num FILTER html %]' in the
...
...
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