- >
+ | >
<% $cust_main->display_custnum %>
|
- >
+ | >
<% 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 ) {
- ALIGN=right>
+ | ALIGN=right>
% foreach my $priority ( @custom_priorities, '' ) {
@@ -203,7 +197,7 @@
% } else {
- | ALIGN=right>
+ | ALIGN=right>
% }
% my $ahref = '';
@@ -227,7 +221,7 @@
|
% } else {
- ALIGN=right>
+ | ALIGN=right>
<% $cust_main->get($addl_col) %>
|
@@ -245,29 +239,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 %>
- <% $pkg_comment %>
+ <% $n1 %> |
+ <% $pkg_comment |h %>
|
% 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 %>
-
+% 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 %>
+ (<% 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) %>
-
+ <% $td %>
<% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %>
|
-% $n2=" ";
-% }
+% $n2=" ";
+% } #foreach $cust_svc
+% }
+% } # foreach $svcpart
%
-% unless ( @cust_svc ) {
+% unless ( %cust_svc_by_svcpart ) {
|
% }
%
@@ -275,7 +297,7 @@
% }
%
% unless ( @{$all_pkgs{$custnum}} ) {
- | !;
+ |
% }
%
@@ -288,10 +310,12 @@
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
- unless $curuser->access_right('List customers');
+ unless $curuser->access_right('List all customers');
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,9 +468,12 @@ 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' => scalar($cgi->param('search_cust')),
- 'no_fuzzy_on_exact' => 1, #pref?
- );
+ push @cust_main, smart_search(
+ 'search' => scalar($cgi->param('search_cust')),
+ 'no_fuzzy_on_exact' => ! ( $curuser->option('enable_fuzzy_on_exact')
+ || $conf->exists('enable_fuzzy_on_exact')
+ ),
+ );
}
@cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main
@@ -507,7 +534,7 @@ sub cardsearch {
my($card)=$cgi->param('card');
$card =~ s/\D//g;
- $card =~ /^(\d{13,16})$/ or errorpage(emt("Illegal card number"));
+ $card =~ /^(\d{13,16}|\d{8,9})$/ or errorpage(emt("Illegal card number"));
my($payinfo)=$1;
[ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}),
|