summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xBugzilla/Bug.pm6
-rw-r--r--Bugzilla/BugMail.pm13
-rw-r--r--Bugzilla/Search.pm32
-rw-r--r--Bugzilla/Util.pm17
-rw-r--r--CGI.pl8
-rwxr-xr-xbuglist.cgi3
-rwxr-xr-xchecksetup.pl3
-rwxr-xr-xcolchange.cgi2
-rw-r--r--globals.pl2
-rwxr-xr-xlong_list.cgi6
-rwxr-xr-xpost_bug.cgi15
-rwxr-xr-xprocess_bug.cgi11
-rw-r--r--template/en/default/bug/create/create.html.tmpl7
-rw-r--r--template/en/default/bug/edit.html.tmpl7
-rw-r--r--template/en/default/bug/show-multiple.html.tmpl2
-rw-r--r--template/en/default/filterexceptions.pl2
-rw-r--r--template/en/default/global/field-descs.none.tmpl1
-rw-r--r--template/en/default/global/user-error.html.tmpl3
-rw-r--r--template/en/default/search/form.html.tmpl19
19 files changed, 142 insertions, 17 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__
diff --git a/CGI.pl b/CGI.pl
index 822002957..165e5216c 100644
--- a/CGI.pl
+++ b/CGI.pl
@@ -358,7 +358,8 @@ sub GetBugActivity {
# check if the user should see this field's activity
if ($fieldname eq 'remaining_time' ||
$fieldname eq 'estimated_time' ||
- $fieldname eq 'work_time') {
+ $fieldname eq 'work_time' ||
+ $fieldname eq 'deadline') {
if (!UserInGroup(Param('timetrackinggroup'))) {
$activity_visible = 0;
@@ -391,6 +392,11 @@ sub GetBugActivity {
$operation = {};
$changes = [];
}
+
+ if ($fieldname eq 'deadline') {
+ $removed = time2str("%Y-%m-%d", str2time($removed));
+ $added = time2str("%Y-%m-%d", str2time($added));
+ }
$operation->{'who'} = $who;
$operation->{'when'} = $when;
diff --git a/buglist.cgi b/buglist.cgi
index 569cfdc9f..4286f81f4 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -478,7 +478,7 @@ DefineColumn("remaining_time" , "bugs.remaining_time" , "Remaining Hou
DefineColumn("actual_time" , "(SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id)) AS actual_time", "Actual Hours");
DefineColumn("percentage_complete","(100*((SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id))/((SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id))+bugs.remaining_time))) AS percentage_complete", "% Complete");
DefineColumn("relevance" , "relevance" , "Relevance" );
-
+DefineColumn("deadline" , "DATE_FORMAT(bugs.deadline, '%Y-%m-%d')", "Deadline");
################################################################################
# Display Column Determination
@@ -544,6 +544,7 @@ if (!UserInGroup(Param("timetrackinggroup"))) {
@displaycolumns = grep($_ ne 'remaining_time', @displaycolumns);
@displaycolumns = grep($_ ne 'actual_time', @displaycolumns);
@displaycolumns = grep($_ ne 'percentage_complete', @displaycolumns);
+ @displaycolumns = grep($_ ne 'deadline', @displaycolumns);
}
# Remove the relevance column if the user is not doing a fulltext search.
diff --git a/checksetup.pl b/checksetup.pl
index bf193497a..932870dd2 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -1774,6 +1774,7 @@ $table{bugs} =
cclist_accessible tinyint not null default 1,
estimated_time decimal(5,2) not null default 0,
remaining_time decimal(5,2) not null default 0,
+ deadline datetime,
alias varchar(20),
index (assigned_to),
@@ -2287,6 +2288,7 @@ AddFDef("cclist_accessible", "CC Accessible", 0);
AddFDef("bug_group", "Group", 0);
AddFDef("estimated_time", "Estimated Hours", 1);
AddFDef("remaining_time", "Remaining Hours", 0);
+AddFDef("deadline", "Deadline", 1);
# Oops. Bug 163299
$dbh->do("DELETE FROM fielddefs WHERE name='cc_accessible'");
@@ -3354,6 +3356,7 @@ if (GetFieldDef("bugs","qacontact_accessible")) {
AddField("longdescs", "work_time", "decimal(5,2) not null default 0");
AddField("bugs", "estimated_time", "decimal(5,2) not null default 0");
AddField("bugs", "remaining_time", "decimal(5,2) not null default 0");
+AddField("bugs", "deadline", "datetime");
# 2002-03-15 bbaetz@student.usyd.edu.au - bug 129466
# 2002-05-13 preed@sigkill.com - bug 129446 patch backported to the
diff --git a/colchange.cgi b/colchange.cgi
index 1886b6b07..8e2fc2d49 100755
--- a/colchange.cgi
+++ b/colchange.cgi
@@ -77,7 +77,7 @@ if (@::legal_keywords) {
if (UserInGroup(Param("timetrackinggroup"))) {
push(@masterlist, ("estimated_time", "remaining_time", "actual_time",
- "percentage_complete"));
+ "percentage_complete", "deadline"));
}
push(@masterlist, ("short_desc", "short_short_desc"));
diff --git a/globals.pl b/globals.pl
index dc0a29570..00a44af7a 100644
--- a/globals.pl
+++ b/globals.pl
@@ -681,7 +681,7 @@ sub GetFieldDefs {
my $extra = "";
if (!UserInGroup(Param('timetrackinggroup'))) {
$extra = "WHERE name NOT IN ('estimated time', 'remaining_time', " .
- "'work_time', 'percentage_complete')";
+ "'work_time', 'percentage_complete', 'deadline')";
}
my @fields;
diff --git a/long_list.cgi b/long_list.cgi
index 515f4c226..c3abbafcf 100755
--- a/long_list.cgi
+++ b/long_list.cgi
@@ -63,7 +63,8 @@ my $generic_query = "
bugs.keywords,
bugs.estimated_time,
bugs.remaining_time,
- date_format(creation_ts,'%Y.%m.%d %H:%i')
+ date_format(creation_ts,'%Y.%m.%d %H:%i'),
+ date_format(bugs.deadline, '%Y-%m-%d')
FROM bugs,profiles assign,profiles report, classifications, products, components
WHERE assign.userid = bugs.assigned_to AND report.userid = bugs.reporter
AND bugs.product_id=products.id AND bugs.component_id=components.id
@@ -89,7 +90,8 @@ foreach my $bug_id (split(/[:,]/, $buglist)) {
"bug_severity", "component", "assigned_to", "reporter",
"bug_file_loc", "short_desc", "target_milestone",
"qa_contact", "status_whiteboard", "keywords",
- "estimated_time", "remaining_time", "creation_ts")
+ "estimated_time", "remaining_time", "creation_ts",
+ "deadline")
{
$bug{$field} = shift @row;
}
diff --git a/post_bug.cgi b/post_bug.cgi
index 27f870e13..b51e24db5 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -325,7 +325,7 @@ if (UserInGroup("editbugs") && defined($::FORM{'dependson'})) {
# Build up SQL string to add bug.
my $sql = "INSERT INTO bugs " .
"(" . join(",", @used_fields) . ", reporter, creation_ts, " .
- "estimated_time, remaining_time) " .
+ "estimated_time, remaining_time, deadline) " .
"VALUES (";
foreach my $field (@used_fields) {
@@ -346,10 +346,19 @@ if (UserInGroup(Param("timetrackinggroup")) &&
my $est_time = $::FORM{'estimated_time'};
Bugzilla::Bug::ValidateTime($est_time, 'estimated_time');
- $sql .= SqlQuote($est_time) . "," . SqlQuote($est_time);
+ $sql .= SqlQuote($est_time) . "," . SqlQuote($est_time) . ",";
} else {
- $sql .= "0, 0";
+ $sql .= "0, 0, ";
}
+
+if ((UserInGroup(Param("timetrackinggroup"))) && ($::FORM{'deadline'})) {
+ Bugzilla::Util::ValidateDate($::FORM{'deadline'}, 'YYYY-MM-DD');
+ my $str = $::FORM{'deadline'};
+ $sql .= SqlQuote($::FORM{'deadline'});
+} else {
+ $sql .= "NULL";
+}
+
$sql .= ")";
# Groups
diff --git a/process_bug.cgi b/process_bug.cgi
index d8ad4cafa..724c709d8 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -784,6 +784,17 @@ if (UserInGroup(Param('timetrackinggroup'))) {
}
}
}
+
+ if (defined $::FORM{'deadline'}) {
+ DoComma();
+ $::query .= "deadline = ";
+ if ($::FORM{'deadline'}) {
+ Bugzilla::Util::ValidateDate($::FORM{'deadline'}, 'YYYY-MM-DD');
+ $::query .= SqlQuote($::FORM{'deadline'});
+ } else {
+ $::query .= "NULL" ;
+ }
+ }
}
# If the user is submitting changes from show_bug.cgi for a single bug,
diff --git a/template/en/default/bug/create/create.html.tmpl b/template/en/default/bug/create/create.html.tmpl
index 0bc5c516c..e3551627b 100644
--- a/template/en/default/bug/create/create.html.tmpl
+++ b/template/en/default/bug/create/create.html.tmpl
@@ -218,6 +218,13 @@ function set_assign_to() {
<input name="estimated_time" size="6" maxlength="6" value="0.0">
</td>
</tr>
+ <tr>
+ <td align="right"><strong>Deadline:</strong></td>
+ <td colspan="3">
+ <input name="deadline" size="10" maxlength="10">
+ <small>(YYYY-MM-DD)</small>
+ </td>
+ </tr>
<tr>
<td>&nbsp;</td>
diff --git a/template/en/default/bug/edit.html.tmpl b/template/en/default/bug/edit.html.tmpl
index 3a9fed0c7..0ba3638d8 100644
--- a/template/en/default/bug/edit.html.tmpl
+++ b/template/en/default/bug/edit.html.tmpl
@@ -380,6 +380,9 @@
<th align="center" bgcolor="#cccccc">
Gain
</th>
+ <th align="center" bgcolor="#cccccc">
+ Deadline
+ </th>
</tr>
<tr>
<td align="center">
@@ -410,6 +413,10 @@
<td align="center">
[% PROCESS formattimeunit time_unit=bug.estimated_time - (bug.actual_time + bug.remaining_time) %]
</td>
+ <td align="center">
+ <input name="deadline" value="[% bug.deadline %]"
+ size="10" maxlength="10">
+ </td>
</tr>
</table>
[% END %]
diff --git a/template/en/default/bug/show-multiple.html.tmpl b/template/en/default/bug/show-multiple.html.tmpl
index a6c5fccea..a57445084 100644
--- a/template/en/default/bug/show-multiple.html.tmpl
+++ b/template/en/default/bug/show-multiple.html.tmpl
@@ -170,6 +170,8 @@
[% PROCESS formattimeunit
time_unit=bug.estimated_time - (bug.actual_time + bug.remaining_time) %]
&nbsp;
+ <b>Deadline:</b>&nbsp;
+ [% bug.deadline %]
</td>
</tr>
[% END %]
diff --git a/template/en/default/filterexceptions.pl b/template/en/default/filterexceptions.pl
index b954c9176..3d5ba8fb1 100644
--- a/template/en/default/filterexceptions.pl
+++ b/template/en/default/filterexceptions.pl
@@ -337,6 +337,7 @@
],
'bug/edit.html.tmpl' => [
+ 'bug.deadline',
'bug.remaining_time',
'bug.delta_ts',
'bug.bug_id',
@@ -366,6 +367,7 @@
'bug/show-multiple.html.tmpl' => [
'bug.bug_id',
+ 'bug.deadline',
],
'bug/show.xml.tmpl' => [
diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl
index e49db6b5b..a1a22d7e8 100644
--- a/template/en/default/global/field-descs.none.tmpl
+++ b/template/en/default/global/field-descs.none.tmpl
@@ -38,6 +38,7 @@
"component_id" => "Component ID",
"component" => "Component",
"creation_ts" => "$terms.Bug Creation time",
+ "deadline" => "Deadline",
"delta_ts" => "Last Changed time",
"dependson" => "Depends on",
"dup_id" => "Duplicate",
diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl
index 6b922d0c2..7c6b40201 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -410,6 +410,9 @@
[% ELSIF error == "illegal_date" %]
[% title = "Illegal Date" %]
'<tt>[% date FILTER html %]</tt>' is not a legal date.
+ [% IF format %]
+ Please use the format '<tt>[% format FILTER html %]</tt>'.
+ [% END %]
[% ELSIF error == "illegal_email_address" %]
[% title = "Invalid Email Address" %]
diff --git a/template/en/default/search/form.html.tmpl b/template/en/default/search/form.html.tmpl
index a3e0d68f5..35a85710d 100644
--- a/template/en/default/search/form.html.tmpl
+++ b/template/en/default/search/form.html.tmpl
@@ -304,6 +304,25 @@ function doOnSelectProduct(selectmode) {
</td>
</tr>
[% END %]
+
+ [%# Deadline %]
+ [% IF UserInGroup(Param("timetrackinggroup")) %]
+ <tr>
+ <th align="right">
+ Dead<u>l</u>ine:
+ </th>
+ <td>
+ from&nbsp;
+ <input name="deadlinefrom" size="10" maxlength="10" accesskey="l">&nbsp;
+ to&nbsp;
+ <input name="deadlineto" size="10" maxlength="10">
+ </td>
+ <td>
+ <small>(YYYY-MM-DD)</small>
+ </td>
+ </tr>
+ [% END %]
+
</table>
<hr>