summaryrefslogtreecommitdiffstats
path: root/Bugzilla
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
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')
-rwxr-xr-xBugzilla/Bug.pm6
-rw-r--r--Bugzilla/BugMail.pm13
-rw-r--r--Bugzilla/Search.pm32
-rw-r--r--Bugzilla/Util.pm17
4 files changed, 60 insertions, 8 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index d5aa5fd17..bad24b589 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -62,7 +62,7 @@ sub fields {
}
if (Param('timetrackinggroup')) {
- push @fields, qw(estimated_time remaining_time actual_time);
+ push @fields, qw(estimated_time remaining_time actual_time deadline);
}
return @fields;
@@ -147,7 +147,7 @@ sub initBug {
DATE_FORMAT(creation_ts,'%Y.%m.%d %H:%i'),
delta_ts, COALESCE(SUM(votes.vote_count), 0),
reporter_accessible, cclist_accessible,
- estimated_time, remaining_time
+ estimated_time, remaining_time, DATE_FORMAT(deadline,'%Y-%m-%d')
from bugs left join votes using(bug_id),
classifications, products, components
where bugs.bug_id = $bug_id
@@ -170,7 +170,7 @@ sub initBug {
"target_milestone", "qa_contact", "status_whiteboard",
"creation_ts", "delta_ts", "votes",
"reporter_accessible", "cclist_accessible",
- "estimated_time", "remaining_time")
+ "estimated_time", "remaining_time", "deadline")
{
$fields{$field} = shift @row;
if (defined $fields{$field}) {
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index 41a8c2329..d9dbb770b 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -184,6 +184,8 @@ sub ProcessOneBug($) {
}
$values{'estimated_time'} = format_time_decimal($values{'estimated_time'});
+ $values{'deadline'} = time2str("%Y-%m-%d", str2time($values{'deadline'}));
+
my @dependslist;
SendSQL("SELECT dependson FROM dependencies WHERE
blocked = $id ORDER BY dependson");
@@ -243,6 +245,10 @@ sub ProcessOneBug($) {
WHERE attach_id = $attachid");
$diffpart->{'isprivate'} = FetchOneColumn();
}
+ if( $fieldname eq 'deadline' ) {
+ $old = time2str("%Y-%m-%d", str2time($old));
+ $new = time2str("%Y-%m-%d", str2time($new));
+ }
$difftext = FormatTriple($what, $old, $new);
$diffpart->{'header'} = $diffheader;
$diffpart->{'fieldname'} = $fieldname;
@@ -741,8 +747,8 @@ sub NewProcessOnePerson ($$$$$$$$$$$$$) {
next;
}
# Only send estimated_time if it is enabled and the user is in the group
- if ($f ne 'estimated_time' ||
- $user->groups->{Param('timetrackinggroup')}) {
+ if (($f ne 'estimated_time' && $f ne 'deadline') ||
+ $user->groups->{Param('timetrackinggroup')}) {
my $desc = $fielddescription{$f};
$head .= FormatDouble($desc, $value);
@@ -761,7 +767,8 @@ sub NewProcessOnePerson ($$$$$$$$$$$$$) {
if (exists($diff->{'fieldname'}) &&
($diff->{'fieldname'} eq 'estimated_time' ||
$diff->{'fieldname'} eq 'remaining_time' ||
- $diff->{'fieldname'} eq 'work_time')) {
+ $diff->{'fieldname'} eq 'work_time' ||
+ $diff->{'fieldname'} eq 'deadline')){
if ($user->groups->{Param("timetrackinggroup")}) {
$add_diff = 1;
}
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';
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index 142866912..b832d1698 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -36,6 +36,9 @@ use base qw(Exporter);
format_time format_time_decimal);
use Bugzilla::Config;
+use Bugzilla::Error;
+use Date::Parse;
+use Date::Format;
# This is from the perlsec page, slightly modifed to remove a warning
# From that page:
@@ -220,6 +223,20 @@ sub format_time_decimal {
return $newtime;
}
+sub ValidateDate {
+ my ($date, $format) = @_;
+
+ my $ts = str2time($date);
+ my $date2 = time2str("%Y-%m-%d", $ts);
+
+ $date =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
+ $date2 =~ s/(\d+)-0*(\d+?)-0*(\d+?)/$1-$2-$3/;
+
+ if ($date ne $date2) {
+ ThrowUserError('illegal_date', {date => $date, format => $format});
+ }
+}
+
1;
__END__