X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill-logo.cgi;h=dc8b674ecf69d3ef2aa9702fe0badfc2cfb589e0;hb=d54644e17fc84f3853ca020ae68605e7900855fb;hp=ad2ff5430937d586e041e487e2c3ebbb7e5d5caa;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2;p=freeside.git diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi index ad2ff5430..dc8b674ec 100755 --- a/httemplate/view/cust_bill-logo.cgi +++ b/httemplate/view/cust_bill-logo.cgi @@ -5,16 +5,21 @@ 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') ) { +if ( $cgi->param('invnum') =~ /^(\d+)$/ ) { + my $invnum = $1; $templatename = $cgi->param('template') || $cgi->param('templatename'); - my $cust_bill = qsearchs('cust_bill', { 'invnum' => $cgi->param('invnum') } ) - or die 'unknown invnum'; + my $cust_bill = FS::cust_bill->by_key($invnum) + || FS::cust_bill_void->by_key($invnum); + die 'unknown invnum' unless $cust_bill; + $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;