summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Search.pm
diff options
context:
space:
mode:
authorjocuri%softhome.net <>2005-01-16 22:36:02 +0100
committerjocuri%softhome.net <>2005-01-16 22:36:02 +0100
commitc1a8053e98fa659ffda19fae799423c1762dbd10 (patch)
tree73c2a248c499ee3b7a811d3dbca07c14078e3069 /Bugzilla/Search.pm
parentce3c5ed7f0c8c4426b3717c169674edfe7a16556 (diff)
downloadbugzilla-c1a8053e98fa659ffda19fae799423c1762dbd10.tar.gz
bugzilla-c1a8053e98fa659ffda19fae799423c1762dbd10.tar.xz
Patch for bug 103636: Support specifying a date on which a bug is expected to be resolved; patch by Alexandre Michetti Manduca <michetti@grad.icmc.usp.br>, r=jouni, a=myk.
Diffstat (limited to 'Bugzilla/Search.pm')
-rw-r--r--Bugzilla/Search.pm32
1 files changed, 30 insertions, 2 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 85f661e30..9756a428d 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -301,6 +301,27 @@ sub init {
}
}
+ my $sql_deadlinefrom;
+ my $sql_deadlineto;
+ if (Bugzilla->user->in_group(Param('timetrackinggroup'))){
+ my $deadlinefrom;
+ my $deadlineto;
+
+ if ($params->param('deadlinefrom')){
+ $deadlinefrom = $params->param('deadlinefrom');
+ Bugzilla::Util::ValidateDate($deadlinefrom, 'deadlinefrom');
+ $sql_deadlinefrom = &::SqlQuote($deadlinefrom);
+ push(@wherepart, "bugs.deadline >= $sql_deadlinefrom");
+ }
+
+ if ($params->param('deadlineto')){
+ $deadlineto = $params->param('deadlineto');
+ Bugzilla::Util::ValidateDate($deadlineto, 'deadlineto');
+ $sql_deadlineto = &::SqlQuote($deadlineto);
+ push(@wherepart, "bugs.deadline <= $sql_deadlineto");
+ }
+ }
+
foreach my $f ("short_desc", "long_desc", "bug_file_loc",
"status_whiteboard") {
if (defined $params->param($f)) {
@@ -545,6 +566,10 @@ sub init {
"^content," => sub {
ThrowUserError("search_content_without_matches");
},
+ "^deadline,(?:lessthan|greaterthan|equals|notequals),(-|\\+)?(\\d+)([dDwWmMyY])\$" => sub {
+ $v = SqlifyDate($v);
+ $q = &::SqlQuote($v);
+ },
"^commenter,(?:equals|anyexact),(%\\w+%)" => sub {
my $match = pronoun($1, $user);
my $chartseq = $chartid;
@@ -1281,9 +1306,12 @@ sub SqlifyDate {
my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime(time());
return sprintf("%4d-%02d-%02d 00:00:00", $year+1900, $month+1, $mday);
}
- if ($str =~ /^-?(\d+)([dDwWmMyY])$/) { # relative date
- my ($amount, $unit, $date) = ($1, lc $2, time);
+
+
+ if ($str =~ /^(-|\+)?(\d+)([dDwWmMyY])$/) { # relative date
+ my ($sign, $amount, $unit, $date) = ($1, $2, lc $3, time);
my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime($date);
+ if ($sign eq '+') { $amount = -$amount; }
if ($unit eq 'w') { # convert weeks to days
$amount = 7*$amount + $wday;
$unit = 'd';