summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorgerv%gerv.net <>2001-10-15 09:55:50 +0200
committergerv%gerv.net <>2001-10-15 09:55:50 +0200
commite759f3b296d956031b4fb9010e08d1bd20ee8cbc (patch)
tree49f48fec2248aa6aee9fa779a5a4010fa1e1650f /buglist.cgi
parent794c7b0482d18f1e1013fa206eb9e18fc3ae1ec8 (diff)
downloadbugzilla-e759f3b296d956031b4fb9010e08d1bd20ee8cbc.tar.gz
bugzilla-e759f3b296d956031b4fb9010e08d1bd20ee8cbc.tar.xz
Bug 99716 - allow query for Attachment is obsolete AND Attachment Status. Patch by myk, r=justdave, jake.
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi30
1 files changed, 23 insertions, 7 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 04a9e8892..c22475837 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -336,6 +336,8 @@ sub GenerateSQL {
}
my $chartid;
+ # $statusid is used by the code that queries for attachment statuses.
+ my $statusid = 0;
my $f;
my $ff;
my $t;
@@ -389,7 +391,8 @@ sub GenerateSQL {
},
"^attachments\..*," => sub {
my $table = "attachments_$chartid";
- push(@supptables, "LEFT JOIN attachments $table ON bugs.bug_id = $table.bug_id");
+ push(@supptables, "attachments $table");
+ push(@wherepart, "bugs.bug_id = $table.bug_id");
$f =~ m/^attachments\.(.*)$/;
my $field = $1;
if ($t eq "changedby") {
@@ -408,19 +411,32 @@ sub GenerateSQL {
$field = "creation_ts";
$t = "greaterthan";
}
- if ($field eq "ispatch") {
- if ($v ne "0" && $v ne "1") {
- return Error("The only legal values for the 'Attachment is patch' field is 0 or 1.");
- }
+ if ($field eq "ispatch" && $v ne "0" && $v ne "1") {
+ return Error("The only legal values for the 'Attachment is patch' " .
+ "field are 0 and 1.");
+ }
+ if ($field eq "isobsolete" && $v ne "0" && $v ne "1") {
+ return Error("The only legal values for the 'Attachment is obsolete' " .
+ "field are 0 and 1.");
}
$f = "$table.$field";
},
# 2001-05-16 myk@mozilla.org: enable querying against attachment status
# if this installation has enabled use of the attachment tracker.
"^attachstatusdefs.name," => sub {
+ # When searching for multiple statuses within a single boolean chart,
+ # we want to match each status record separately. In other words,
+ # "status = 'foo' AND status = 'bar'" should match attachments with
+ # one status record equal to "foo" and another one equal to "bar",
+ # not attachments where the same status record equals both "foo" and
+ # "bar" (which is nonsensical). In order to do this we must add an
+ # additional counter to the end of the "attachstatuses" and
+ # "attachstatusdefs" table references.
+ ++$statusid;
+
my $attachtable = "attachments_$chartid";
- my $statustable = "attachstatuses_$chartid";
- my $statusdefstable = "attachstatusdefs_$chartid";
+ my $statustable = "attachstatuses_${chartid}_$statusid";
+ my $statusdefstable = "attachstatusdefs_${chartid}_$statusid";
push(@supptables, "attachments $attachtable");
push(@supptables, "attachstatuses $statustable");
push(@supptables, "attachstatusdefs $statusdefstable");