[Bps-public-commit] r11387 - RT-Extension-Reports/html/Reports/Elements

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Apr 2 06:25:16 EDT 2008


Author: sunnavy
Date: Wed Apr  2 06:25:12 2008
New Revision: 11387

Modified:
   RT-Extension-Reports/html/Reports/Elements/ShowResults

Log:
out 'no data' if not found nothing

Modified: RT-Extension-Reports/html/Reports/Elements/ShowResults
==============================================================================
--- RT-Extension-Reports/html/Reports/Elements/ShowResults	(original)
+++ RT-Extension-Reports/html/Reports/Elements/ShowResults	Wed Apr  2 06:25:12 2008
@@ -63,15 +63,18 @@
 </table>
 
 <%INIT>
-for my $row ( @$Results ) {
-    $#$row = $#$Headers; # enlarge @$row to be the same size of @$Headers
+if ( @$Results ) {
+# we found something
 
-    for ( @$row ) {
-        $_ = 0 unless defined;  # 0 is better looking than undef, which is null
+    for my $row ( @$Results ) {
+        $#$row = $#$Headers; # enlarge @$row to be the same size of @$Headers
+    
+        for ( @$row ) {
+            $_ = 0 unless defined;  # 0 is better looking than undef, which is null
+        }
     }
-}
 
-if ( $Type eq 'csv' ) {
+    if ( $Type eq 'csv' ) {
         $r->content_type( 'text/csv' );
         $m->out( join ',', @$Headers );
         $m->out("\n");
@@ -80,8 +83,8 @@
             $m->out( "\n" );
         }
         $m->abort;
-}
-elsif ( $Type eq 'chart' ) {
+    }
+    elsif ( $Type eq 'chart' ) {
         $r->content_type( 'image/png' );
         require GD::Graph::bars;
         my $graph = GD::Graph::bars->new( 800, 600 );
@@ -96,6 +99,11 @@
         my $gd = $graph->plot(\@data) or die $graph->error;
         $m->out( $gd->png );
         $m->abort;
+    }
+}
+else {
+    $m->out( 'no data' );
+    $m->abort;
 }
 
 </%INIT>



More information about the Bps-public-commit mailing list