X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=7d104117f209a743f3ddf94cd1085aa4237dd2cd;hb=0452430dac4d639796581be77e8674207653f42b;hp=ed08ae79ad0b414b68d750def72f58ca9ac27d9a;hpb=bd37cef4d8a2930a7550efe857d354a790ffc65f;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index ed08ae79a..7d104117f 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -414,10 +414,18 @@ sub generate_email { $args{'from'} =~ /\@([\w\.\-]+)/ or $1 = 'example.com'; my $content_id = join('.', rand()*(2**32), $$, time). "\@$1"; + my $path = "$FS::UID::conf_dir/conf.$FS::UID::datasrc"; + my $file; + if ( [ -e "$path/logo_". $args{'_template'}. ".png" ] ) { + $file = "$path/logo_". $args{'_template'}. ".png"; + } else { + $file = "$path/logo.png"; + } + my $image = build MIME::Entity 'Type' => 'image/png', 'Encoding' => 'base64', - 'Path' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc/logo.png", + 'Path' => $file, 'Filename' => 'logo.png', 'Content-ID' => "<$content_id>", ; @@ -1017,7 +1025,9 @@ sub _agent_plandata { 'plan' => 'send_agent', 'plandata' => { 'op' => '~', 'value' => "(^|\n)agentnum ". + '([0-9]*, )*'. $self->cust_main->agentnum. + '(, [0-9]*)*'. "(\n|\$)", }, }, @@ -1336,7 +1346,7 @@ sub print_latex { } my $returnaddress; - if ( length($conf->config_orbase('invoice_latexreturnaddress', $template) ) { + if ( length($conf->config_orbase('invoice_latexreturnaddress', $template)) ) { $returnaddress = join("\n", $conf->config_orbase('invoice_latexreturnaddress', $template) ); @@ -1356,8 +1366,8 @@ sub print_latex { 'city' => _latex_escape($cust_main->city), 'state' => _latex_escape($cust_main->state), 'zip' => _latex_escape($cust_main->zip), - 'footer' => join("\n", $conf->config('invoice_latexfooter') ), - 'smallfooter' => join("\n", $conf->config('invoice_latexsmallfooter') ), + 'footer' => join("\n", $conf->config_orbase('invoice_latexfooter', $template) ), + 'smallfooter' => join("\n", $conf->config_orbase('invoice_latexsmallfooter', $template) ), 'returnaddress' => $returnaddress, 'quantity' => 1, 'terms' => $conf->config('invoice_default_terms') || 'Payable upon receipt', @@ -1758,6 +1768,7 @@ sub print_html { 'terms' => $conf->config('invoice_default_terms') || 'Payable upon receipt', 'cid' => $cid, + 'template' => $template, # 'conf_dir' => "$FS::UID::conf_dir/conf.$FS::UID::datasrc", ); @@ -1803,11 +1814,12 @@ sub print_html { # $conf->config_orbase('invoice_latexnotes', $suffix) # ); - $invoice_data{'footer'} = $conf->exists('invoice_htmlfooter') - ? join("\n", $conf->config('invoice_htmlfooter') ) - : join("\n", map { s/~/ /g; s/\\\\\*?\s*$/
/; $_; } - $conf->config('invoice_latexfooter') - ); + $invoice_data{'footer'} = + length($conf->config_orbase('invoice_htmlfooter', $template)) + ? join("\n", $conf->config_orbase('invoice_htmlfooter', $template) ) + : join("\n", map { s/~/ /g; s/\\\\\*?\s*$/
/; $_; } + $conf->config_orbase('invoice_latexfooter', $template) + ); $invoice_data{'po_line'} = ( $cust_main->payby eq 'BILL' && $cust_main->payinfo )