From 889447f8110554c681503a1b5e7bb983af332f65 Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Fri, 12 Dec 2014 13:10:01 +0000
Subject: [PATCH] Bug 13448: Make Striping gmail/hotmail compatible

This patch inlines the css to stripe a html output report
---
 misc/cronjobs/runreport.pl |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/misc/cronjobs/runreport.pl b/misc/cronjobs/runreport.pl
index 99bd22f..d91038b 100755
--- a/misc/cronjobs/runreport.pl
+++ b/misc/cronjobs/runreport.pl
@@ -245,9 +245,14 @@ foreach my $report_id (@ARGV) {
     if ($format eq 'html') {
         my $cgi = CGI->new();
         my @rows = ();
+        my $count = 0;
         while (my $line = $sth->fetchrow_arrayref) {
             foreach (@$line) { defined($_) or $_ = ''; }    # catch undef values, replace w/ ''
-            push @rows, $cgi->TR( join('', $cgi->td($line)) ) . "\n";
+            if ($count++ % 2 == 0) {
+                push @rows, $cgi->TR({-style=>'background-color: #ccc;'}, join('', $cgi->td($line)) ) . "\n";
+            } else {
+                push @rows, $cgi->TR( join('', $cgi->td($line)) ) . "\n";
+            }
         }
         $message = $cgi->table(join "", @rows);
     } elsif ($format eq 'csv') {
@@ -270,7 +275,6 @@ foreach my $report_id (@ARGV) {
         my $email = Koha::Email->new();
         my %mail;
         if ($format eq 'html') {
-                $message = "<html><head><style>tr:nth-child(2n+1) { background-color: #ccc;}</style></head><body>$message</body></html>";
            %mail = $email->create_message_headers({
               to      => $to,
               from    => $from,
-- 
1.7.10.4