X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_main.cgi;h=000339d2b89377f44d3747e0d953070da9d6b606;hb=d8299144d2175f1695adafe29e9549bd9b158e2f;hp=b4db1daf3d4dacce5b3d3b9339da0066259b7a39;hpb=ddde2be8e3d2cd0e61da2f68d4c06a6b31c50562;p=freeside.git diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index b4db1daf3..000339d2b 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -8,7 +8,7 @@ % errorpage(emt("No matching customers found!")); % } # errorpage quits, so we don't need an 'else' below -<& /elements/header.html, emt("Customer Search Results"), '' &> +<& /elements/header.html, mt("Customer Search Results"), '' &> % $total ||= scalar(@cust_main); <% mt("[_1] matching customers found",$total) |h %> @@ -119,13 +119,30 @@ % $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; +% 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 @$_; +% } +% push @pkg_rowspans, $rows; +% } % } +% my $rowspan = List::Util::sum(@pkg_rowspans) || 1; % % my $view; % if ( defined $cgi->param('quickpay') && $cgi->param('quickpay') eq 'yes' ) { @@ -141,16 +158,16 @@ % my $statuscol = $cust_main->statuscolor; - > + > <% $cust_main->display_custnum %> - > + > <% ucfirst($status) %> - > + > <% "$last, $first" %> - > + > <% $pcompany %> @@ -165,10 +182,10 @@ % : ' '; % - > + > <% "$ship_last, $ship_first" %> - > + > <% $pship_company %> % } @@ -177,7 +194,7 @@ % if ( $addl_col eq 'tickets' ) { % if ( @custom_priorities ) { - ALIGN=right> + ALIGN=right> % foreach my $priority ( @custom_priorities, '' ) { @@ -203,7 +220,7 @@ % } else { - @@ -245,29 +262,55 @@ % : ';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, + &> +% $n2=""; +% } +% else { # 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 +335,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; @@ -444,7 +489,7 @@ if ( $cgi->param('browse') if ( $cgi->param('search_cust') ) { $sortby = \*company_sort; $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )"; - push @cust_main, smart_search( 'search' => $cgi->param('search_cust'), + push @cust_main, smart_search( 'search' => scalar($cgi->param('search_cust')), 'no_fuzzy_on_exact' => 1, #pref? ); }
% } else { - ALIGN=right> + ALIGN=right> % } % my $ahref = ''; @@ -227,7 +244,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}; +% my $num_cust_svc = scalar @$these; # always at least 1 +% if ( $large_pkg_size > 0 && $num_cust_svc >= $large_pkg_size ) { + <% $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 %> +
+ <% $td %> <% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %>