[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[4076] branches/1.3



Revision: 4076
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4076&view=rev
Author:   einhverfr
Date:     2011-11-25 12:39:18 +0000 (Fri, 25 Nov 2011)
Log Message:
-----------
backup utility working

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/Database.pm
    branches/1.3/scripts/file.pl
    branches/1.3/scripts/setup.pl

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2011-11-25 11:44:40 UTC (rev 4075)
+++ branches/1.3/Changelog	2011-11-25 12:39:18 UTC (rev 4076)
@@ -18,6 +18,7 @@
 * Corrected permissions issue for editing assembly (Chris T)
 * Database administration interface more consistent (Chris T)
 * Backup functionality moved to database administration interface (Chris T)
+* Default language handling for invoices (Herman V)
 
 Changelog for LedgerSMB 1.3.6
 * Including xelatex templates under directory templates/xedemo (Chris T)

Modified: branches/1.3/LedgerSMB/Database.pm
===================================================================
--- branches/1.3/LedgerSMB/Database.pm	2011-11-25 11:44:40 UTC (rev 4075)
+++ branches/1.3/LedgerSMB/Database.pm	2011-11-25 12:39:18 UTC (rev 4076)
@@ -99,12 +99,12 @@
     $t[5] += 1900;
     $t[3] = substr( "0$t[3]", -2 );
     $t[4] = substr( "0$t[4]", -2 );
-    my $date = "$5-$4-$3";
+    my $date = "$t[5]-$t[4]-$t[3]";
 
     my $backupfile = $LedgerSMB::Sysconfig::backuppath .
                      "/roles_${date}.sql";
 
-    system("pgdumpall -r -f '$backupfile'") || $self->error('Backup failed');
+    system("pg_dumpall -r -f $backupfile");
 
     $ENV{PGUSER} = $old_pguser;
     $ENV{PGPASSWORD} = $old_pgpass;
@@ -138,13 +138,12 @@
     $t[5] += 1900;
     $t[3] = substr( "0$t[3]", -2 );
     $t[4] = substr( "0$t[4]", -2 );
-    my $date = "$5-$4-$3";
+    my $date = "$t[5]-$t[4]-$t[3]";
 
     my $backupfile = $LedgerSMB::Sysconfig::backuppath .
-                     "/backup_$self->{company_name}_${date}.sql";
+                     "/backup_$self->{company_name}_${date}.bak";
 
-    system("pgdump -d '$self->{company_name}' -F c -f '$backupfile'") 
-                  || $self->error('Backup failed');
+    system("pg_dump  -F c -f '$backupfile' '$self->{company_name}'");
 
     $ENV{PGUSER} = $old_pguser;
     $ENV{PGPASSWORD} = $old_pgpass;

Modified: branches/1.3/scripts/file.pl
===================================================================
--- branches/1.3/scripts/file.pl	2011-11-25 11:44:40 UTC (rev 4075)
+++ branches/1.3/scripts/file.pl	2011-11-25 12:39:18 UTC (rev 4076)
@@ -55,6 +55,9 @@
           -charset    => 'utf-8',
           -attachment => $file->file_name,
     );
+    print $file->content;
+
+    exit;
 }
 
 =item show_attachment_screen

Modified: branches/1.3/scripts/setup.pl
===================================================================
--- branches/1.3/scripts/setup.pl	2011-11-25 11:44:40 UTC (rev 4075)
+++ branches/1.3/scripts/setup.pl	2011-11-25 12:39:18 UTC (rev 4076)
@@ -50,7 +50,7 @@
         $request->error($request->{_locale}->text('No database specified'));
     }
     my $database = LedgerSMB::Database->new(
-               {username => $creds->{username},
+               {username => $creds->{login},
             company_name => $request->{database},
                 password => $creds->{password}}
     );
@@ -173,8 +173,9 @@
 
     my $creds = LedgerSMB::Auth::get_credentials();
     my $request = shift @_;
+
     my $database = LedgerSMB::Database->new(
-               {username => $creds->{username},
+               {username => $creds->{login},
             company_name => $request->{database},
                 password => $creds->{password}}
     );
@@ -209,12 +210,18 @@
     } elsif ($request->{backup_type} eq 'browser'){
         open BAK, '<', $backupfile;
         my $cgi = CGI::Simple->new();
+        $backupfile =~ s/$LedgerSMB::Sysconfig::backuppath(\/)?//;
         print $cgi->header(
           -type       => $mimetype,
           -status     => '200',
           -charset    => 'utf-8',
           -attachment => $backupfile,
         );
+        my $data;
+        while (read(BAK, $data, 1024 * 1024)){ # Read 1MB at a time
+            print $data;
+        }
+        exit;
     } else {
         $request->error($request->{_locale}->text("Don't know what to do with backup"));
     }
@@ -238,7 +245,7 @@
     my ($request) = @_;
     my $creds = LedgerSMB::Auth::get_credentials();
     my $database = LedgerSMB::Database->new(
-               {username => $creds->{username},
+               {username => $creds->{login},
             company_name => $request->{database},
                 password => $creds->{password}}
     );
@@ -254,7 +261,7 @@
     my ($request) = @_;
     my $creds = LedgerSMB::Auth::get_credentials();
     my $database = LedgerSMB::Database->new(
-               {username => $creds->{username},
+               {username => $creds->{login},
             company_name => $request->{database},
                 password => $creds->{password}}
     );
@@ -651,7 +658,7 @@
     my ($request) = @_;
     my $creds = LedgerSMB::Auth::get_credentials();
     my $database = LedgerSMB::Database->new(
-               {username => $creds->{username},
+               {username => $creds->{login},
             company_name => $request->{database},
                 password => $creds->{password}}
     );
@@ -737,7 +744,7 @@
     my ($request) = @_;
     my $creds = LedgerSMB::Auth::get_credentials();
     my $database = LedgerSMB::Database->new(
-               {username => $creds->{username},
+               {username => $creds->{login},
             company_name => $request->{database},
                 password => $creds->{password}}
     );

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.