X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_svc.cgi;h=ef0de13cccd3c1d8bfd61d4100409eaff25dbf5a;hb=c13536bec93ca007d6b339dfbc7edc81ae58c082;hp=9fb359d1ddbf270c4efbcd19149e9dca1e6f7c67;hpb=6d02e527490b2f0cf080f7b519443caeecd76357;p=freeside.git
diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi
index 9fb359d1d..ef0de13cc 100755
--- a/httemplate/browse/part_svc.cgi
+++ b/httemplate/browse/part_svc.cgi
@@ -13,6 +13,20 @@ my @part_svc =
qsearch('part_svc', \%search );
my $total = scalar(@part_svc);
+my %num_active_cust_svc = ();
+if ( $cgi->param('active') ) {
+ my $active_sth = dbh->prepare(
+ 'SELECT COUNT(*) FROM cust_svc WHERE svcpart = ?'
+ ) or die dbh->errstr;
+ foreach my $part_svc ( @part_svc ) {
+ $active_sth->execute($part_svc->svcpart) or die $active_sth->errstr;
+ $num_active_cust_svc{$part_svc->svcpart} =
+ $active_sth->fetchrow_arrayref->[0];
+ }
+ @part_svc = sort { $num_active_cust_svc{$b->svcpart} <=>
+ $num_active_cust_svc{$a->svcpart} } @part_svc;
+}
+
%>
<%= header('Service Definition Listing', menubar( 'Main Menu' => $p) ) %>
@@ -23,16 +37,18 @@ function part_export_areyousure(href) {
}
- Services are items you offer to your customers.
+ Service definitions are the templates for items you offer to your customers.
-