r8441@llin: dpavlin | 2005-10-10 15:54:14 +0200
authordpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Mon, 10 Oct 2005 13:57:29 +0000 (13:57 +0000)
committerdpavlin <dpavlin@8392b6e1-25fa-0310-8288-cc32f8e212ea>
Mon, 10 Oct 2005 13:57:29 +0000 (13:57 +0000)
 update total_size in archives

git-svn-id: svn+ssh://llin/home/dpavlin/private/svn/BackupPC/trunk@164 8392b6e1-25fa-0310-8288-cc32f8e212ea

lib/BackupPC/CGI/BurnMedia.pm

index 9934775..18d63a3 100644 (file)
@@ -47,10 +47,7 @@ EOF
                        }
                }
 
-               # convert to Kb
-               $total_size = $total_size / 1024;
-
-               if ($total_size > $Conf{MaxArchiveSize}) {
+               if (($total_size / 1024) > $Conf{MaxArchiveSize}) {
                        $cont .= eval( q{ ${h2(Error)}});
                        $cont .= "Selected backups size $total_size exceed max archive size $Conf{MaxArchiveSize}.";
                } else {
@@ -62,18 +59,20 @@ EOF
                                                                dvd_nr,
                                                                note,
                                                                username,
-                                                               date
+                                                               date,
+                                                               total_size
                                                        ) VALUES (
                                                                nextVal('archive_id_seq'),
                                                                nextVal('dvd_nr'),
                                                                ?,
                                                                ?,
-                                                               NOW()
+                                                               NOW(),
+                                                               ?
                                                        )
                                                });
 
                        # FIXME insert user here
-                       $sth->execute($In{'note'}, 'dummy_user');
+                       $sth->execute($In{'note'}, 'dummy_user', $total_size);
 
                        foreach my $backup_id (@selected_backup_ids) {
 
@@ -104,7 +103,7 @@ EOF
                                Archived following backups:
                        } . join(", ", @selected_backup_ids) . q{
                                <br/>with total size of
-                       <b>} . sprintf("%1.2f Mb", $total_size / 1024) . q{</b>
+                       <b>} . sprintf("%1.2f Mb", $total_size / 1024 / 1024) . q{</b>
                                to media <b>} . $dvd_nr . q{</b>
                                with following message:
                                <div style="background-color: #e0e0e0; display: inline; padding: 2px;">