aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Clark <jjclark1982@gmail.com>2010-05-05 19:19:42 -0700
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-05-05 19:19:42 -0700
commit742af401e648534faac1b8ce90854f614ed01ade (patch)
treee8ed7647059ff95c27be76aaa622fe7da8eca89b
parent9500ea0126044d372fbd311966bfa077f9d135fe (diff)
downloadbugs-742af401e648534faac1b8ce90854f614ed01ade.tar
bugs-742af401e648534faac1b8ce90854f614ed01ade.tar.gz
bugs-742af401e648534faac1b8ce90854f614ed01ade.tar.bz2
bugs-742af401e648534faac1b8ce90854f614ed01ade.tar.xz
bugs-742af401e648534faac1b8ce90854f614ed01ade.zip
Bug 180812: Make boolean charts involving both flags and attachments
limit the flag search based on the attachment criteria r=mkanat, a=mkanat
-rw-r--r--Bugzilla/Search.pm33
1 files changed, 28 insertions, 5 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 91af8162d..9bdc35182 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -1693,9 +1693,9 @@ sub _attach_data_thedata {
my $atable = "attachments_$$chartid";
my $dtable = "attachdata_$$chartid";
my $extra = $self->{'user'}->is_insider ? "" : "AND $atable.isprivate = 0";
- push(@$supptables, "INNER JOIN attachments AS $atable " .
+ push(@$supptables, "LEFT JOIN attachments AS $atable " .
"ON bugs.bug_id = $atable.bug_id $extra");
- push(@$supptables, "INNER JOIN attach_data AS $dtable " .
+ push(@$supptables, "LEFT JOIN attach_data AS $dtable " .
"ON $dtable.id = $atable.attach_id");
$$f = "$dtable.thedata";
}
@@ -1708,7 +1708,7 @@ sub _attachments_submitter {
my $atable = "map_attachment_submitter_$$chartid";
my $extra = $self->{'user'}->is_insider ? "" : "AND $atable.isprivate = 0";
- push(@$supptables, "INNER JOIN attachments AS $atable " .
+ push(@$supptables, "LEFT JOIN attachments AS $atable " .
"ON bugs.bug_id = $atable.bug_id $extra");
push(@$supptables, "LEFT JOIN profiles AS attachers_$$chartid " .
"ON $atable.submitter_id = attachers_$$chartid.userid");
@@ -1724,7 +1724,7 @@ sub _attachments {
my $table = "attachments_$$chartid";
my $extra = $self->{'user'}->is_insider ? "" : "AND $table.isprivate = 0";
- push(@$supptables, "INNER JOIN attachments AS $table " .
+ push(@$supptables, "LEFT JOIN attachments AS $table " .
"ON bugs.bug_id = $table.bug_id $extra");
$$f =~ m/^attachments\.(.*)$/;
my $field = $1;
@@ -1772,12 +1772,19 @@ sub _flagtypes_name {
# Add the flags and flagtypes tables to the query. We do
# a left join here so bugs without any flags still match
# negative conditions (f.e. "flag isn't review+").
+ my $attachments = "attachments_$$chartid";
+ my $extra = $self->{'user'}->is_insider ? "" : "AND $attachments.isprivate = 0";
+ push(@$supptables, "LEFT JOIN attachments AS $attachments " .
+ "ON bugs.bug_id = $attachments.bug_id $extra");
my $flags = "flags_$$chartid";
push(@$supptables, "LEFT JOIN flags AS $flags " .
"ON bugs.bug_id = $flags.bug_id ");
my $flagtypes = "flagtypes_$$chartid";
push(@$supptables, "LEFT JOIN flagtypes AS $flagtypes " .
"ON $flags.type_id = $flagtypes.id");
+ push(@$supptables, "LEFT JOIN flags AS $flags " .
+ "ON $flags.attach_id = $attachments.attach_id " .
+ "OR $flags.attach_id IS NULL");
# Generate the condition by running the operator-specific
# function. Afterwards the condition resides in the global $term
@@ -1807,11 +1814,19 @@ sub _requestees_login_name {
my %func_args = @_;
my ($f, $chartid, $supptables) = @func_args{qw(f chartid supptables)};
+ my $attachments = "attachments_$$chartid";
+ my $extra = $self->{'user'}->is_insider ? "" : "AND $attachments.isprivate = 0";
+ push(@$supptables, "LEFT JOIN attachments AS $attachments " .
+ "ON bugs.bug_id = $attachments.bug_id $extra");
my $flags = "flags_$$chartid";
push(@$supptables, "LEFT JOIN flags AS $flags " .
"ON bugs.bug_id = $flags.bug_id ");
push(@$supptables, "LEFT JOIN profiles AS requestees_$$chartid " .
"ON $flags.requestee_id = requestees_$$chartid.userid");
+ push(@$supptables, "LEFT JOIN flags AS $flags " .
+ "ON $flags.attach_id = $attachments.attach_id " .
+ "OR $flags.attach_id IS NULL");
+
$$f = "requestees_$$chartid.login_name";
}
@@ -1819,12 +1834,20 @@ sub _setters_login_name {
my $self = shift;
my %func_args = @_;
my ($f, $chartid, $supptables) = @func_args{qw(f chartid supptables)};
-
+
+ my $attachments = "attachments_$$chartid";
+ my $extra = $self->{'user'}->is_insider ? "" : "AND $attachments.isprivate = 0";
+ push(@$supptables, "LEFT JOIN attachments AS $attachments " .
+ "ON bugs.bug_id = $attachments.bug_id $extra");
my $flags = "flags_$$chartid";
push(@$supptables, "LEFT JOIN flags AS $flags " .
"ON bugs.bug_id = $flags.bug_id ");
push(@$supptables, "LEFT JOIN profiles AS setters_$$chartid " .
"ON $flags.setter_id = setters_$$chartid.userid");
+ push(@$supptables, "LEFT JOIN flags AS $flags " .
+ "ON $flags.attach_id = $attachments.attach_id " .
+ "OR $flags.attach_id IS NULL");
+
$$f = "setters_$$chartid.login_name";
}