Commit af4793c8 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 389313: summarize_time.cgi needs some cleanup - Patch by Fré©ric Buclin…

Bug 389313: summarize_time.cgi needs some cleanup - Patch by Fré©ric Buclin <LpSolit@gmail.com> r/a=mkanat
parent c14f288a
......@@ -152,7 +152,7 @@ if (defined $cgi->param('id')) {
}
# Make sure there are bugs to process.
scalar(@idlist) || ThrowUserError("no_bugs_chosen");
scalar(@idlist) || ThrowUserError("no_bugs_chosen", {action => 'modify'});
# Build a bug object using the first bug id, for validations.
my $bug = $bug_objects[0];
......
......@@ -11,18 +11,19 @@
# The Original Code is the Bugzilla Bug Tracking System.
#
# Contributor(s): Christian Reis <kiko@async.com.br>
# Frédéric Buclin <LpSolit@gmail.com>
#%]
[% USE date %]
[% PROCESS global/variables.none.tmpl %]
[% PROCESS "global/field-descs.none.tmpl" %]
[% title = "Time Summary " %]
[% IF do_depends %]
[% title = title _ "for " %]
[% header = title _ "$terms.Bug $ids.0" FILTER bug_link(ids.0) FILTER none %]
[% title = title _ "$terms.Bug $ids.0: " %]
[% header = (header _ " (and $terms.bugs blocking it)") IF do_depends %]
[% header = "$terms.Bug $ids.0" FILTER bug_link(ids.0) FILTER none %]
[% header = title _ header _ " (and $terms.bugs blocking it)" %]
[% title = title _ "$terms.Bug $ids.0" %]
[% ELSE %]
[% title = title _ "($ids.size $terms.bugs selected)" %]
[% header = title %]
......@@ -34,48 +35,40 @@
style_urls = ["skins/standard/summarize-time.css"]
%]
[% IF ids.size == 0 %]
[% INCLUDE query_form %]
<p>No [% terms.bugs %] specified or visible.</p>
[% IF do_report %]
[% ELSE %]
[% INCLUDE query_form %]
[% IF do_report %]
[% global.grand_total = 0 %]
[% FOREACH workdata = part_list %]
[% part = parts.shift %]
<div align="right">
<h4 style="padding-right: 2em; margin: 0;">
[% IF part.0 or part.1 %]
[% part.0 OR "Up" FILTER html %] to [% part.1 OR "now" FILTER html %]
[% ELSE %]
Full summary (no period specified)
[% END %]
</h4>
</div>
[% IF group_by == "number" %]
[% INCLUDE number_report %]
[% ELSE %]
[% INCLUDE owner_report %]
[% END %]
[% END %]
[% global.grand_total = 0 %]
[% IF monthly %]
<h4 style="margin: 0">Total of [% global.grand_total FILTER format("%.2f") %] hours worked</h4>
<hr noshade size="1">
[% FOREACH workdata = part_list %]
[%# parts contains date ranges (from, to). %]
[% part = parts.shift %]
<div align="right">
<h4 style="padding-right: 2em; margin: 0;">
[% IF part.0 or part.1 %]
[% part.0 OR "Up" FILTER html %] to [% part.1 OR "now" FILTER html %]
[% ELSE %]
Full summary (no period specified)
[% END %]
</h4>
</div>
[% IF group_by == "number" %]
[% INCLUDE number_report %]
[% ELSE %]
[% INCLUDE owner_report %]
[% END %]
[% END %]
[% IF null.keys.size > 0 %]
[% INCLUDE inactive_report %]
<h4 style="margin: 0">Total of [% null.keys.size %]
inactive [% terms.bugs %]</h4>
[% END %]
[% IF monthly %]
<h4 style="margin: 0">Total of [% global.grand_total FILTER format("%.2f") %] hours worked</h4>
<hr noshade size="1">
[% END %]
[% END %]
[% IF null.size > 0 %]
[% INCLUDE inactive_report %]
<h4 style="margin: 0">Total of [% null.size %] inactive [% terms.bugs %]</h4>
[% END %]
[% END %]
......@@ -88,7 +81,7 @@
#%]
[% BLOCK owner_report %]
[% global.total = 0 global.bug_count = {} global.owner_count = {}%]
[% global.total = 0 global.bug_count = {} global.owner_count = {} %]
<table cellpadding="4" cellspacing="0" width="90%" class="realitems owner">
[% FOREACH owner = workdata.keys.sort %]
[% INCLUDE do_one_owner owner=owner ownerdata=workdata.$owner
......@@ -111,19 +104,13 @@
[% bug_id = bugdata.bug_id %]
[% global.bug_count.$bug_id = 1 %]
[% IF detailed %]
[%# XXX oy what a hack %]
[% timerow = '<td width="100" align="right" valign="top">' _ bugdata.total_time _ '</td>' %]
[% INCLUDE bug_header cid=col id=bug_id bug_status=bugdata.bug_status
short_desc=bugdata.short_desc extra=timerow %]
[% col = col + 1 %]
[% INCLUDE bug_header cid=col id=bug_id bugdata=bugdata extra=1 %]
[% col = col + 1 %]
[% END %]
[% subtotal = subtotal + bugdata.total_time %]
[% END %]
<tr>
<td colspan="3">&nbsp;</td>
<td align="right">
<b>Total</b>:
</td>
<td colspan="4" align="right"><b>Total</b>:</td>
<td align="right" class="subtotal" width="100">
<b>[% subtotal FILTER format("%.2f") %]</b></td>
[% global.total = global.total + subtotal %]
......@@ -140,13 +127,12 @@
[% global.total = 0 global.owner_count = {} global.bug_count = {} %]
<table cellpadding="4" cellspacing="0" width="90%" class="realitems number">
[% keys = sort_bug_keys(workdata.keys) %]
[% FOREACH bug = keys %]
[% INCLUDE do_one_bug bug=bug bugdata=workdata.$bug
[% FOREACH bug = workdata.keys.nsort %]
[% INCLUDE do_one_bug id=bug bugdata=workdata.$bug
detailed=detailed %]
[% END %]
[% additional = "$global.bug_count.size $terms.bugs &amp;
[% additional = "$global.bug_count.size $terms.bugs &
$global.owner_count.size developers" %]
[% INCLUDE section_total additional=additional colspan=2 %]
</table>
......@@ -154,13 +140,8 @@
[% BLOCK do_one_bug %]
[% subtotal = 0.00 cid = 0 %]
[%# hack apart the ID and summary. Sad. %]
[% items = bug.split(";") %]
[% id = items.shift %]
[% status = items.shift %]
[% global.bug_count.$id = 1 %]
[% INCLUDE bug_header id=id bug_status=status short_desc=items.join(";") %]
[% INCLUDE bug_header id=id %]
[% FOREACH owner = bugdata.sort("login_name") %]
[% work_time = owner.total_time %]
......@@ -184,17 +165,21 @@
</td>
<td align="right" class="subtotal" width="100">
<b>[% subtotal FILTER format("%.2f") %]</b>
</td></tr>
[% global.total = global.total + subtotal %]
</td>
</tr>
[% global.total = global.total + subtotal %]
[% END %]
[% BLOCK bug_header %]
<tr class="bug_header[% '2' IF cid % 2 %]">
<td width="10" valign="top">
[% INCLUDE buglink id=id %]</td>
<td width="10"><b>[% bug_status FILTER html %]</b></td>
<td colspan="2">[% short_desc FILTER html %]</td>
[% extra FILTER none %]
<td width="80" valign="top">
<b>[% "$terms.Bug $id" FILTER bug_link(id) FILTER none %]</b>
</td>
<td width="100"><b>[% get_status(bugs.$id.bug_status) FILTER html %]</b></td>
<td colspan="2">[% bugs.$id.short_desc FILTER html %]</td>
[% IF extra %]
<td align="right" valign="top">[% bugdata.total_time FILTER html %]</td>
[% END %]
</tr>
[% END %]
......@@ -203,9 +188,8 @@
<h3>Inactive [% terms.bugs %]</h3>
<table cellpadding="4" cellspacing="0" width="90%" class="zeroitems">
[% cid = 0 %]
[% FOREACH bug_id = null.keys.nsort %]
[% INCLUDE bug_header id=bug_id bug_status=null.$bug_id.1
short_desc=null.$bug_id.0 cid=cid %]
[% FOREACH bug_id = null.nsort %]
[% INCLUDE bug_header id=bug_id cid=cid %]
[% cid = cid + 1 %]
[% END %]
</table>
......@@ -213,20 +197,18 @@
[% BLOCK section_total %]
[% IF global.total > 0 %]
[% IF global.total > 0 %]
<tr class="section_total">
<td align="left" width="10">
<b>Totals</b></td>
<td colspan="[% colspan FILTER none %]" align="right"><b>[% additional FILTER none %]</b></td>
<td align="right">&nbsp;&nbsp;
<b>[% global.total FILTER format("%.2f") %]</b>
</td></tr>
[% ELSE %]
<tr><td>
No time allocated during the specified period.
</td></tr>
[% END %]
[% global.grand_total = global.grand_total + global.total %]
<td><b>Totals</b></td>
<td colspan="[% colspan FILTER html %]" align="right"><b>[% additional FILTER html %]</b></td>
<td align="right"><b>[% global.total FILTER format("%.2f") %]</b></td>
</tr>
[% ELSE %]
<tr>
<td>No time allocated during the specified period.</td>
</tr>
[% END %]
[% global.grand_total = global.grand_total + global.total %]
[% END %]
[%#
......@@ -301,20 +283,9 @@
</tr></table>
</form>
<script type="application/x-javascript">
<script type="text/javascript">
<!--
document.forms['summary'].start_date.focus()
//--></script>
<hr noshade size=1>
[% END %]
[%#
#
# Utility
#
#%]
[% BLOCK buglink %]
<a href="show_bug.cgi?id=[% id FILTER url_quote %]"><b>[% terms.Bug %]&nbsp;[% id FILTER html %]</b></a>
[% END %]
......@@ -1043,7 +1043,12 @@
[% ELSIF error == "no_bugs_chosen" %]
[% title = BLOCK %]No [% terms.Bugs %] Selected[% END %]
You apparently didn't choose any [% terms.bugs %] to modify.
You apparently didn't choose any [% terms.bugs %]
[% IF action == "modify" %]
to modify.
[% ELSIF action == "view" %]
to view.
[% END %]
[% ELSIF error == "no_bug_ids" %]
[% title = BLOCK %]No [% terms.Bugs %] Selected[% END %]
......
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