% my $refcustlabel = "$referral_custnum: " .
% ( $cust_main->company || $cust_main->last. ', '. $cust_main->first );
referrals of
- <A HREF="<% popurl(2)."view/cust_main.cgi?$referral_custnum" %>"><% $refcustlabel %></A>
+ <A HREF="<% popurl(2)."view/cust_main.cgi?$referral_custnum" %>"><% $refcustlabel |h %></A>
<SELECT NAME="referral_depth" SIZE="1" onChange="changed(this)">';
% my $max = 8;
<TR>
<TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
<TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('(bill) name') |h %></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('company') |h %></TH>
-
-%if ( defined dbdef->table('cust_main')->column('ship_last') ) {
- <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('(service) name') |h %></TH>
- <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('company') |h %></TH>
-%}
+ <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Name') |h %></TH>
+ <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Company') |h %></TH>
%foreach my $addl_header ( @addl_headers ) {
<TH CLASS="grid" BGCOLOR="#cccccc"><% $addl_header %></TH>
% 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;
% $view = $p. 'view/cust_main.cgi?'. $custnum;
% }
% my $pcompany = $company
-% ? qq!<A HREF="$view"><FONT SIZE=-1>$company</FONT></A>!
+% ? qq!<A HREF="$view"><FONT SIZE=-1>!. encode_entities($company). '</FONT></A>'
% : '<FONT SIZE=-1> </FONT>';
%
-% my $status = $cust_main->status;
-% my $statuscol = $cust_main->statuscolor;
+% my $status_label = $cust_main->status_label;
+% my $statuscolor = $cust_main->statuscolor;
<TR>
<TD CLASS="grid" ALIGN="right" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
<A HREF="<% $view %>"><FONT SIZE=-1><% $cust_main->display_custnum %></FONT></A>
</TD>
<TD CLASS="grid" ALIGN="center" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
- <FONT SIZE="-1" COLOR="#<% $statuscol %>"><B><% ucfirst($status) %></B></FONT>
+ <FONT SIZE="-1" COLOR="#<% $statuscolor %>"><B><% $status_label %></B></FONT>
</TD>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
- <A HREF="<% $view %>"><FONT SIZE=-1><% "$last, $first" %></FONT></A>
+ <A HREF="<% $view %>"><FONT SIZE=-1><% "$last, $first" |h %></FONT></A>
</TD>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
<% $pcompany %>
</TD>
-% 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!<A HREF="$view"><FONT SIZE=-1>$ship_company</FONT></A>!
-% : '<FONT SIZE=-1> </FONT>';
-%
-
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
- <A HREF="<% $view %>"><FONT SIZE=-1><% "$ship_last, $ship_first" %></FONT></A>
- </TD>
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
- <% $pship_company %></A>
- </TD>
-% }
-%
% foreach my $addl_col ( @addl_cols ) {
% if ( $addl_col eq 'tickets' ) {
% if ( @custom_priorities ) {
% my $pkgnum = $_->pkgnum;
% my $part_pkg = $_->part_pkg;
%
-% my $pkg_comment = $part_pkg->pkg_comment(nopkgpart => 1);
+% my $pkg_comment = $part_pkg->pkg_comment( cust_pkg=>$_, nopkgpart=>1 );
% my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
% ? ''
% : ';show=packages';
% my $pkg_rowspan = shift @pkg_rowspans;
<% $n1 %><TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN="<% $pkg_rowspan%>">
- <A HREF="<% $pkgview %>"><FONT SIZE=-1><% $pkg_comment %></FONT></A>
+ <A HREF="<% $pkgview %>"><FONT SIZE=-1><% $pkg_comment |h %></FONT></A>
</TD>
% my $n2 = '';
%
% 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 %>
- <A HREF="<% $href %>"><% $these->[0]->part_svc->svc %></A>
+ <A HREF="<% $href %>"><% $part_svc->svc %></A>
</TD>
<% $td %>
<A HREF="<% $href %>"><B>(<% mt("view all [_1]", $num_cust_svc) |h %>)</B></A>
<% $td %><& /elements/search-cust_svc.html,
'svcpart' => $svcpart,
'pkgnum' => $pkgnum,
+ 'svcdb' => $part_svc->svcdb,
&></TD>
% $n2="</TR><TR>";
% }
-% else { # do not summarize
+% elsif ( scalar @$these ) { # do not summarize
% foreach my $cust_svc ( @$these ) {
<% $n2 %>
<% $td %>
% }
%
% unless ( @{$all_pkgs{$custnum}} ) {
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" COLSPAN=3> </TD>!;
+ <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" COLSPAN=3> </TD>
% }
%
</TR>
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');
push @qual, FS::cust_main->cancel_sql if $cgi->param('cancelled');
push @qual, FS::cust_main->prospect_sql if $cgi->param('prospect');
+ push @qual, FS::cust_main->ordered_sql if $cgi->param('ordered');
push @qual, FS::cust_main->active_sql if $cgi->param('active');
push @qual, FS::cust_main->inactive_sql if $cgi->param('inactive');
push @qual, FS::cust_main->susp_sql if $cgi->param('suspended');
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
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'}),