summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm9
-rw-r--r--Bugzilla/Constants.pm2
-rw-r--r--Bugzilla/Field.pm3
3 files changed, 13 insertions, 1 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index b367954e6..d82b6f6e6 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -150,6 +150,9 @@ sub VALIDATORS {
elsif ($field->type == FIELD_TYPE_FREETEXT) {
$validator = \&_check_freetext_field;
}
+ elsif ($field->type == FIELD_TYPE_BUG_ID) {
+ $validator = \&_check_bugid_field;
+ }
else {
$validator = \&_check_default_field;
}
@@ -1643,6 +1646,12 @@ sub _check_select_field {
return $value;
}
+sub _check_bugid_field {
+ my ($invocant, $value, $field) = @_;
+ return undef if !$value;
+ return $invocant->check($value, $field)->id;
+}
+
#####################################################################
# Class Accessors
#####################################################################
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index b0dd0b6f6..e06fee00c 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -121,6 +121,7 @@ use File::Basename;
FIELD_TYPE_MULTI_SELECT
FIELD_TYPE_TEXTAREA
FIELD_TYPE_DATETIME
+ FIELD_TYPE_BUG_ID
USAGE_MODE_BROWSER
USAGE_MODE_CMDLINE
@@ -348,6 +349,7 @@ use constant FIELD_TYPE_SINGLE_SELECT => 2;
use constant FIELD_TYPE_MULTI_SELECT => 3;
use constant FIELD_TYPE_TEXTAREA => 4;
use constant FIELD_TYPE_DATETIME => 5;
+use constant FIELD_TYPE_BUG_ID => 6;
# The maximum number of days a token will remain valid.
use constant MAX_TOKEN_AGE => 3;
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index 0d7479034..4b801f13d 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -125,6 +125,7 @@ use constant SQL_DEFINITIONS => {
DEFAULT => "'---'" },
FIELD_TYPE_TEXTAREA, { TYPE => 'MEDIUMTEXT' },
FIELD_TYPE_DATETIME, { TYPE => 'DATETIME' },
+ FIELD_TYPE_BUG_ID, { TYPE => 'INT3' },
};
# Field definitions for the fields that ship with Bugzilla.
@@ -253,7 +254,7 @@ sub _check_type {
my $saved_type = $type;
# The constant here should be updated every time a new,
# higher field type is added.
- (detaint_natural($type) && $type <= FIELD_TYPE_DATETIME)
+ (detaint_natural($type) && $type <= FIELD_TYPE_BUG_ID)
|| ThrowCodeError('invalid_customfield_type', { type => $saved_type });
return $type;
}