summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Field.pm
diff options
context:
space:
mode:
authorGervase Markham <gerv@gerv.net>2013-01-02 18:58:34 +0100
committerGervase Markham <gerv@mozilla.org>2013-01-02 18:58:34 +0100
commit725f2fb7958c6a251efdb056d49063fc4f8da91a (patch)
tree068dd4c94d2a9f7bf3ae85f6019d4c2ba4a67989 /Bugzilla/Field.pm
parent21b50cba4e08e723f8c2d8e8b5800d0a13e2c180 (diff)
downloadbugzilla-725f2fb7958c6a251efdb056d49063fc4f8da91a.tar.gz
bugzilla-725f2fb7958c6a251efdb056d49063fc4f8da91a.tar.xz
Bug 801664 - Add DATE type for custom fields. r=LpSolit.
Diffstat (limited to 'Bugzilla/Field.pm')
-rw-r--r--Bugzilla/Field.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm
index 14888287a..c85d43bb8 100644
--- a/Bugzilla/Field.pm
+++ b/Bugzilla/Field.pm
@@ -151,6 +151,7 @@ use constant SQL_DEFINITIONS => {
FIELD_TYPE_TEXTAREA, { TYPE => 'MEDIUMTEXT',
NOTNULL => 1, DEFAULT => "''"},
FIELD_TYPE_DATETIME, { TYPE => 'DATETIME' },
+ FIELD_TYPE_DATE, { TYPE => 'DATE' },
FIELD_TYPE_BUG_ID, { TYPE => 'INT3' },
};
@@ -349,9 +350,7 @@ sub _check_sortkey {
sub _check_type {
my ($invocant, $type, undef, $params) = @_;
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_KEYWORDS)
+ (detaint_natural($type) && $type < FIELD_TYPE_HIGHEST_PLUS_ONE)
|| ThrowCodeError('invalid_customfield_type', { type => $saved_type });
my $custom = blessed($invocant) ? $invocant->custom : $params->{custom};
@@ -952,7 +951,10 @@ sub remove_from_db {
}
else {
$bugs_query = "SELECT COUNT(*) FROM bugs WHERE $name IS NOT NULL";
- if ($self->type != FIELD_TYPE_BUG_ID && $self->type != FIELD_TYPE_DATETIME) {
+ if ($self->type != FIELD_TYPE_BUG_ID
+ && $self->type != FIELD_TYPE_DATE
+ && $self->type != FIELD_TYPE_DATETIME)
+ {
$bugs_query .= " AND $name != ''";
}
# Ignore the default single select value