From: ivan Date: Tue, 14 Apr 2009 20:27:50 +0000 (+0000) Subject: don't hide old packages that have services, RT#5179 X-Git-Tag: root_of_svc_elec_features~1274 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=a5bf104f1fb29ea6e3fa6993dd60069e3d2cfca7 don't hide old packages that have services, RT#5179 --- 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; }