1 % if ( scalar(@cust_main) == 1 && ! $cgi->param('referral_custnum') ) {
2 % if ( $cgi->param('quickpay') eq 'yes' ) {
3 <% $cgi->redirect(popurl(2). "edit/cust_pay.cgi?quickpay=yes;custnum=". $cust_main[0]->custnum) %>
5 <% $cgi->redirect(popurl(2). "view/cust_main.cgi?". $cust_main[0]->custnum) %>
7 %} elsif ( scalar(@cust_main) == 0 ) {
8 % errorpage(emt("No matching customers found!"));
9 % } # errorpage quits, so we don't need an 'else' below
11 <& /elements/header.html, mt("Customer Search Results"), '' &>
12 % $total ||= scalar(@cust_main);
14 <% mt("[_1] matching customers found",$total) |h %>
16 % my $pager = include( '/elements/pager.html',
17 % 'offset' => $offset,
18 % 'num_rows' => scalar(@cust_main),
20 % 'maxrecords' => $maxrecords,
23 % unless ( $cgi->param('cancelled') ) {
25 % if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
26 % || ( $conf->exists('hidecancelledcustomers')
27 % && ! $cgi->param('showcancelledcustomers')
30 % $cgi->param('showcancelledcustomers', 1);
31 % $linklabel = 'show';
33 % $cgi->param('showcancelledcustomers', 0);
34 % $linklabel = 'hide';
36 % $cgi->param('offset', 0);
37 ( <a href="<% $cgi->self_url %>"><% mt("$linklabel canceled customers") |h %></a> )
40 % if ( $cgi->param('referral_custnum') ) {
41 % $cgi->param('referral_custnum') =~ /^(\d+)$/
42 % or errorpage(emt("Illegal referral_custnum"));
43 % my $referral_custnum = $1;
44 % my $cust_main = qsearchs('cust_main', { custnum => $referral_custnum } );
46 function changed(what) {
51 % # XXX: translate this section...hard due to "referrals of CUST SELECT levels deep" construction
53 <INPUT TYPE="hidden" NAME="referral_custnum" VALUE="<% $referral_custnum %>">
54 % my $refcustlabel = "$referral_custnum: " .
55 % ( $cust_main->company || $cust_main->last. ', '. $cust_main->first );
57 <A HREF="<% popurl(2)."view/cust_main.cgi?$referral_custnum" %>"><% $refcustlabel |h %></A>
58 <SELECT NAME="referral_depth" SIZE="1" onChange="changed(this)">';
61 % $cgi->param('referral_depth') =~ /^(\d*)$/
62 % or errorpage(emt("Illegal referral_depth"));
63 % my $referral_depth = $1;
65 % foreach my $depth ( 1 .. $max ) {
66 % my $selected = ($depth == $referral_depth) ? 'SELECTED' : '';
67 <OPTION <% $selected %>><% $depth %>
73 % my @custom_priorities = ();
74 % if ( $conf->config('ticket_system-custom_priority_field')
75 % && @{[ $conf->config('ticket_system-custom_priority_field-values') ]} ) {
76 % @custom_priorities =
77 % $conf->config('ticket_system-custom_priority_field-values');
80 <BR><BR><% $pager.include('/elements/table-grid.html') %>
82 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('#') |h %></TH>
83 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
84 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Name') |h %></TH>
85 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Company') |h %></TH>
87 %foreach my $addl_header ( @addl_headers ) {
88 <TH CLASS="grid" BGCOLOR="#cccccc"><% $addl_header %></TH>
91 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Packages') |h %></TH>
92 <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN="2"><% mt('Services') |h %></TH>
95 % my $bgcolor1 = '#eeeeee';
96 % my $bgcolor2 = '#ffffff';
99 % my(%saw,$cust_main);
100 % foreach $cust_main (
101 % sort $sortby grep(!$saw{$_->custnum}++, @cust_main)
104 % if ( $bgcolor eq $bgcolor1 ) {
105 % $bgcolor = $bgcolor2;
107 % $bgcolor = $bgcolor1;
110 % my($custnum,$last,$first,$company)=(
111 % $cust_main->custnum,
112 % $cust_main->getfield('last'),
113 % $cust_main->getfield('first'),
114 % $cust_main->company,
119 % foreach my $cust_pkg ( @{$all_pkgs{$custnum}} ) {
120 % my %cust_svc_by_svcpart;
122 % local($FS::part_pkg::cache_enabled) = 1; #for $cust_pkg->part_svc
123 % local($FS::cust_svc::cache_enabled) = 1; #for $cust_svc->part_svc
124 % local($FS::pkg_svc::cache_enabled) = 1; #for $pkg_svc->part_svc
125 % foreach my $part_svc (
126 % $cust_pkg->part_svc( summarize_size=>$large_pkg_size )
128 % my $svcpart = $part_svc->svcpart;
129 % my $num_cust_svc = $part_svc->num_cust_svc;
130 % if ( $large_pkg_size > 0 and $num_cust_svc >= $large_pkg_size ) {
131 % # don't retrieve the cust_svc records, just stash the
132 % # part_svc and num_cust_svc for later
133 % $cust_svc_by_svcpart{$svcpart} =
134 % [ 'summarize', $part_svc, $num_cust_svc ];
137 % elsif ( $num_cust_svc ) {
138 % $cust_svc_by_svcpart{$svcpart} = $part_svc->cust_pkg_svc;
139 % $rows += $num_cust_svc;
141 % } #foreach $part_svc
142 % $rows ||= 1; # in case the package has no services
143 % push @all_cust_svc, \%cust_svc_by_svcpart;
144 % push @pkg_rowspans, $rows;
145 % } #foreach $cust_pkg
146 % my $rowspan = List::Util::sum(@pkg_rowspans) || 1;
149 % if ( defined $cgi->param('quickpay') && $cgi->param('quickpay') eq 'yes' ) {
150 % $view = $p. 'edit/cust_pay.cgi?quickpay=yes;custnum='. $custnum;
152 % $view = $p. 'view/cust_main.cgi?'. $custnum;
154 % my $pcompany = $company
155 % ? qq!<A HREF="$view"><FONT SIZE=-1>!. encode_entities($company). '</FONT></A>'
156 % : '<FONT SIZE=-1> </FONT>';
158 % my $status = $cust_main->status;
159 % my $statuscol = $cust_main->statuscolor;
162 <TD CLASS="grid" ALIGN="right" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
163 <A HREF="<% $view %>"><FONT SIZE=-1><% $cust_main->display_custnum %></FONT></A>
165 <TD CLASS="grid" ALIGN="center" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
166 <FONT SIZE="-1" COLOR="#<% $statuscol %>"><B><% ucfirst($status) %></B></FONT>
168 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
169 <A HREF="<% $view %>"><FONT SIZE=-1><% "$last, $first" |h %></FONT></A>
171 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
175 % foreach my $addl_col ( @addl_cols ) {
176 % if ( $addl_col eq 'tickets' ) {
177 % if ( @custom_priorities ) {
179 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %> ALIGN=right>
181 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
182 % foreach my $priority ( @custom_priorities, '' ) {
184 % FS::TicketSystem->num_customer_tickets($custnum,$priority);
186 % $ahref= '<A HREF="'.
187 % FS::TicketSystem->href_customer_tickets($custnum,$priority).
193 <FONT SIZE=-1><% $ahref.$num %></A></FONT>
196 <FONT SIZE=-1><% $ahref %><% $priority || '<i>('.emt('none').')</i>' %></A></FONT>
202 <TH ALIGN=right STYLE="border-top: dashed 1px black">
205 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %> ALIGN=right>
209 % $ahref = '<A HREF="'.
210 % FS::TicketSystem->href_customer_tickets($custnum).
212 % if $cust_main->get($addl_col);
215 <% $ahref %><% $cust_main->get($addl_col) %></A>
216 % if ( @custom_priorities ) {
219 <TH ALIGN=left STYLE="border-top: dashed 1px black">
220 <FONT SIZE=-1><% ${ahref} %>Total</A><FONT>
229 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %> ALIGN=right><FONT SIZE=-1>
230 <% $cust_main->get($addl_col) %>
237 % foreach ( @{$all_pkgs{$custnum}} ) {
238 % my $pkgnum = $_->pkgnum;
239 % my $part_pkg = $_->part_pkg;
241 % my $pkg_comment = $part_pkg->pkg_comment( nopkgpart=>1 );
242 % my $show = $default_customer_view =~ /^(jumbo|packages)$/
244 % : ';show=packages';
245 % my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment
246 % my $pkgview = "${p}view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag";
247 % # cust_svc stuff, built earlier
248 % my %cust_svc_by_svcpart = %{ shift @all_cust_svc };
249 % my $pkg_rowspan = shift @pkg_rowspans;
251 <% $n1 %><TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN="<% $pkg_rowspan%>">
252 <A HREF="<% $pkgview %>"><FONT SIZE=-1><% $pkg_comment |h %></FONT></A>
256 % my $td = '<TD CLASS="grid" BGCOLOR="'.$bgcolor.'">';
258 % foreach my $svcpart ( sort keys %cust_svc_by_svcpart ) { #sort order?
259 % my $these = $cust_svc_by_svcpart{$svcpart};
260 % if ( $these->[0] eq 'summarize' ) {
261 % my $part_svc = $these->[1];
262 % my $num_cust_svc = $these->[2];
265 % # link opens a new search for this pkgnum/svcpart combo
266 % my $href = $p.'search/cust_pkg_svc.html?svcpart='.$svcpart.
267 % ';pkgnum='.$pkgnum;
269 <A HREF="<% $href %>"><% $part_svc->svc %></A>
272 <A HREF="<% $href %>"><B>(<% mt("view all [_1]", $num_cust_svc) |h %>)</B></A>
276 <% $td %><& /elements/search-cust_svc.html,
277 'svcpart' => $svcpart,
279 'svcdb' => $part_svc->svcdb,
283 % elsif ( scalar @$these ) { # do not summarize
284 % foreach my $cust_svc ( @$these ) {
285 % my $part_svc = $cust_svc->part_svc;
288 <% FS::UI::Web::svc_link($m, $part_svc, $cust_svc) %>
291 <% FS::UI::Web::svc_label_link($m, $part_svc, $cust_svc) %>
294 % } #foreach $cust_svc
296 % } # foreach $svcpart
298 % unless ( %cust_svc_by_svcpart ) {
299 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" COLSPAN=2> </TD>
305 % unless ( @{$all_pkgs{$custnum}} ) {
306 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" COLSPAN=3> </TD>
314 <& /elements/footer.html &>
316 my $curuser = $FS::CurrentUser::CurrentUser;
319 unless $curuser->access_right('List all customers');
321 my $conf = new FS::Conf;
322 my $maxrecords = $conf->config('maxsearchrecordsperpage');
323 # summarize more than this many services of the same svcpart
324 my $large_pkg_size = $conf->config('cust_pkg-large_pkg_size') || 0;
326 my $default_customer_view = $curuser->default_customer_view;
329 $limit .= "LIMIT $maxrecords" if $maxrecords;
331 my $offset = $cgi->param('offset') || 0;
332 $limit .= " OFFSET $offset" if $offset;
336 my(@cust_main, $sortby, $orderby);
338 my @addl_headers = ();
340 if ( $cgi->param('browse')
341 || $cgi->param('otaker_on')
342 || $cgi->param('agentnum_on')
347 if ( $cgi->param('browse') ) {
348 my $query = $cgi->param('browse');
349 if ( $query eq 'custnum' ) {
350 if ( $conf->exists('cust_main-default_agent_custid') ) {
351 $sortby=\*display_custnum_sort;
352 $orderby = "ORDER BY CASE WHEN agent_custid IS NOT NULL
353 AND agent_custid != ''
354 AND agent_custid ". regexp_sql. " '^[0-9]+\$'
355 THEN CAST(agent_custid AS BIGINT)
359 $sortby=\*custnum_sort;
360 $orderby = "ORDER BY custnum";
362 } elsif ( $query eq 'last' ) {
364 $orderby = "ORDER BY LOWER(last || ' ' || first)";
365 } elsif ( $query eq 'company' ) {
366 $sortby=\*company_sort;
367 $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
368 } elsif ( $query eq 'tickets' ) {
369 $sortby = \*tickets_sort;
370 $orderby = "ORDER BY tickets DESC";
371 push @select, FS::TicketSystem->sql_num_customer_tickets. " as tickets";
372 push @addl_headers, 'Tickets';
373 push @addl_cols, 'tickets';
374 } elsif ( $query eq 'uspsunvalid' ) {
375 $search{'country'} = 'US';
376 $sortby=\*custnum_sort;
377 $orderby = "ORDER BY custnum";
379 die "unknown browse field $query";
382 $sortby = \*last_sort; #??
383 $orderby = "ORDER BY LOWER(last || ' ' || first)"; #??
386 if ( $cgi->param('otaker_on') ) {
388 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
389 $cgi->param('otaker') =~ /^(\w{1,32})$/ or errorpage("Illegal otaker");
390 $search{otaker} = $1;
391 } elsif ( $cgi->param('agentnum_on') ) {
392 $cgi->param('agentnum') =~ /^(\d+)$/ or errorpage("Illegal agentnum");
393 $search{agentnum} = $1;
400 if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
401 || ( $conf->exists('hidecancelledcustomers')
402 && ! $cgi->param('showcancelledcustomers') )
404 push @qual, FS::cust_main->uncancel_sql;
407 push @qual, FS::cust_main->cancel_sql if $cgi->param('cancelled');
408 push @qual, FS::cust_main->prospect_sql if $cgi->param('prospect');
409 push @qual, FS::cust_main->ordered_sql if $cgi->param('ordered');
410 push @qual, FS::cust_main->active_sql if $cgi->param('active');
411 push @qual, FS::cust_main->inactive_sql if $cgi->param('inactive');
412 push @qual, FS::cust_main->susp_sql if $cgi->param('suspended');
415 my $qual = join(' AND ',
416 map { "$_ = ". dbh->quote($search{$_}) } keys %search );
418 my $addl_qual = join(' AND ', @qual);
420 #here is the agent virtualization
421 $addl_qual .= ( $addl_qual ? ' AND ' : '' ).
422 $FS::CurrentUser::CurrentUser->agentnums_sql;
424 if ( $cgi->param('browse') && $cgi->param('browse') eq 'uspsunvalid' ) {
425 $addl_qual .= ' AND ( length(zip) < 9 OR upper(address1) != address1 OR upper(city) != city ) ';
429 $qual .= ' AND ' if $qual;
433 $qual = " WHERE $qual" if $qual;
434 my $statement = "SELECT COUNT(*) FROM cust_main $qual";
435 my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement";
436 $sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
438 $total = $sth->fetchrow_arrayref->[0];
442 $addl_qual = " AND $addl_qual";
444 $addl_qual = " WHERE $addl_qual";
450 $select = 'cust_main.*, '. join (', ', @select);
455 @cust_main = qsearch('cust_main', \%search, $select,
456 "$addl_qual $orderby $limit" );
460 $sortby = \*last_sort;
462 push @cust_main, @{&custnumsearch}
463 if $cgi->param('custnum_on') && $cgi->param('custnum_text');
464 push @cust_main, @{&cardsearch}
465 if $cgi->param('card_on') && $cgi->param('card');
466 push @cust_main, @{&lastsearch}
467 if $cgi->param('last_on') && $cgi->param('last_text');
468 push @cust_main, @{&companysearch}
469 if $cgi->param('company_on') && $cgi->param('company_text');
470 push @cust_main, @{&address2search}
471 if $cgi->param('address2_on') && $cgi->param('address2_text');
472 push @cust_main, @{&phonesearch}
473 if $cgi->param('phone_on') && $cgi->param('phone_text');
474 push @cust_main, @{&referralsearch}
475 if $cgi->param('referral_custnum');
477 if ( $cgi->param('company_on') && $cgi->param('company_text') ) {
478 $sortby = \*company_sort;
479 push @cust_main, @{&companysearch};
482 if ( $cgi->param('search_cust') ) {
483 $sortby = \*company_sort;
484 $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
485 push @cust_main, smart_search(
486 'search' => scalar($cgi->param('search_cust')),
487 'no_fuzzy_on_exact' => ! ( $curuser->option('enable_fuzzy_on_exact')
488 || $conf->exists('enable_fuzzy_on_exact')
493 @cust_main = grep { $_->num_ncancelled_pkgs || ! $_->num_pkgs } @cust_main
494 if ! $cgi->param('cancelled')
496 $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
497 || ( $conf->exists('hidecancelledcustomers')
498 && ! $cgi->param('showcancelledcustomers') )
502 @cust_main = grep { !$saw{$_->custnum}++ } @cust_main;
505 my $pkgs_method = $conf->exists('hidecancelledpackages')
509 #false laziness w/httemplate/view/cust_main/packages.html
510 my $select = join(',',
513 'setup_option.optionvalue AS _opt_setup_fee',
514 'recur_option.optionvalue AS _opt_recur_fee',
518 LEFT JOIN part_pkg USING ( pkgpart )
519 LEFT JOIN part_pkg_option AS setup_option
520 ON ( cust_pkg.pkgpart = setup_option.pkgpart
521 AND setup_option.optionname = 'setup_fee' )
522 LEFT JOIN part_pkg_option AS recur_option
523 ON ( cust_pkg.pkgpart = recur_option.pkgpart
524 AND recur_option.optionname = 'recur_fee' )
527 local($FS::cust_pkg::cache_enabled) = 1; #for $cust_pkg->part_pkg
528 my %all_pkgs = map { $_->custnum =>
529 [ $_->$pkgs_method({ select => $select,
530 addl_from => $addl_from,
531 + skip_label_sort => 1,
538 lc($a->getfield('last')) cmp lc($b->getfield('last'))
539 || lc($a->first) cmp lc($b->first);
543 return -1 if $a->company && ! $b->company;
544 return 1 if ! $a->company && $b->company;
545 lc($a->company) cmp lc($b->company)
546 || lc($a->getfield('last')) cmp lc($b->getfield('last'))
547 || lc($a->first) cmp lc($b->first);;
550 sub display_custnum_sort {
551 $a->display_custnum <=> $b->display_custnum;
555 $a->getfield('custnum') <=> $b->getfield('custnum');
559 $b->getfield('tickets') <=> $a->getfield('tickets');
564 my $custnum = $cgi->param('custnum_text');
566 $custnum =~ /^(\d{1,23})$/ or errorpage(emt("Illegal customer number"));
569 [ qsearchs('cust_main', { 'custnum' => $custnum } ) ];
574 my($card)=$cgi->param('card');
576 $card =~ /^(\d{13,16}|\d{8,9})$/ or errorpage(emt("Illegal card number"));
579 [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}),
580 qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'DCRD'})
585 $cgi->param('referral_custnum') =~ /^(\d+)$/
586 or errorpage("Illegal referral_custnum");
587 my $cust_main = qsearchs('cust_main', { 'custnum' => $1 } )
588 or errorpage(emt("Customer [_1] not found",$1));
590 if ( $cgi->param('referral_depth') ) {
591 $cgi->param('referral_depth') =~ /^(\d+)$/
592 or errorpage(emt("Illegal referral_depth"));
597 [ $cust_main->referral_cust_main($depth) ];
603 foreach ( $cgi->param('last_type') ) {
607 $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/
608 or errorpage(emt("Illegal last name"));
611 if ( $last_type{'Exact'} || $last_type{'Fuzzy'} ) {
612 push @cust_main, qsearch( 'cust_main',
613 { 'last' => { 'op' => 'ILIKE',
614 'value' => $last } } );
616 push @cust_main, qsearch( 'cust_main',
617 { 'ship_last' => { 'op' => 'ILIKE',
618 'value' => $last } } )
619 if defined dbdef->table('cust_main')->column('ship_last');
622 if ( $last_type{'Substring'} || $last_type{'All'} ) {
624 push @cust_main, qsearch( 'cust_main',
625 { 'last' => { 'op' => 'ILIKE',
626 'value' => "%$last%" } } );
628 push @cust_main, qsearch( 'cust_main',
629 { 'ship_last' => { 'op' => 'ILIKE',
630 'value' => "%$last%" } } )
631 if defined dbdef->table('cust_main')->column('ship_last');
635 if ( $last_type{'Fuzzy'} || $last_type{'All'} ) {
636 push @cust_main, FS::cust_main::Search->fuzzy_search( { 'last' => $last } );
646 foreach ( $cgi->param('company_type') ) {
650 $cgi->param('company_text') =~
651 /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
652 or errorpage(emt("Illegal company"));
655 if ( $company_type{'Exact'} || $company_type{'Fuzzy'} ) {
656 push @cust_main, qsearch( 'cust_main',
657 { 'company' => { 'op' => 'ILIKE',
658 'value' => $company } } );
660 push @cust_main, qsearch( 'cust_main',
661 { 'ship_company' => { 'op' => 'ILIKE',
662 'value' => $company } } )
663 if defined dbdef->table('cust_main')->column('ship_last');
666 if ( $company_type{'Substring'} || $company_type{'All'} ) {
668 push @cust_main, qsearch( 'cust_main',
669 { 'company' => { 'op' => 'ILIKE',
670 'value' => "%$company%" } } );
672 push @cust_main, qsearch( 'cust_main',
673 { 'ship_company' => { 'op' => 'ILIKE',
674 'value' => "%$company%" } })
675 if defined dbdef->table('cust_main')->column('ship_last');
679 if ( $company_type{'Fuzzy'} || $company_type{'All'} ) {
680 push @cust_main, FS::cust_main::Search->fuzzy_search( { 'company' => $company } );
683 if ($company_type{'Sound-alike'}) {
692 $cgi->param('address2_text') =~
693 /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
694 or errorpage(emt("Illegal address2"));
697 push @cust_main, qsearch( 'cust_main',
698 { 'address2' => { 'op' => 'ILIKE',
699 'value' => $address2 } } );
700 push @cust_main, qsearch( 'cust_main',
701 { 'ship_address2' => { 'op' => 'ILIKE',
702 'value' => $address2 } } );
710 my $phone = $cgi->param('phone_text');
713 if ( $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ ) {
715 $phone .= " x$4" if $4;
716 } elsif ( $phone =~ /^(\d{3})(\d{4})$/ ) {
718 } elsif ( $phone =~ /^(\d{3,4})$/ ) {
721 errorpage(gettext('illegal_phone'). ": $phone");
724 my @fields = qw(daytime night fax);
725 push @fields, qw(ship_daytime ship_night ship_fax)
726 if defined dbdef->table('cust_main')->column('ship_last');
728 for my $field ( @fields ) {
729 push @cust_main, qsearch ( 'cust_main',
730 { $field => { 'op' => 'LIKE',
731 'value' => "%$phone%" } } );