X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_main.cgi;h=6ebc55bb1a6c85d53f4a7c203b440e6aa5549216;hb=c4b71bc4459cb7d403cbebede470aeb2c6292a6e;hp=b8af1fdc43b7ba6c7ed90351093eaa4356d151dd;hpb=8ef00c68688492b2afa3dde8d3d467f89f238c40;p=freeside.git diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b8af1fdc4..6ebc55bb1 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -119,13 +119,31 @@ % $cust_main->company, % ); % -% my(@lol_cust_svc); -% my($rowspan)=0;#scalar( @{$all_pkgs{$custnum}} ); -% foreach ( @{$all_pkgs{$custnum}} ) { -% my @cust_svc = $_->cust_svc; -% push @lol_cust_svc, \@cust_svc; -% $rowspan += scalar(@cust_svc) || 1; -% } +% my @all_cust_svc; +% my @pkg_rowspans; +% foreach my $cust_pkg ( @{$all_pkgs{$custnum}} ) { +% my %cust_svc_by_svcpart; +% 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; +% } +% 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; % if ( defined $cgi->param('quickpay') && $cgi->param('quickpay') eq 'yes' ) { @@ -141,16 +159,16 @@ % my $statuscol = $cust_main->statuscolor; - > + > <% $cust_main->display_custnum %> - > + > <% ucfirst($status) %> - > + > <% "$last, $first" %> - > + > <% $pcompany %> @@ -165,10 +183,10 @@ % : ' '; % - > + > <% "$ship_last, $ship_first" %> - > + > <% $pship_company %> % } @@ -177,7 +195,7 @@ % if ( $addl_col eq 'tickets' ) { % if ( @custom_priorities ) { - ALIGN=right> + ALIGN=right> % foreach my $priority ( @custom_priorities, '' ) { @@ -203,7 +221,7 @@ % } else { - @@ -245,29 +263,57 @@ % : ';show=packages'; % my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment % my $pkgview = "${p}view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag"; -% my @cust_svc = @{shift @lol_cust_svc}; -% my $rowspan = scalar(@cust_svc) || 1; +% # cust_svc stuff, built earlier +% my %cust_svc_by_svcpart = %{ shift @all_cust_svc }; +% my $pkg_rowspan = shift @pkg_rowspans; - <% $n1 %> % my $n2 = ''; -% foreach my $cust_svc ( @cust_svc ) { -% my($label, $value, $svcdb) = $cust_svc->label; -% my($svcnum) = $cust_svc->svcnum; -% my($sview) = $p.'view'; - <% $n2 %> - + <% $td %> + (<% mt("view all [_1]", $num_cust_svc) |h %>) + + + <% $td %> + <% $td %><& /elements/search-cust_svc.html, + 'svcpart' => $svcpart, + 'pkgnum' => $pkgnum, + 'svcdb' => $part_svc->svcdb, + &> +% $n2=""; +% } +% elsif ( scalar @$these ) { # do not summarize +% foreach my $cust_svc ( @$these ) { + <% $n2 %> + <% $td %> <% FS::UI::Web::svc_link($m, $cust_svc->part_svc, $cust_svc) %> - -% $n2=""; -% } +% $n2=""; +% } #foreach $cust_svc +% } +% } # foreach $svcpart % -% unless ( @cust_svc ) { +% unless ( %cust_svc_by_svcpart ) { % } % @@ -292,6 +338,8 @@ die "access denied" my $conf = new FS::Conf; my $maxrecords = $conf->config('maxsearchrecordsperpage'); +# summarize more than this many services of the same svcpart +my $large_pkg_size = $conf->config('cust_pkg-large_pkg_size') || 0; my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords;
% } else { - ALIGN=right> + ALIGN=right> % } % my $ahref = ''; @@ -227,7 +245,7 @@ ALIGN=right> + ALIGN=right> <% $cust_main->get($addl_col) %> + <% $n1 %> <% $pkg_comment %> +% my $td = ''; +% +% foreach my $svcpart ( sort keys %cust_svc_by_svcpart ) { #sort order? +% my $these = $cust_svc_by_svcpart{$svcpart}; +% 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 %> + <% $part_svc->svc %> +
+ <% $td %> <% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %>