X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill-logo.cgi;h=d55ec041ebf1a0bba7b0da0c7ba60c2dc74f2e7c;hb=822645aade15a4c4ac0558b116f7aacf9491002c;hp=a1c9ddcf631efa59a6192803743931db24933a1c;hpb=b3010f33ef9485271d34e43a8ed6f30094451397;p=freeside.git diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi index a1c9ddcf6..d55ec041e 100755 --- a/httemplate/view/cust_bill-logo.cgi +++ b/httemplate/view/cust_bill-logo.cgi @@ -1,12 +1,34 @@ -<% +<% $conf->config_binary("logo$templatename.png", $agentnum) %> +<%init> -my($query) = $cgi->keywords; -$query =~ /^([^\.\/]*)$/; -my $templatename = $1; -$templatename = "_$templatename" - if $templatename && $conf->exists("${logo}_$templatename.png"); +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('View invoices') + or $FS::CurrentUser::CurrentUser->access_right('Configuration'); -my $conf = new FS::Conf; +my $conf; + +my $templatename; +my $agentnum = ''; +if ( $cgi->param('invnum') ) { + $templatename = $cgi->param('template') || $cgi->param('templatename'); + my $cust_bill = qsearchs('cust_bill', { 'invnum' => $cgi->param('invnum') } ) + or die 'unknown invnum'; + $conf = $cust_bill->conf; + $agentnum = $cust_bill->cust_main->agentnum; +} else { + # assume the default config + $conf = FS::Conf->new; + my($query) = $cgi->keywords; + $query =~ /^([^\.\/]*)$/ or die 'illegal query'; + $templatename = $1; +} + +if ( $templatename && $conf->exists("logo_$templatename.png") ) { + $templatename = "_$templatename"; +} else { + $templatename = ''; +} http_header('Content-Type' => 'image/png' ); -%><%= $conf->config_binary("logo$templatename.png") %> + +