From 0452430dac4d639796581be77e8674207653f42b Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 9 Jun 2005 06:56:31 +0000 Subject: [PATCH] agent-specific logos for html invoices too --- FS/FS/cust_bill.pm | 11 ++++++++++- conf/invoice_html | 2 +- httemplate/view/cust_bill-logo.cgi | 11 ++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index a603310ae..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>", ; @@ -1760,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", ); diff --git a/conf/invoice_html b/conf/invoice_html index e4e145e41..32e5362f9 100644 --- a/conf/invoice_html +++ b/conf/invoice_html @@ -14,7 +14,7 @@ - +
">"> <%= $returnaddress %> diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi index 3e9c67fcc..50812ea10 100755 --- a/httemplate/view/cust_bill-logo.cgi +++ b/httemplate/view/cust_bill-logo.cgi @@ -1,12 +1,9 @@ <% -##untaint invnum -#my($query) = $cgi->keywords; -#$query =~ /^((.+)-)?(\d+)$/; -#my $templatename = $2; -#my $invnum = $3; - -my $templatename = ''; +my($query) = $cgi->keywords; +$query =~ /^([^\.\/]*)$/; +my $templatename = $1; +$templatename = "_$templatename" if $templatename; my $conf = new FS::Conf; http_header('Content-Type' => 'image/png' ); -- 2.11.0