[Bps-public-commit] r19667 - in RT-Extension-SLA/html: Callbacks/RT-Extension-SLA/Ticket/Elements/Tabs

ruz at bestpractical.com ruz at bestpractical.com
Thu May 14 10:27:45 EDT 2009


Author: ruz
Date: Thu May 14 10:27:44 2009
New Revision: 19667

Added:
   RT-Extension-SLA/html/Ticket/
   RT-Extension-SLA/html/Ticket/SLA.html
Modified:
   RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Ticket/Elements/Tabs/Default

Log:
* add report per ticket for debugging and analysis

Modified: RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Ticket/Elements/Tabs/Default
==============================================================================
--- RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Ticket/Elements/Tabs/Default	(original)
+++ RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Ticket/Elements/Tabs/Default	Thu May 14 10:27:44 2009
@@ -1,15 +1,24 @@
 <%ARGS>
 $Query => undef
 $tabs => {}
+$Ticket => undef
 </%ARGS>
 <%INIT>
 
-$Query ||= $session{'CurrentSearchHash'}->{'Query'};
+return unless $session{'CurrentUser'}->PrincipalObj->HasRight(
+        Object => $RT::System, Right => 'SeeSLAReports',
+);
 
-return unless $Query;
-
-$tabs->{"m"} = {
-    path  => "Tools/Reports/SLA.html?". $m->comp( '/Elements/QueryString', Query => $Query ),
-    title => loc('Report SLA'),
-};
+if ( $Ticket ) {
+    $tabs->{'this'}->{"subtabs"}->{'_DA'} = {
+        path  => "Ticket/SLA.html?id=". $Ticket->id,
+        title => loc('Report SLA'),
+    };
+}
+elsif ( $Query ||= $session{'CurrentSearchHash'}->{'Query'} ) {
+    $tabs->{"m"} = {
+        path  => "Tools/Reports/SLA.html?". $m->comp( '/Elements/QueryString', Query => $Query ),
+        title => loc('Report SLA'),
+    };
+}
 </%INIT>

Added: RT-Extension-SLA/html/Ticket/SLA.html
==============================================================================
--- (empty file)
+++ RT-Extension-SLA/html/Ticket/SLA.html	Thu May 14 10:27:44 2009
@@ -0,0 +1,46 @@
+<& /Elements/Header, Title => $title &>
+<& /Ticket/Elements/Tabs, 
+    Ticket => $ticket,
+    current_tab => "Ticket/SLA.html?id=$id",
+    Title => $title,
+&>
+
+<table>
+<tr><th>#</th><th>Description</th><th>Type</th><th>Owner</th><th>Failed</th><th>Shift</th></tr>
+% foreach my $stat ( @{ $report->Stats } ) {
+<tr>
+<td><% $stat->{transaction}->id %></td>
+<td><% $stat->{transaction}->Description %></td>
+<td><% $stat->{owner_act}? 'yes' : 'no' %></td>
+<td><% $stat->{failed}? 'yes' : 'no' %></td>
+<td><% $stat->{shift} %></td>
+</tr>
+% }
+</table>
+
+<%ARGS>
+$id => undef
+</%ARGS>
+<%INIT>
+
+unless (
+    $session{'CurrentUser'}->PrincipalObj->HasRight(
+        Object => $RT::System, Right => 'SeeSLAReports',
+    )
+) {
+    Abort("You're not allowed to see SLA reports.");
+}
+
+my $ticket = LoadTicket($id);
+unless ($ticket->CurrentUserHasRight('ShowTicket')) {
+    Abort("No permission to view ticket");
+}
+$id = $ARGS{'id'} = $ticket->id;
+
+my $title = loc("SLA performance on ticket #[_1]", $id);
+
+use RT::Extension::SLA;
+my $report = RT::Extension::SLA->Report( $ticket );
+use Data::Dumper;
+$RT::Logger->crit( Dumper $report );
+</%INIT>



More information about the Bps-public-commit mailing list