diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/cust_bill.pm | 23 |
2 files changed, 30 insertions, 0 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index c36ce5ee5..4a1760fd1 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -698,6 +698,13 @@ worry that config_items is freeside-specific and icky. }, { + 'key' => 'invoice_latexcoupon', + 'section' => 'billing', + 'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.', + 'type' => 'textarea', + }, + + { 'key' => 'invoice_latexreturnaddress', 'section' => 'billing', 'description' => 'Return address for LaTeX typeset PostScript invoices.', diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 35daea726..db811c50b 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1810,6 +1810,7 @@ sub print_latex { 'terms' => $conf->config('invoice_default_terms') || 'Payable upon receipt', #'notes' => join("\n", $conf->config('invoice_latexnotes') ), 'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc", + 'balance' => $balance_due, ); my $countrydefault = $conf->config('countrydefault') || 'US'; @@ -1828,6 +1829,28 @@ sub print_latex { warn "invoice notes: ". $invoice_data{'notes'}. "\n" if $DEBUG; + #do variable substitution in coupon + foreach my $include (qw( coupon )) { + + my @inc_src = $conf->config_orbase("invoice_latex$include", $template); + + my $inc_tt = new Text::Template ( + TYPE => 'ARRAY', + SOURCE => [ map "$_\n", @inc_src ], + DELIMITERS => [ '[@--', '--@]' ], + ) or die "Can't create new Text::Template object: $Text::Template::ERROR"; + + unless ( $inc_tt->compile() ) { + my $error = "Can't compile $include template: $Text::Template::ERROR\n"; + warn $error. "Template:\n". join('', map "$_\n", @inc_src); + die $error; + } + + $invoice_data{$include} = $inc_tt->fill_in( HASH => \%invoice_data ); + + $invoice_data{$include} =~ s/\n+$// + } + $invoice_data{'footer'} =~ s/\n+$//; $invoice_data{'smallfooter'} =~ s/\n+$//; $invoice_data{'notes'} =~ s/\n+$//; |