<% mt('#') |h %> |
<% mt('Status') |h %> |
- <% mt('(bill) name') |h %> |
- <% mt('company') |h %> |
-
-%if ( defined dbdef->table('cust_main')->column('ship_last') ) {
- <% mt('(service) name') |h %> |
- <% mt('company') |h %> |
-%}
+ <% mt('Name') |h %> |
+ <% mt('Company') |h %> |
%foreach my $addl_header ( @addl_headers ) {
<% $addl_header %> |
@@ -123,25 +118,26 @@
% my @pkg_rowspans;
% foreach my $cust_pkg ( @{$all_pkgs{$custnum}} ) {
% my %cust_svc_by_svcpart;
-% 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;
+% foreach my $part_svc ( $cust_pkg->part_svc ) {
+% my $svcpart = $part_svc->svcpart;
+% my $num_cust_svc = $cust_pkg->num_cust_svc($svcpart);
+% 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;
% }
-% push @pkg_rowspans, $rows;
-% }
-% }
+% elsif ( $num_cust_svc ) {
+% $cust_svc_by_svcpart{$svcpart} = [ $cust_pkg->cust_svc($svcpart) ];
+% $rows += $num_cust_svc;
+% } #if summarize
+% } #foreach $part_svc
+% $rows ||= 1; # in case the package has no services
+% push @all_cust_svc, \%cust_svc_by_svcpart;
+% push @pkg_rowspans, $rows;
+% } #foreach $cust_pkg
% my $rowspan = List::Util::sum(@pkg_rowspans) || 1;
%
% my $view;
@@ -151,7 +147,7 @@
% $view = $p. 'view/cust_main.cgi?'. $custnum;
% }
% my $pcompany = $company
-% ? qq!$company!
+% ? qq!!. encode_entities($company). ''
% : ' ';
%
% my $status = $cust_main->status;
@@ -165,31 +161,12 @@
<% ucfirst($status) %>
>
- <% "$last, $first" %>
+ <% "$last, $first" |h %>
|
>
<% $pcompany %>
|
-% if ( defined dbdef->table('cust_main')->column('ship_last') ) {
-% my($ship_last,$ship_first,$ship_company)=(
-% $cust_main->ship_last || $cust_main->getfield('last'),
-% $cust_main->ship_last ? $cust_main->ship_first : $cust_main->first,
-% $cust_main->ship_last ? $cust_main->ship_company : $cust_main->company,
-% );
-% my $pship_company = $ship_company
-% ? qq!$ship_company!
-% : ' ';
-%
-
- >
- <% "$ship_last, $ship_first" %>
- |
- >
- <% $pship_company %>
- |
-% }
-%
% foreach my $addl_col ( @addl_cols ) {
% if ( $addl_col eq 'tickets' ) {
% if ( @custom_priorities ) {
@@ -267,7 +244,7 @@
% my $pkg_rowspan = shift @pkg_rowspans;
<% $n1 %>
- <% $pkg_comment %>
+ <% $pkg_comment |h %>
|
% my $n2 = '';
@@ -275,15 +252,16 @@
%
% foreach my $svcpart ( sort keys %cust_svc_by_svcpart ) { #sort order?
% my $these = $cust_svc_by_svcpart{$svcpart};
-% my $num_cust_svc = scalar @$these; # always at least 1
-% if ( $large_pkg_size > 0 && $num_cust_svc >= $large_pkg_size ) {
+% if ( $these->[0] eq 'summarize' ) {
+% my $part_svc = $these->[1];
+% my $num_cust_svc = $these->[2];
<% $n2 %>
% # summarize
% # link opens a new search for this pkgnum/svcpart combo
% my $href = $p.'search/cust_pkg_svc.html?svcpart='.$svcpart.
% ';pkgnum='.$pkgnum;
<% $td %>
- <% $these->[0]->part_svc->svc %>
+ <% $part_svc->svc %>
<% $td %>
(<% mt("view all [_1]", $num_cust_svc) |h %>)
@@ -293,10 +271,11 @@
<% $td %><& /elements/search-cust_svc.html,
'svcpart' => $svcpart,
'pkgnum' => $pkgnum,
+ 'svcdb' => $part_svc->svcdb,
&>
% $n2="