Commit 5892d273 authored by Linda Julien's avatar Linda Julien
Browse files

Reporting offers delimited text

parent dc39bc77
......@@ -88,11 +88,17 @@ foreach my $key ( keys %$class_tix ) {
if ($RT::BusinessHours) {
$bizhours->business_hours(%$RT::BusinessHours);
}
$bizhours->for_timespan( Start => $t->StartsObj->Unix,
End => $t->StartedObj->Unix );
my $started_time;
if ($t->StartsObj->Unix < $t->StartedObj->Unix) {
$bizhours->for_timespan( Start => $t->StartsObj->Unix,
End => $t->StartedObj->Unix );
my $started_time = $bizhours->between( $t->StartsObj->Unix,
$t->StartedObj->Unix );
$started_time = $bizhours->between( $t->StartsObj->Unix,
$t->StartedObj->Unix );
} else {
$started_time = 0;
}
if ( $started_time < $sla) {
$sla_count++;
}
......
%# BEGIN LICENSE BLOCK
%#
%# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
%#
%# (Except where explictly superceded by other copyright notices)
%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org
%#
%# This work is distributed in the hope that it will be useful, but
%# WITHOUT ANY WARRANTY; without even the implied warranty of
%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
%# General Public License for more details.
%#
%#
%# Unless otherwise specified, all modifications, corrections or
%# extensions to this work which alter its source code become the
%# property of Best Practical Solutions, LLC when submitted for
%# inclusion in the work.
%#
%#
%# END LICENSE BLOCK
At the start of the time period
Outstanding Incident Reports;<% scalar %$outstanding %>
During the time period
Total <%$service_level%> Incident Reports created;<% $tix_count %>
Incident Reports for which SLA time was met;<% $sla_count %>
Resolved Incident Reports;<% $resolved_count%>
Unresolved Incident Reports;<% $unresolved_count%>
<%INIT>
my ($tix_count, $sla_count, $resolved_count, $unresolved_count);
$tix_count = 0;
$sla_count = 0;
$resolved_count = 0;
$unresolved_count = 0;
# get the number of seconds for the service level
my $sla = $RT::SLA->{$service_level} * 60;
foreach my $key ( keys %$class_tix ) {
my $t = $class_tix->{$key};
$tix_count++;
# All tickets created in queue IncidentReport created after
# start and before end where there was outbound
# correspondence within the time specified by $sla.
#
if ($t->StartsObj->Unix > 0 && $t->StartedObj->Unix > 0) {
# Get a Business::Hours object for the period in question
use Business::Hours;
my $bizhours = Business::Hours->new();
if ($RT::BusinessHours) {
$bizhours->business_hours(%$RT::BusinessHours);
}
my $started_time;
if ($t->StartsObj->Unix < $t->StartedObj->Unix) {
$bizhours->for_timespan( Start => $t->StartsObj->Unix,
End => $t->StartedObj->Unix );
$started_time = $bizhours->between( $t->StartsObj->Unix,
$t->StartedObj->Unix );
} else {
$started_time = 0;
}
if ( $started_time < $sla) {
$sla_count++;
}
}
if ( $t->ResolvedObj->Unix >= $start->Unix &&
$t->ResolvedObj->Unix <= $end->Unix) {
$resolved_count++;
}
if ( $t->ResolvedObj->Unix <= 0 ||
$t->ResolvedObj->Unix > $end->Unix) {
$unresolved_count++;
}
}
</%INIT>
<%ARGS>
$service_level => undef
$class_tix => undef
$outstanding => undef
$start => undef
$end => undef
</%ARGS>
......@@ -22,8 +22,20 @@
%#
%#
%# END LICENSE BLOCK
<h1>RTIR Periodic Report for <%$Constituency%></h1>
% if ($tabbed) {
RTIR Periodic Report for <%$Constituency%>
Start date:;<%$rtstart->AsString%>
End date:;<%$rtend->AsString%>
Incident Report Summary (including unlinked Incident Reports)
Outstanding reports at the beginning of this period;<% scalar keys %$outstanding_pruned %>
Total new reports for this period;<% scalar keys %$tix_created_pruned %>
Incident Reports resolved during this period;<% scalar keys %$tix_resolved_pruned %>
Reports unresolved at the end of the period;<% scalar keys %$tix_unresolved_pruned %>
% } else {
<h1>RTIR Periodic Report for <%$Constituency%></h1>
<table>
<tr>
<td>Start date:</td>
......@@ -34,7 +46,6 @@
<td><%$rtend->AsString%></td>
</tr>
</table>
<table>
<tr><th align=left colspan=2>Incident Report Summary (including unlinked Incident Reports)</th></tr>
<tr>
......@@ -54,17 +65,24 @@
<td><% scalar keys %$tix_unresolved_pruned %></td>
</tr>
</table>
% }
<%perl>
foreach my $key (sort keys %$types) {
my $incident_type = $types->{$key};
</%perl>
% if ($tabbed) {
<%$incident_type%>
% } else {
<h2><%$incident_type%></h2>
% }
% if ($tabbed) {
Incident reports received
% } else {
<table>
<th align=left colspan=2>Incident reports received</th>
% }
<%perl>
foreach my $key (sort keys %$classifications) {
......@@ -83,18 +101,22 @@ foreach my $key (sort keys %$classifications) {
}
</%perl>
% if ($tabbed) {
<%$class%>;<%$class_count%>
% } else {
<tr>
<td><%$class%></td>
<td class=value><%$class_count%></td>
</tr>
% }
<%perl>
}
</%perl>
% if ($tabbed) {
% } else {
</table>
% }
<%perl>
foreach my $service_level (keys %$sla_levels) {
my $class_tix = RT::Tickets->new( $session{'CurrentUser'} );
......@@ -123,20 +145,38 @@ foreach my $key (sort keys %$classifications) {
}
</%perl>
% if ($tabbed) {
<%$service_level%>
% } else {
<h3><%$service_level%></h3>
% }
% if ($tabbed) {
<& Elements/SLASummaryText,
class_tix => $mytix, outstanding => $myoutstanding,
service_level => $service_level,
start => $rtstart, end => $rtend &>
% } else {
<& Elements/SLASummary,
class_tix => $mytix, outstanding => $myoutstanding,
service_level => $service_level,
start => $rtstart, end => $rtend &>
% }
<%perl>
}
}
if ($tabbed) {
$m->abort();
}
</%perl>
<%init>
my $tabbed = 0;
if ($ARGS{TextReport}) {
$tabbed = 1;
}
my $start = ParseDateToISO($mystart);
my $end = ParseDateToISO($myend);
......@@ -265,6 +305,9 @@ sub get_incident_field {
}
}
if ($tabbed) {
$r->content_type('text/plain');
}
</%init>
<%args>
......
......@@ -54,7 +54,11 @@
</td>
</tr>
</table>
<& /Elements/Submit, Caption => loc("Generate the report"), Label => loc("Go")&>
<& /Elements/Submit, Caption => loc("Generate a delimited text report"),
Name => "TextReport",
Label => loc("Text")&>
<& /Elements/Submit, Caption => loc("Generate and HTML report"),
Label => loc("HTML")&>
</FORM>
<%INIT>
......
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