Add productive_time field

parent 81974a9a
......@@ -9,6 +9,7 @@
/data
/localconfig
/index.html
*.*~
/skins/contrib/Dusk/admin.css
/skins/contrib/Dusk/bug.css
......@@ -1074,6 +1074,11 @@ sub update {
LogActivityEntry($self->id, "work_time", "", $comment->work_time, $user->id,
$delta_ts);
}
if ($comment->productive_time) {
LogActivityEntry($self->id, "productive_time", "", $comment->productive_time, $user->id,
$delta_ts);
}
}
# Comment Privacy
......@@ -2494,7 +2499,7 @@ sub set_all {
}
}
if (exists $params->{'comment'} or exists $params->{'work_time'}) {
if (exists $params->{'comment'} or exists $params->{'work_time'} or exists $params->{'productive_time'}) {
# Add a comment as needed to each bug. This is done early because
# there are lots of things that want to check if we added a comment.
......@@ -2502,7 +2507,8 @@ sub set_all {
$params->{'comment'}->{'body'},
{
isprivate => $params->{'comment'}->{'is_private'},
work_time => $params->{'work_time'}
work_time => $params->{'work_time'},
productive_time => $params->{'productive_time'}
}
);
}
......
......@@ -38,6 +38,7 @@ use constant DB_COLUMNS => qw(
who
bug_when
work_time
productive_time
thetext
isprivate
already_wrapped
......@@ -64,6 +65,7 @@ use constant VALIDATORS => {
who => \&_check_who,
bug_when => \&_check_bug_when,
work_time => \&_check_work_time,
productive_time => \&_check_work_time,
thetext => \&_check_thetext,
isprivate => \&_check_isprivate,
extra_data => \&_check_extra_data,
......@@ -194,6 +196,14 @@ sub work_time {
return 0 if $_[0]->{'work_time'} + 0 == 0;
return $_[0]->{'work_time'};
}
sub productive_time {
# Work_time-like function
return 0 if $_[0]->{'productive_time'} + 0 == 0;
return $_[0]->{'productive_time'};
}
sub type { return $_[0]->{'type'}; }
sub extra_data { return $_[0]->{'extra_data'} }
......
......@@ -433,7 +433,7 @@ use constant ABNORMAL_SELECTS =>
# The fields from fielddefs that are blocked from non-timetracking users.
# work_time is sometimes called actual_time.
use constant TIMETRACKING_FIELDS =>
qw(estimated_time remaining_time work_time actual_time percentage_complete);
qw(estimated_time remaining_time work_time actual_time percentage_complete productive_time);
# The maximum number of days a token will remain valid.
use constant MAX_TOKEN_AGE => 3;
......
......@@ -365,6 +365,7 @@ use constant DEFAULT_FIELDS => (
{name => 'requestees.login_name', desc => 'Flag Requestee'},
{name => 'setters.login_name', desc => 'Flag Setter'},
{name => 'work_time', desc => 'Hours Worked', buglist => 1, is_numeric => 1},
{name => 'productive_time', desc => 'Productive hours worked', buglist => 1, is_numeric => 1},
{
name => 'percentage_complete',
desc => 'Percentage Complete',
......
......@@ -268,6 +268,8 @@ sub update_table_definitions {
$dbh->bz_add_column("bugs", "remaining_time",
{TYPE => 'decimal(5,2)', NOTNULL => 1, DEFAULT => '0'});
$dbh->bz_add_column("bugs", "deadline", {TYPE => 'DATETIME'});
$dbh->bz_add_column("longdescs", "productive_time",
{TYPE => 'decimal(5,2)', NOTNULL => 1, DEFAULT => '0'});
_use_ip_instead_of_hostname_in_logincookies();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1003,7 +1003,7 @@ sub add_comment {
# Append comment
$bug->add_comment($comment,
{isprivate => $params->{is_private}, work_time => $params->{work_time}});
{isprivate => $params->{is_private}, work_time => $params->{work_time}, productive_time => $params->{productive_time});
$bug->update();
my $new_comment_id = $bug->{added_comments}[0]->id;
......
......@@ -105,6 +105,8 @@ print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_EMAIL;
# an individual bug.
my $delta_ts = $cgi->param('delta_ts') || '';
my $productive_time = $cgi->param('productive_time') || '';
if ($delta_ts) {
my $delta_ts_z = datetime_from($delta_ts)
or ThrowCodeError('invalid_timestamp', {timestamp => $delta_ts});
......@@ -206,7 +208,7 @@ my @set_fields = qw(op_sys rep_platform priority bug_severity
component target_milestone version
bug_file_loc status_whiteboard short_desc
deadline remaining_time estimated_time
work_time set_default_assignee set_default_qa_contact
work_time productive_time set_default_assignee set_default_qa_contact
cclist_accessible reporter_accessible
product confirm_product_change
bug_status resolution dup_id bug_ignored);
......@@ -220,6 +222,7 @@ my %field_translation = (
set_default_assignee => 'reset_assigned_to',
set_default_qa_contact => 'reset_qa_contact',
confirm_product_change => 'product_change_confirmed',
productive_time => 'productive_time',
);
my %set_all_fields = (other_bugs => \@bug_objects);
......@@ -232,7 +235,6 @@ foreach my $field_name (@set_fields) {
if (should_set('keywords')) {
my $action = $cgi->param('keywordaction') || '';
# Backward-compatibility for Bugzilla 3.x and older.
$action = 'remove' if $action eq 'delete';
$action = 'set' if $action eq 'makeexact';
......@@ -358,7 +360,6 @@ if (defined $cgi->param('id')) {
my ($flags, $new_flags)
= Bugzilla::Flag->extract_flags_from_cgi($first_bug, undef, $vars);
$first_bug->set_flags($flags, $new_flags);
# Tags can only be set to one bug at once.
if (should_set('tag')) {
my @new_tags = grep { trim($_) } split(/,/, $cgi->param('tag'));
......
......@@ -202,6 +202,8 @@
<br>
Отработанное время:
[% PROCESS formattimeunit time_unit=comment.work_time %]
Продуктивное время:
<span class="productive-time">[% PROCESS formattimeunit time_unit=comment.productive_time %]</span>
[% END %]
[% IF user.id && Param('comment_taggers_group') %]
......@@ -222,7 +224,6 @@
</span>
</div>
[% END %]
[%# Don't indent the <pre> block, since then the spaces are displayed in the
# generated HTML
#%]
......@@ -235,4 +236,18 @@
[% Hook.process('a_comment-end', 'bug/comments.html.tmpl') %]
</div>
[% END %]
<script type="text/javascript">
let productiveTimes = document.querySelectorAll('.productive-time');
// parse float and get sum
let sum = 0;
for (let i = 0; i < productiveTimes.length; i++) {
sum += parseFloat(productiveTimes[i].innerText);
}
// write in table:
document.querySelector('#productive_time_amount').innerHTML += sum;
</script>
[% END %]
......@@ -1091,15 +1091,15 @@
time_unit=(bug.actual_time + bug.remaining_time) %]
</td>
<td>
[% PROCESS formattimeunit time_unit=bug.actual_time %] +
[% PROCESS formattimeunit time_unit=bug.actual_time %]
<input name="work_time" id="work_time"
value="0" size="3" maxlength="6"
onchange="adjustRemainingTime();">
onchange="adjustRemainingTime();" hidden>
</td>
<td>
[% PROCESS formattimeunit time_unit=bug.productive_time %]
<td id="productive_time_amount">
[% PROCESS formattimeunit time_unit=bug.productive_time %]
<input name="productive_time" id="productive_time"
value="0" size="3" maxlength="6">
value="0" size="3" maxlength="6" hidden>
</td>
<td>
<input name="remaining_time" id="remaining_time"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment