}
# used in several places
-my $itemdesc = 'COALESCE(part_fee.itemdesc, part_pkg.pkg, cust_bill_pkg.itemdesc)';
+my $itemdesc = 'COALESCE(cust_bill_pkg.itemdesc, part_fee.itemdesc, part_pkg.pkg, cust_bill_pkg.itemdesc)';
# valid in both the tax and non-tax cases
my $join_cust =
$part_pkg = 'override';
}
push @select, "$part_pkg.pkgpart", "$part_pkg.pkg";
+push @select, "($itemdesc) AS itemdesc"; # available in all report modes
+
push @select, "COALESCE($part_pkg.taxclass, part_fee.taxclass) AS taxclass"
if $conf->exists('enable_taxclasses');
# the non-tax case
if ( $cgi->param('nottax') ) {
- push @select, "($itemdesc) AS itemdesc";
-
push @where,
'(cust_bill_pkg.pkgnum > 0 OR cust_bill_pkg.feepart IS NOT NULL)';
}
}
- # classnum (of underlying package)
- # not specified: all classes
- # 0: empty class
- # N: classnum
- if ( grep { $_ eq 'classnum' } $cgi->param ) {
- my @classnums = grep /^\d+$/, $cgi->param('classnum');
- push @where, "COALESCE(part_fee.classnum, $part_pkg.classnum, 0) IN ( ".
- join(',', @classnums ).
- ' )'
- if @classnums;
- }
-
} # nottax / istax