Release for 3.2.0. Changes since 3.2.0beta1:
[BackupPC.git] / lib / BackupPC / CGI / EmailSummary.pm
index 4871136..12ba6ee 100644 (file)
@@ -10,7 +10,7 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2003  Craig Barratt
+#   Copyright (C) 2003-2009  Craig Barratt
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.2.0, released 31 Jul 2010.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -50,14 +50,32 @@ sub action
     ReadUserEmailInfo();
     my(%EmailStr, $str);
     foreach my $u ( keys(%UserEmailInfo) ) {
-        next if ( !defined($UserEmailInfo{$u}{lastTime}) );
-        my $emailTimeStr = timeStamp2($UserEmailInfo{$u}{lastTime});
-        $EmailStr{$UserEmailInfo{$u}{lastTime}} .= <<EOF;
+        my $info;
+        if ( defined($UserEmailInfo{$u}{lastTime})
+                && ref($UserEmailInfo{$u}{lastTime}) ne 'HASH' ) {
+            #
+            # old format $UserEmailInfo - pre 3.2.0.
+            #
+            my $host = $UserEmailInfo{$u}{lastHost};
+            $info = {
+                $host => {
+                    lastTime => $UserEmailInfo{$u}{lastTime},
+                    lastSubj => $UserEmailInfo{$u}{lastSubj},
+                },
+            };
+        } else {
+            $info = $UserEmailInfo{$u};
+        }
+        foreach my $host ( keys(%$info) ) {
+            next if ( !defined($info->{$host}{lastTime}) );
+            my $emailTimeStr = timeStamp2($info->{$host}{lastTime});
+            $EmailStr{$info->{$host}{lastTime}} .= <<EOF;
 <tr><td>${UserLink($u)} </td>
-    <td>${HostLink($UserEmailInfo{$u}{lastHost})} </td>
+    <td>${HostLink($host)} </td>
     <td>$emailTimeStr </td>
-    <td>$UserEmailInfo{$u}{lastSubj} </td></tr>
+    <td>$info->{$host}{lastSubj} </td></tr>
 EOF
+        }
     }
     foreach my $t ( sort({$b <=> $a} keys(%EmailStr)) ) {
         $str .= $EmailStr{$t};