summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-04-14 20:27:50 +0000
committerivan <ivan>2009-04-14 20:27:50 +0000
commita5bf104f1fb29ea6e3fa6993dd60069e3d2cfca7 (patch)
tree3c357b973ac5746975917333f10f4e386ad986bf
parent8c804ba59c8b284e1294e9928b5412fdf31e412c (diff)
don't hide old packages that have services, RT#5179
-rwxr-xr-xhttemplate/view/cust_main/packages.html9
1 files changed, 7 insertions, 2 deletions
diff --git a/httemplate/view/cust_main/packages.html b/httemplate/view/cust_main/packages.html
index d55560f34..0da82500a 100755
--- a/httemplate/view/cust_main/packages.html
+++ b/httemplate/view/cust_main/packages.html
@@ -177,8 +177,11 @@ sub get_packages {
join(', ', map "cust_pkg.$_", fields('cust_pkg') ). ', '.
join(', ', map "part_pkg.$_", fields('part_pkg') );
+ my $num_svcs = '( SELECT COUNT(*) FROM cust_svc '.
+ ' WHERE cust_svc.pkgnum = cust_pkg.pkgnum ) AS num_svcs';
+
my @packages = $cust_main->$method( {
- 'select' => "$cust_pkg_fields, $part_pkg_fields",
+ 'select' => "$cust_pkg_fields, $part_pkg_fields, $num_svcs",
'addl_from' => 'LEFT JOIN part_pkg USING ( pkgpart )',
} );
my $num_old_packages = scalar(@packages);
@@ -200,7 +203,9 @@ sub get_packages {
);
@packages =
- grep { !exists($hide{$_->status}) or $_->get($hide{$_->status}) > $then }
+ grep { !exists($hide{$_->status}) or $_->get($hide{$_->status}) > $then
+ or $_->num_svcs #don't hide packages w/services
+ }
@packages;
}