From ac3fc4635663e59fd953c26d66e1b0d4f7dd7764 Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Thu, 3 Mar 2011 11:41:35 -0800 Subject: Bug 638518: Make all boolean chart operators work with attach_data.thedata r=mkanat, a=mkanat (module owner) --- Bugzilla/Search.pm | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index ce4b1605e..5c12e2ad6 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -267,11 +267,9 @@ use constant OPERATOR_FIELD_OVERRIDE => { alias => { _non_changed => \&_alias_nonchanged, }, - 'attach_data.thedata' => { - _non_changed => \&_attach_data_thedata, - }, # We check all attachment fields against this. attachments => MULTI_SELECT_OVERRIDE, + 'attach_data.thedata' => MULTI_SELECT_OVERRIDE, blocked => MULTI_SELECT_OVERRIDE, bug_group => MULTI_SELECT_OVERRIDE, classification => { @@ -2326,29 +2324,6 @@ sub _percentage_complete { $self->_add_extra_column('actual_time'); } -sub _attach_data_thedata { - my ($self, $args) = @_; - my ($chart_id, $joins) = @$args{qw(chart_id joins)}; - - my $attach_table = "attachments_$chart_id"; - my $data_table = "attachdata_$chart_id"; - my $extra = $self->_user->is_insider - ? [] : ["$attach_table.isprivate = 0"]; - my $attachments_join = { - table => 'attachments', - as => $attach_table, - extra => $extra, - }; - my $data_join = { - table => 'attach_data', - as => $data_table, - from => "$attach_table.attach_id", - to => "id", - }; - push(@$joins, $attachments_join, $data_join); - $args->{full_field} = "$data_table.thedata"; -} - sub _join_flag_tables { my ($self, $args) = @_; my ($joins, $chart_id) = @$args{qw(joins chart_id)}; @@ -2601,6 +2576,12 @@ sub _multiselect_table { $args->{full_field} = $1; return "attachments"; } + elsif ($field eq 'attach_data.thedata') { + $args->{_extra_where} = " AND attachments.isprivate = 0" + if !$self->_user->is_insider; + return "attachments INNER JOIN attach_data " + . " ON attachments.attach_id = attach_data.id" + } my $table = "bug_$field"; $args->{full_field} = "bug_$field.value"; return $table; -- cgit v1.2.3-24-g4f1b