X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_svc.cgi;h=ef0de13cccd3c1d8bfd61d4100409eaff25dbf5a;hp=7c83924a2be72a3bf393f86e5b064854bc929b5a;hb=b377b1408398c471689e35dabb1bf14ef263a644;hpb=0ebeec96313dd7edfca340f01f8fbbbac1f4aa1d diff --git a/httemplate/browse/part_svc.cgi b/httemplate/browse/part_svc.cgi index 7c83924a2..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) ) %> @@ -45,6 +59,9 @@ function part_export_areyousure(href) { param('showdisabled') ? 2 : 3 %>>Service Table +<% if ( $cgi->param('active') ) { %> + Customer
Services
+<% } %> Export Field Modifier @@ -53,12 +70,13 @@ function part_export_areyousure(href) { <% foreach my $part_svc ( @part_svc ) { my $hashref = $part_svc->hashref; my $svcdb = $hashref->{svcdb}; - my @dfields = fields($svcdb); + my $svc_x = "FS::$svcdb"->new( { svcpart => $part_svc->svcpart } ); + my @dfields = $svc_x->fields; push @dfields, 'usergroup' if $svcdb eq 'svc_acct'; #kludge my @fields = - grep { $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } - @dfields; - + grep { $svc_x->pvf($_) + or $_ ne 'svcnum' && $part_svc->part_svc_column($_)->columnflag } + @dfields ; my $rowspan = scalar(@fields) || 1; my $url = "${p}edit/part_svc.cgi?$hashref->{svcpart}"; %> @@ -74,6 +92,11 @@ function part_export_areyousure(href) { <%= $hashref->{svc} %> > <%= $hashref->{svcdb} %> +<% if ( $cgi->param('active') ) { %> + > + <%= $num_active_cust_svc{$hashref->{svcpart}} %> active + +<% } %> ><%= itable() %> <% # my @part_export = @@ -96,6 +119,7 @@ map { qsearchs('part_export', { exportnum => $_->exportnum } ) } qsearch('export <% if ( $flag eq "D" ) { print "Default"; } elsif ( $flag eq "F" ) { print "Fixed"; } + elsif ( not $flag ) { } else { print "(Unknown!)"; } %> <%= $part_svc->part_svc_column($field)->columnvalue%>