X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_main.cgi;h=4e624eb51b276e1800da2ef6c438dc47b477d91d;hb=5b2b242ad80a2efac3fb3f4d919142307084bd73;hp=38ec4f4533e90d233e3cfecc693a361d195e69ac;hpb=117659ee02ba32bf59335bf18faa7a075f231709;p=freeside.git diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 38ec4f453..4e624eb51 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -119,8 +119,18 @@ % foreach my $cust_pkg ( @{$all_pkgs{$custnum}} ) { % my %cust_svc_by_svcpart; % 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 ) +% #$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; @@ -132,7 +142,9 @@ % $rows += 2; % } % elsif ( $num_cust_svc ) { -% $cust_svc_by_svcpart{$svcpart} = $part_svc->cust_pkg_svc; +% #$cust_svc_by_svcpart{$svcpart} = $part_svc->cust_pkg_svc; +% #further optimization opportunities: don't need to re-pull in another $part_svc object, sorting this is expensive, etc. +% $cust_svc_by_svcpart{$svcpart} = [ $cust_pkg->cust_svc($part_svc->svcpart) ]; % $rows += $num_cust_svc; % } #if summarize % } #foreach $part_svc @@ -232,11 +244,12 @@ % my $n1 = ''; % foreach ( @{$all_pkgs{$custnum}} ) { +% local($FS::cust_svc::cache_enabled) = 1; #for $cust_svc->part_svc % my $pkgnum = $_->pkgnum; % my $part_pkg = $_->part_pkg; % -% my $pkg_comment = $part_pkg->pkg_comment(nopkgpart => 1); -% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/ +% my $pkg_comment = $part_pkg->pkg_comment( nopkgpart=>1 ); +% my $show = $default_customer_view =~ /^(jumbo|packages)$/ % ? '' % : ';show=packages'; % my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment @@ -279,12 +292,13 @@ % } % elsif ( scalar @$these ) { # do not summarize % foreach my $cust_svc ( @$these ) { +% my $part_svc = $cust_svc->part_svc; <% $n2 %> <% $td %> - <% FS::UI::Web::svc_link($m, $cust_svc->part_svc, $cust_svc) %> + <% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %> <% $td %> - <% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %> + <% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %> % $n2=""; % } #foreach $cust_svc @@ -319,6 +333,8 @@ 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 $default_customer_view = $curuser->default_customer_view; + my $limit = ''; $limit .= "LIMIT $maxrecords" if $maxrecords; @@ -520,8 +536,9 @@ my $addl_from = qq{ local($FS::cust_pkg::cache_enabled) = 1; #for $cust_pkg->part_pkg my %all_pkgs = map { $_->custnum => - [ $_->$pkgs_method({ select => $select, - addl_from => $addl_from, + [ $_->$pkgs_method({ select => $select, + addl_from => $addl_from, ++ skip_label_sort => 1, }) ]; }