summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/cust_pkg.pm15
-rwxr-xr-xhttemplate/browse/part_pkg.cgi15
2 files changed, 21 insertions, 9 deletions
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index e4846ec34..e195ed87d 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -2221,6 +2221,7 @@ Returns an SQL expression identifying active packages.
sub active_sql { "
". $_[0]->recurring_sql(). "
+ AND cust_pkg.setup IS NOT NULL AND cust_pkg.setup != 0
AND ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 )
AND ( cust_pkg.susp IS NULL OR cust_pkg.susp = 0 )
"; }
@@ -2384,8 +2385,8 @@ sub search_sql {
push @where, FS::cust_pkg->active_sql();
- } elsif ( $params->{'magic'} eq 'not yet billed'
- || $params->{'status'} eq 'not yet billed' ) {
+ } elsif ( $params->{'magic'} =~ /^not[ _]yet[ _]billed$/
+ || $params->{'status'} =~ /^not[ _]yet[ _]billed$/ ) {
push @where, FS::cust_pkg->not_yet_billed_sql();
@@ -2419,7 +2420,7 @@ sub search_sql {
{
$classnum = $1;
if ( $classnum ) { #a specific class
- push @where, "classnum = $classnum";
+ push @where, "part_pkg.classnum = $classnum";
#@pkg_class = ( qsearchs('pkg_class', { 'classnum' => $classnum } ) );
#die "classnum $classnum not found!" unless $pkg_class[0];
@@ -2427,7 +2428,7 @@ sub search_sql {
} elsif ( $classnum eq '' ) { #the empty class
- push @where, "classnum IS NULL";
+ push @where, "part_pkg.classnum IS NULL";
#$title .= 'Empty class ';
#@pkg_class = ( '(empty class)' );
} elsif ( $classnum eq '0' ) {
@@ -2591,9 +2592,9 @@ sub search_sql {
my $extra_sql = scalar(@where) ? ' WHERE '. join(' AND ', @where) : '';
- my $addl_from = 'LEFT JOIN cust_main USING ( custnum ) '.
- 'LEFT JOIN part_pkg USING ( pkgpart ) '.
- 'LEFT JOIN pkg_class USING ( classnum ) ';
+ my $addl_from = 'LEFT JOIN part_pkg USING ( pkgpart ) '.
+ 'LEFT JOIN pkg_class USING ( classnum ) '.
+ 'LEFT JOIN cust_main USING ( custnum ) ';
my $count_query = "SELECT COUNT(*) FROM cust_pkg $addl_from $extra_sql";
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index c6cbb81a3..d9b90cf84 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -96,8 +96,15 @@ $select = "
*,
( $count_cust_pkg
+ AND ( setup IS NULL OR cancel = 0 )
AND ( cancel IS NULL OR cancel = 0 )
- AND ( susp IS NULL OR susp = 0 )
+ AND ( susp IS NULL OR susp = 0 )
+ ) AS num_not_yet_billed,
+
+ ( $count_cust_pkg
+ AND setup IS NOT NULL AND setup != 0
+ AND ( cancel IS NULL OR cancel = 0 )
+ AND ( susp IS NULL OR susp = 0 )
) AS num_active,
( $count_cust_pkg
@@ -283,6 +290,8 @@ if ( $acl_edit_global ) {
'cancelled' => 'FF0000',
#'one-time charge' => '000000',
'charge' => '000000',
+ #'not yet billed' => '000000',
+ 'not yet billed' => '000000',
);
my $cust_pkg_link = $p. 'search/cust_pkg.cgi?pkgpart=';
push @fields, sub { my $part_pkg = shift;
@@ -294,6 +303,8 @@ if ( $acl_edit_global ) {
$magic = 'inactive';
#$label = 'one-time charge',
$label = 'charge',
+ } else {
+ $label =~ s/_/ /g;
}
[
@@ -319,7 +330,7 @@ if ( $acl_edit_global ) {
),
},
],
- } (qw( active suspended cancelled ))
+ } qw(not_yet_billed active suspended cancelled)
]; };
$align .= 'r';
#}