X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_pkg.cgi;h=c2f6272c4ef10e2d8a72fe9f5b3a8e16b5f7b06b;hp=3c3e178645a4c7299abc54f2f9ec361b8ebadce0;hb=abc64a997eeacdc95988296889754d708aa97cad;hpb=9617ce4b230c7dc56b4fa4a50d805ddaef87d090 diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi index 3c3e17864..c2f6272c4 100755 --- a/httemplate/search/cust_pkg.cgi +++ b/httemplate/search/cust_pkg.cgi @@ -35,6 +35,12 @@ if ( $cgi->param('magic') && $cgi->param('magic') eq 'bill' ) { $range .= ( $range ? 'AND ' : ' WHERE ' ). '( cancel IS NULL OR cancel = 0 )'; + if ( $cgi->param('agentnum') =~ /^(\d+)$/ and $1 ) { + $range .= ( $range ? 'AND ' : ' WHERE ' ). + "$1 = ( SELECT agentnum FROM cust_main". + " WHERE cust_main.custnum = cust_pkg.custnum )"; + } + #false laziness with below my $statement = "SELECT COUNT(*) FROM cust_pkg $range"; warn $statement;