diff options
author | terry%netscape.com <> | 1999-03-24 06:32:19 +0000 |
---|---|---|
committer | terry%netscape.com <> | 1999-03-24 06:32:19 +0000 |
commit | 19ca3aa8dbc4f551836cd0dac9150118c9128ee1 (patch) | |
tree | 03ae4669a496ee9dee3ac21482bbf79089a2dc6a /buglist.cgi | |
parent | 57f0b7a2c7ed40c7eb2029bf1091c3f262b1e23f (diff) | |
download | bugs-19ca3aa8dbc4f551836cd0dac9150118c9128ee1.tar bugs-19ca3aa8dbc4f551836cd0dac9150118c9128ee1.tar.gz bugs-19ca3aa8dbc4f551836cd0dac9150118c9128ee1.tar.bz2 bugs-19ca3aa8dbc4f551836cd0dac9150118c9128ee1.tar.xz bugs-19ca3aa8dbc4f551836cd0dac9150118c9128ee1.zip |
Can now query for a specified field being changed at a specified time,
optionally to a specified value.
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-x | buglist.cgi | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/buglist.cgi b/buglist.cgi index b5f5e1608..196357804 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -23,6 +23,7 @@ use diagnostics; use strict; require "CGI.pl"; +use Date::Parse; my $serverpush = 1; @@ -340,6 +341,57 @@ Click the <B>Back</B> button and try again."; } } +my $ref = $::MFORM{'chfield'}; + + +sub SqlifyDate { + my ($str) = (@_); + if (!defined $str) { + $str = ""; + } + my $date = str2time($str); + if (!defined $date) { + print "The string '<tt>$str</tt>' is not a legal date.\n"; + print "<P>Please click the <B>Back</B> button and try again.\n"; + exit; + } + return time2str("'%Y/%m/%d %H:%M:%S'", $date); +} + + + + + +if (defined $ref && 0 < @$ref) { + # Do surgery on the query to tell it to patch in the bugs_activity + # table. + $query =~ s/bugs,/bugs, bugs_activity,/; + + my @list; + foreach my $f (@$ref) { + push(@list, "\nbugs_activity.field = " . SqlQuote($f)); + } + $query .= "and bugs_activity.bug_id = bugs.bug_id and (" . + join(' or ', @list) . ") "; + $query .= "and bugs_activity.when >= " . + SqlifyDate($::FORM{'chfieldfrom'}) . "\n"; + my $to = $::FORM{'chfieldto'}; + if (defined $to) { + $to = trim($to); + if ($to ne "" && $to !~ /^now$/i) { + $query .= "and bugs_activity.when <= " . SqlifyDate($to) . "\n"; + } + } + my $value = $::FORM{'chfieldvalue'}; + if (defined $value) { + $value = trim($value); + if ($value ne "") { + $query .= "and bugs_activity.newvalue = " . + SqlQuote($value) . "\n"; + } + } +} + foreach my $f ("short_desc", "long_desc", "bug_file_loc", "status_whiteboard") { if (defined $::FORM{$f}) { |