X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill_pkg.cgi;h=0c5fbd211b2795da507e40aefd000ccf90be75d3;hb=65acf1fd9746f1dd98e061044657c185367f7903;hp=4c0fa4a561216272d64c0e590a7c45ef7c40b8cc;hpb=3185fe4edea62dd3fa9818cf80902e96fe2a2d21;p=freeside.git diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 4c0fa4a56..0c5fbd211 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -200,26 +200,31 @@ if ( $cgi->param('refnum') =~ /^(\d+)$/ ) { push @where, "cust_main.refnum = $1"; } -# the non-tax case -if ( $cgi->param('nottax') ) { - - push @where, 'cust_bill_pkg.pkgnum > 0'; +# custnum +if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + push @where, "cust_main.custnum = $1"; +} - # then we want the package and its definition - $join_pkg = +# then we want the package and its definition +$join_pkg = ' LEFT JOIN cust_pkg USING (pkgnum) LEFT JOIN part_pkg USING (pkgpart)'; - my $part_pkg = 'part_pkg'; - if ( $cgi->param('use_override') ) { - # still need the real part_pkg for tax applicability, - # so alias this one - $join_pkg .= " LEFT JOIN part_pkg AS override ON ( - COALESCE(cust_bill_pkg.pkgpart_override, cust_pkg.pkgpart, 0) = part_pkg.pkgpart - )"; - $part_pkg = 'override'; - } - push @select, 'part_pkg.pkg'; # or should this use override? +my $part_pkg = 'part_pkg'; +if ( $cgi->param('use_override') ) { + # still need the real part_pkg for tax applicability, + # so alias this one + $join_pkg .= " LEFT JOIN part_pkg AS override ON ( + COALESCE(cust_bill_pkg.pkgpart_override, cust_pkg.pkgpart, 0) = part_pkg.pkgpart + )"; + $part_pkg = 'override'; +} +push @select, 'part_pkg.pkg'; # or should this use override? + +# the non-tax case +if ( $cgi->param('nottax') ) { + + push @where, 'cust_bill_pkg.pkgnum > 0'; my @tax_where; # will go into a subquery my @exempt_where; # will also go into a subquery