X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fmsg_template.pm;h=9c2b2844d78d19695a1f457e5bffbf860ddc842b;hb=249f7d6cf45f8df5679ac36fc28dd8376e695496;hp=bc21e653b0fe93601aca1cc6ceb4f5d07661dd00;hpb=0ba73dcbc4642efebac09fba8b18f0dfad675de2;p=freeside.git diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index bc21e653b..9c2b2844d 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -397,8 +397,7 @@ sub prepare { $from_addr = scalar( $conf->config($opt{'from_config'}, $cust_main->agentnum) ); } - $from_addr ||= scalar( $conf->config('invoice_from', - $cust_main->agentnum) ); + $from_addr ||= $conf->invoice_from_full($cust_main->agentnum); } # my @cust_msg = (); # if ( $conf->exists('log_sent_mail') and !$opt{'preview'} ) { @@ -463,9 +462,11 @@ sub render { # Graphics/stylesheets should probably go in /var/www on the Freeside # machine. + my $script_path = `/usr/bin/which freeside-wkhtmltopdf`; + chomp $script_path; my $kit = PDF::WebKit->new(\$html); #%options # hack to use our wrapper script - $kit->configure(sub { shift->wkhtmltopdf('freeside-wkhtmltopdf') }); + $kit->configure(sub { shift->wkhtmltopdf($script_path) }); $kit->to_pdf; } @@ -597,7 +598,9 @@ sub substitutions { _date _date_pretty due_date - )], + ), + [ due_date2str => sub { shift->due_date2str('short') } ], + ], #XXX not really thinking about cust_bill substitutions quite yet # for welcome and limit warning messages @@ -657,6 +660,18 @@ sub substitutions { $cust_pay->paymask : $cust_pay->decrypt($cust_pay->payinfo) } ], ], + # for refund receipts + 'cust_refund' => [ + 'refundnum', + [ refund => sub { sprintf("%.2f", shift->refund) } ], + [ payby => sub { FS::payby->shortname(shift->payby) } ], + [ date => sub { time2str("%a %B %o, %Y", shift->_date) } ], + [ payinfo => sub { + my $cust_refund = shift; + ($cust_refund->payby eq 'CARD' || $cust_refund->payby eq 'CHEK') ? + $cust_refund->paymask : $cust_refund->decrypt($cust_refund->payinfo) + } ], + ], # for payment decline messages # try to support all cust_pay fields # 'error' is a special case, it contains the raw error from the gateway