X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill_pkg_referral.html;h=1bc3b1038437327ca480cb08ec256f191680cdb0;hb=6f58ae775b905cd462dd0faafee95973414a45d2;hp=a39fa57f6cdb1802b6ba341188949fe5d2030cc2;hpb=33043da94faf7538a568b4064a511d35b4c7caf5;p=freeside.git diff --git a/httemplate/search/cust_bill_pkg_referral.html b/httemplate/search/cust_bill_pkg_referral.html index a39fa57f6..1bc3b1038 100644 --- a/httemplate/search/cust_bill_pkg_referral.html +++ b/httemplate/search/cust_bill_pkg_referral.html @@ -100,7 +100,7 @@ 'color' => [ ('') x (5 + $x), sub { my $cust_pkg = shift->cust_pkg; - $cust_pkg ? ucfirst($cust_pkg->statuscolor) : ''; + $cust_pkg ? $cust_pkg->statuscolor : ''; }, ('') x 6, ], @@ -133,7 +133,9 @@ my $agentnums_sql = my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); my @where = ( $agentnums_sql, - 'cust_bill_pkg.pkgnum != 0', # exclude taxes + # exclude taxes + '(cust_bill_pkg.pkgnum != 0 OR '. + 'cust_bill_pkg.feepart IS NOT NULL)', "cust_bill._date >= $beginning", "cust_bill._date <= $ending", ); @@ -187,11 +189,13 @@ if ( $cgi->param('classnum') =~ /^(\d+)$/ ) { if ( $use_override ) { push @where, "( - part_pkg.classnum $comparison AND pkgpart_override IS NULL OR - override.classnum $comparison AND pkgpart_override IS NOT NULL + (part_pkg.classnum $comparison AND pkgpart_override IS NULL) OR + (override.classnum $comparison AND pkgpart_override IS NOT NULL) OR + (part_fee.classnum $comparison AND feepart IS NOT NULL) )"; } else { - push @where, "part_pkg.classnum $comparison"; + push @where, + "(part_pkg.classnum $comparison) OR (part_fee.classnum $comparison)"; } } @@ -231,15 +235,19 @@ $join_pkg .= ' LEFT JOIN cust_pkg USING ( pkgnum ) LEFT JOIN part_pkg USING ( pkgpart ) LEFT JOIN part_pkg AS override ON pkgpart_override = override.pkgpart + LEFT JOIN part_fee USING ( feepart ) LEFT JOIN pkg_class ON '; #... if ( $use_override ) { # join to whichever pkgpart is appropriate $join_pkg .= ' ( pkgpart_override IS NULL AND part_pkg.classnum = pkg_class.classnum ) - OR ( pkgpart_override IS NOT NULL AND override.classnum = pkg_class.classnum )'; + OR ( pkgpart_override IS NOT NULL AND override.classnum = pkg_class.classnum ) + OR ( feepart IS NOT NULL AND part_fee.classnum = pkg_class.classnum )'; } else { - $join_pkg .= 'part_pkg.classnum = pkg_class.classnum'; + $join_pkg .= ' + ( part_pkg.classnum = pkg_class.classnum ) + OR ( part_fee.classnum = pkg_class.classnum )'; } my $where = ' WHERE '. join(' AND ', @where); @@ -261,7 +269,7 @@ my $last_pay_sql = "SELECT MAX(_date) FROM cust_bill_pay JOIN cust_bill_pay_pkg USING (billpaynum) WHERE cust_bill_pay_pkg.billpkgnum = cust_bill_pkg.billpkgnum"; -push @select, 'part_pkg.pkg', +push @select, 'COALESCE(part_pkg.pkg, part_fee.itemdesc) AS pkg', 'part_pkg.freq', 'cust_main.custnum', 'cust_main.first',