75321ef82b772b947178ceccc8b50edf29cccef4
[freeside.git] / httemplate / view / cust_bill-logo.cgi
1 <% $conf->config_binary("logo$templatename.png", $agentnum) %>
2 <%init>
3
4 die "access denied"
5   unless $FS::CurrentUser::CurrentUser->access_right('View invoices')
6       or $FS::CurrentUser::CurrentUser->access_right('Configuration');
7
8 my $conf;
9
10 my $templatename;
11 my $agentnum = '';
12 if ( $cgi->param('invnum') ) {
13   $templatename = $cgi->param('template') || $cgi->param('templatename');
14   my $cust_bill = qsearchs('cust_bill', { 'invnum' => $cgi->param('invnum') } )
15     or die 'unknown invnum';
16   $conf = $cust_bill->conf;
17   $agentnum = $cust_bill->cust_main->agentnum;
18 } else {
19   my($query) = $cgi->keywords;
20   $query =~ /^([^\.\/]*)$/ or die 'illegal query';
21   $templatename = $1;
22 }
23
24 if ( $templatename && $conf->exists("logo_$templatename.png") ) {
25   $templatename = "_$templatename";
26 } else {
27   $templatename = '';
28 }
29
30 http_header('Content-Type' => 'image/png' );
31
32 </%init>