diff options
author | Gervase Markham <gerv@mozilla.org> | 2013-05-03 16:13:53 +0200 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-05-03 16:13:53 +0200 |
commit | b4410eb57d8e07de23de18b6375039c47e6cea35 (patch) | |
tree | 4ecc320aa75ae046827744a1fa83f7de64fe06fe /Bugzilla/Search.pm | |
parent | 7738bea531e27159910df07e329dac26ff3edf7b (diff) | |
download | bugzilla-b4410eb57d8e07de23de18b6375039c47e6cea35.tar.gz bugzilla-b4410eb57d8e07de23de18b6375039c47e6cea35.tar.xz |
Bug 866248 - backport new date custom field type from bug 801664 to bmo/4.2
r=glob
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r-- | Bugzilla/Search.pm | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index f0cb26357..747f1cd84 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -134,6 +134,7 @@ use Time::HiRes qw(gettimeofday tv_interval); # 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. @@ -344,6 +345,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, @@ -2645,6 +2647,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}; |