From 725f2fb7958c6a251efdb056d49063fc4f8da91a Mon Sep 17 00:00:00 2001 From: Gervase Markham Date: Wed, 2 Jan 2013 17:58:34 +0000 Subject: Bug 801664 - Add DATE type for custom fields. r=LpSolit. --- Bugzilla/Search.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index b9c37b4ed..71893a5fc 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -108,6 +108,7 @@ use Storable qw(dclone); # When doing searches, NULL datetimes are treated as this date. use constant EMPTY_DATETIME => '1970-01-01 00:00:00'; +use constant EMPTY_DATE => '1970-01-01'; # This is the regex for real numbers from Regexp::Common, modified to be # more readable. @@ -310,6 +311,7 @@ use constant OPERATOR_FIELD_OVERRIDE => { FIELD_TYPE_FREETEXT, { _non_changed => \&_nullable }, FIELD_TYPE_BUG_ID, { _non_changed => \&_nullable_int }, FIELD_TYPE_DATETIME, { _non_changed => \&_nullable_datetime }, + FIELD_TYPE_DATE, { _non_changed => \&_nullable_date }, FIELD_TYPE_TEXTAREA, { _non_changed => \&_nullable }, FIELD_TYPE_MULTI_SELECT, MULTI_SELECT_OVERRIDE, FIELD_TYPE_BUG_URLS, MULTI_SELECT_OVERRIDE, @@ -2511,6 +2513,13 @@ sub _nullable_datetime { $args->{full_field} = "COALESCE($field, $empty)"; } +sub _nullable_date { + my ($self, $args) = @_; + my $field = $args->{full_field}; + my $empty = Bugzilla->dbh->quote(EMPTY_DATE); + $args->{full_field} = "COALESCE($field, $empty)"; +} + sub _deadline { my ($self, $args) = @_; my $field = $args->{full_field}; -- cgit v1.2.3-24-g4f1b