diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-19 01:46:57 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-10-19 01:46:57 +0000 |
commit | 36560b22c2b2cf9f56cb25256278932293b0a242 (patch) | |
tree | 910f4779d5b36a8204699d6f58b57ac6487c4794 /LedgerSMB/AM.pm | |
parent | 7dc5064179db1a67586a1c8caa037144989e6b59 (diff) |
Rearrange LSMB::Mailer a bit to make templating simpler
Adjust backup function to work with LSMB::M rearrangement
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1790 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/AM.pm')
-rw-r--r-- | LedgerSMB/AM.pm | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm index 4f063c56..34e22615 100644 --- a/LedgerSMB/AM.pm +++ b/LedgerSMB/AM.pm @@ -1656,6 +1656,7 @@ sub load_template { my ( $self, $myconfig, $form ) = @_; + $form->{file} ||= lc "$myconfig->{templates}/$form->{template}.$form->{format}"; $self->check_template_name( \%$myconfig, \%$form ); open( TEMPLATE, '<', "$form->{file}" ) or $form->error("$form->{file} : $!"); @@ -1679,6 +1680,7 @@ sub save_template { my ( $self, $myconfig, $form ) = @_; + $form->{file} ||= lc "$myconfig->{templates}/$form->{template}.$form->{format}"; $self->check_template_name( \%$myconfig, \%$form ); open( TEMPLATE, '>', "$form->{file}" ) or $form->error("$form->{file} : $!"); @@ -2093,25 +2095,36 @@ sub backup { # compress backup if gzip defined my $suffix = "c"; + ##SC: START Testing changes + $myconfig->{name} = "test"; + $myconfig->{email} = 'seneca@localhost'; + $myconfig->{dbport} = 5432; + $myconfig->{dbuser} = 'seneca'; + $myconfig->{dbhost} = 'localhost'; + $myconfig->{dbname} = 'ledgersmb-taxtest'; + ##SC: END Testing changes if ( $form->{media} eq 'email' ) { print OUT qx(PGPASSWORD="$myconfig->{dbpasswd}" pg_dump -U $myconfig->{dbuser} -h $myconfig->{dbhost} -Fc -p $myconfig->{dbport} $myconfig->{dbname}); close OUT; use LedgerSMB::Mailer; - $mail = new LedgerSMB::Mailer; - - $mail->{to} = qq|"$myconfig->{name}" <$myconfig->{email}>|; - $mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; - $mail->{subject} = -"LedgerSMB Backup / $globalDBname-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix"; - @{ $mail->{attachments} } = ($tmpfile); - $mail->{version} = $form->{version}; - $mail->{fileid} = "$boundary."; - $mail->{format} = "plain"; - $mail->{format} = "octet-stream"; - - $myconfig->{signature} =~ s/\\n/\n/g; - $mail->{message} = "-- \n$myconfig->{signature}"; + $mail = new LedgerSMB::Mailer( + to => qq|"$myconfig->{name}" <$myconfig->{email}>|, + from => qq|"$myconfig->{name}" <$myconfig->{email}>|, + subject => "LedgerSMB Backup / $globalDBname-$form->{dbversion}-$t[5]$t[4]$t[3].sql$suffix", + message => qq| +This PostgreSQL backup can be restored using the pg_restore command. + +-- +LedgerSMB|, + ); + + $mail->attach( + 'file' => $tmpfile, + 'filename' => $tmpfile, + 'strip' => "$boundary.", + 'mimetype' => 'application/octet-stream', + ); $err = $mail->send; } |