X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_bill-logo.cgi;h=dc8b674ecf69d3ef2aa9702fe0badfc2cfb589e0;hb=ee17093f5b41c1544d00a2670d26794aee33077a;hp=75321ef82b772b947178ceccc8b50edf29cccef4;hpb=62b12e8b09608b7081ffd596be899fafb5c2403f;p=freeside.git diff --git a/httemplate/view/cust_bill-logo.cgi b/httemplate/view/cust_bill-logo.cgi index 75321ef82..dc8b674ec 100755 --- a/httemplate/view/cust_bill-logo.cgi +++ b/httemplate/view/cust_bill-logo.cgi @@ -9,13 +9,17 @@ 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;