summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search.pm
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2013-02-26 06:57:28 +0100
committerByron Jones <bjones@mozilla.com>2013-02-26 06:57:28 +0100
commit2591846d72d5c1a3d577e9af80fc5fdb6026602d (patch)
treeb7e1bc816043cf8f50b616661d58da135e2b2682 /Bugzilla/Search.pm
parenta5b8f38b63869acc0bceb9d71fac435df6ddb199 (diff)
downloadbugzilla-2591846d72d5c1a3d577e9af80fc5fdb6026602d.tar.gz
bugzilla-2591846d72d5c1a3d577e9af80fc5fdb6026602d.tar.xz
restore isempty/isnotempty operators to bmo/4.2
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r--Bugzilla/Search.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index d2148a9c2..0cf618a4c 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -183,6 +183,8 @@ use constant OPERATORS => {
changedfrom => \&_changedfrom_changedto,
changedto => \&_changedfrom_changedto,
changedby => \&_changedby,
+ isempty => \&_isempty,
+ isnotempty => \&_isnotempty,
};
# Some operators are really just standard SQL operators, and are
@@ -224,6 +226,12 @@ use constant NON_NUMERIC_OPERATORS => qw(
notregexp
);
+# These operators ignore the entered value
+use constant NO_VALUE_OPERATORS => qw(
+ isempty
+ isnotempty
+);
+
use constant MULTI_SELECT_OVERRIDE => {
notequals => \&_multiselect_negative,
notregexp => \&_multiselect_negative,
@@ -1597,6 +1605,8 @@ sub _boolean_charts {
my $field = $params->{"field$identifier"};
my $operator = $params->{"type$identifier"};
my $value = $params->{"value$identifier"};
+ # no-value operators ignore the value, however a value needs to be set
+ $value = ' ' if grep { $_ eq $operator } NO_VALUE_OPERATORS;
$or_clause->add($field, $operator, $value);
}
$and_clause->add($or_clause);
@@ -1639,6 +1649,8 @@ sub _custom_search {
my $operator = $params->{"o$id"};
my $value = $params->{"v$id"};
+ # no-value operators ignore the value, however a value needs to be set
+ $value = ' ' if grep { $_ eq $operator } NO_VALUE_OPERATORS;
my $condition = condition($field, $operator, $value);
$condition->negate($params->{"n$id"});
$current_clause->add($condition);
@@ -2947,6 +2959,18 @@ sub _changed_security_check {
}
}
+sub _isempty {
+ my ($self, $args, $join) = @_;
+ my $full_field = $args->{full_field};
+ $args->{term} = "$full_field IS NULL OR $full_field = ''";
+}
+
+sub _isnotempty {
+ my ($self, $args, $join) = @_;
+ my $full_field = $args->{full_field};
+ $args->{term} = "$full_field IS NOT NULL AND $full_field != ''";
+}
+
######################
# Public Subroutines #
######################