From: Kohei Yoshino Date: Wed, 31 Jul 2019 05:47:02 +0000 (-0400) Subject: Bug 1568704 - Allow to use --- as empty Resolution field value in Custom Search X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=202d0d26563de4051959c9106d0904e3ec8f0998;p=thirdparty%2Fbugzilla.git Bug 1568704 - Allow to use --- as empty Resolution field value in Custom Search --- diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 9f536792e..8155192f1 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -381,6 +381,9 @@ sub SPECIAL_PARSING { # BMO - add ability to use pronoun for triage owners triage_owner => \&_triage_owner_pronoun, + + # Misc. + resolution => \&_chart_resolution_parser, }; foreach my $field (Bugzilla->active_custom_fields({skip_extensions => 1})) { if ($field->type == FIELD_TYPE_DATETIME) { @@ -2541,6 +2544,21 @@ sub _triage_owner_pronoun { } } +###################################### +# "Special Parsing" Functions: Misc. # +###################################### + +sub _chart_resolution_parser { + my ($self, $args) = @_; + my ($value, $operator) = @$args{qw(value operator)}; + + # Treat `---` as empty + if (trim($value) eq '---' && $operator =~ /^(?:not)?equals$/) { + $args->{value} = $args->{all_values} = $args->{quoted} = ''; + $args->{operator} = $operator eq 'equals' ? 'isempty' : 'isnotempty'; + } +} + ##################################################################### # Search Functions #####################################################################