summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--UI/rp-aging.csv22
-rw-r--r--bin/rp.pl41
2 files changed, 55 insertions, 8 deletions
diff --git a/UI/rp-aging.csv b/UI/rp-aging.csv
new file mode 100644
index 00000000..c18d7620
--- /dev/null
+++ b/UI/rp-aging.csv
@@ -0,0 +1,22 @@
+<?lsmb FOREACH column IN columns;
+ IF heading.$column.text.defined;
+ heading.$column.text;
+ ELSE;
+ heading.$column;
+ END ?>,<?lsmb END; escape(text('Currency')) ?>
+<?lsmb FOREACH currency IN currencies;
+ FOREACH row IN currency.rows;
+ FOREACH column IN columns;
+ IF row.$column.text.defined;
+ row.$column.text;
+ ELSE;
+ row.$column;
+ END ?>,<?lsmb
+ END; currency.curr ?>
+<?lsmb END;
+ IF currency.totals;
+ FOREACH column IN columns;
+ currency.totals.$column ?>,<?lsmb
+ END ?>,<?lsmb currency.curr;
+ END;
+END ?>
diff --git a/bin/rp.pl b/bin/rp.pl
index 9bb230d9..406d864f 100644
--- a/bin/rp.pl
+++ b/bin/rp.pl
@@ -1470,6 +1470,8 @@ qq|$form->{script}?path=$form->{path}&action=generate_ar_aging&login=$form->{log
}
+sub csv_generate_ar_aging { &generate_ar_aging }
+
sub generate_ap_aging {
# split vendor
@@ -1824,11 +1826,12 @@ qq|$ref->{module}.pl?path=$form->{path}&action=edit&id=$ref->{id}&login=$form->{
};
}
my $format;
- if ($form->{action} eq 'continue') {
+ if ($form->{action} =~ /^(continue|generate_)/) {
$format = 'HTML';
} else {
$format = uc substr $form->{action}, 0, 3;
- push @column_index, 'class';
+ push @column_index, 'class';
+ @column_index = grep {!/^(language|statement)$/} @column_index;
$column_header{class} = 'rowtype';
}
my $template = LedgerSMB::Template->new(
@@ -1882,7 +1885,7 @@ sub print_options {
if ( $form->{media} eq 'email' ) {
$form->{print}{medium} = {name => 'sendmode', default_values => $form->{sendmode}};
- push @media, {text => $locale->text('Attachement'), value => 'attachement'};
+ push @media, {text => $locale->text('Attachment'), value => 'attachment'};
push @media, {text => $locale->text('In-line'), value => 'inline'};
if ($form->{SM}{attachment}) {
$form->{print}{medium}{default_values} = $form->{SM}{attachment};
@@ -1972,20 +1975,42 @@ sub e_mail {
sub send_email {
- $form->{OUT} = "${LedgerSMB::Sysconfig::sendmail}";
- $form->{printmode} = '|-';
-
$form->{subject} = $locale->text( 'Statement - [_1]', $form->{todate} )
unless $form->{subject};
$form->isblank( "email", $locale->text('E-mail address missing!') );
- RP->aging( \%myconfig, \%$form );
+ RP->aging( \%myconfig, $form );
- &print_form;
+ my $data = &print_form;
+ delete $form->{header};
+ my $template = LedgerSMB::Template->new(
+ user => \%myconfig,
+ template => $form->{'formname'} || $form->{'type'},
+ format => uc $form->{format},
+ method => 'email',
+ output_options => {
+ to => $form->{email},
+ cc => $form->{cc},
+ bcc => $form->{bcc},
+ from => $form->{form},
+ subject => $form->{subject},
+ message => $form->{message},
+ notify => $form->{read_receipt},
+ attach => ($form->{sendmode} eq 'attachment')? 1: 0,
+ },
+ );
+ try {
+ $template->render({data => [$data]});
+ }
+ catch Error::Simple with {
+ my $E = shift;
+ $form->error( $E->stacktrace );
+ };
$form->redirect(
$locale->text( 'Statement sent to [_1]', $form->{ $form->{ct} } ) );
+ exit;
}
sub print {