-% foreach my $svc ( $cust_pkg->cust_svc ) {
-% push @{ $cust_svc_by_svcpart{$svc->svcpart} ||= [] }, $svc;
-% }
-% push @all_cust_svc, \%cust_svc_by_svcpart;
-% if ( !keys %cust_svc_by_svcpart ) {
-% # no services
-% push @pkg_rowspans, 1;
-% }
-% else {
-% my $rows = 0;
-% foreach (values %cust_svc_by_svcpart) {
-% # summarizing takes two rows per svcpart,
-% # full display takes one per cust_svc
-% $rows += ( $large_pkg_size > 0 && $large_pkg_size <= scalar @$_ ) ?
-% 2 : scalar @$_;
+% my $rows = 0;
+% #local($FS::part_pkg::cache_enabled) = 1; #for $cust_pkg->part_svc
+% local($FS::cust_svc::cache_enabled) = 1; #for $cust_svc->part_svc
+% #local($FS::pkg_svc::cache_enabled) = 1; #for $pkg_svc->part_svc
+% foreach my $part_svc (
+% #$cust_pkg->part_svc( summarize_size=>$large_pkg_size )
+% qsearch({
+% 'select' => 'part_svc.*, COUNT(*) AS num_cust_svc',
+% 'table' => 'part_svc',
+% 'addl_from' => 'LEFT JOIN cust_svc USING ( svcpart )',
+% 'extra_sql' => 'WHERE pkgnum = ? GROUP BY part_svc.svcpart',
+% 'extra_param' => [ [$cust_pkg->pkgnum,'int'] ],
+% })
+% ) {
+% my $svcpart = $part_svc->svcpart;
+% my $num_cust_svc = $part_svc->num_cust_svc;
+% if ( $large_pkg_size > 0 and $num_cust_svc >= $large_pkg_size ) {
+% # don't retrieve the cust_svc records, just stash the
+% # part_svc and num_cust_svc for later
+% $cust_svc_by_svcpart{$svcpart} =
+% [ 'summarize', $part_svc, $num_cust_svc ];
+% $rows += 2;