From a5bf104f1fb29ea6e3fa6993dd60069e3d2cfca7 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 14 Apr 2009 20:27:50 +0000 Subject: [PATCH] don't hide old packages that have services, RT#5179 --- httemplate/view/cust_main/packages.html | 9 +++++++-- 1 file 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; } -- 2.11.0