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('(bill) name') |h %></TH>
85 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('company') |h %></TH>
87 %if ( defined dbdef->table('cust_main')->column('ship_last') ) {
88 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('(service) name') |h %></TH>
89 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('company') |h %></TH>
92 %foreach my $addl_header ( @addl_headers ) {
93 <TH CLASS="grid" BGCOLOR="#cccccc"><% $addl_header %></TH>
96 <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Packages') |h %></TH>
97 <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN="2"><% mt('Services') |h %></TH>
100 % my $bgcolor1 = '#eeeeee';
101 % my $bgcolor2 = '#ffffff';
104 % my(%saw,$cust_main);
105 % foreach $cust_main (
106 % sort $sortby grep(!$saw{$_->custnum}++, @cust_main)
109 % if ( $bgcolor eq $bgcolor1 ) {
110 % $bgcolor = $bgcolor2;
112 % $bgcolor = $bgcolor1;
115 % my($custnum,$last,$first,$company)=(
116 % $cust_main->custnum,
117 % $cust_main->getfield('last'),
118 % $cust_main->getfield('first'),
119 % $cust_main->company,
124 % foreach my $cust_pkg ( @{$all_pkgs{$custnum}} ) {
125 % my %cust_svc_by_svcpart;
127 % foreach my $part_svc ( $cust_pkg->part_svc ) {
128 % my $svcpart = $part_svc->svcpart;
129 % my $num_cust_svc = $cust_pkg->num_cust_svc($svcpart);
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} = [ $cust_pkg->cust_svc($svcpart) ];
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 % if ( defined dbdef->table('cust_main')->column('ship_last') ) {
176 % my($ship_last,$ship_first,$ship_company)=(
177 % $cust_main->ship_last || $cust_main->getfield('last'),
178 % $cust_main->ship_last ? $cust_main->ship_first : $cust_main->first,
179 % $cust_main->ship_last ? $cust_main->ship_company : $cust_main->company,
181 % my $pship_company = $ship_company
182 % ? qq!<A HREF="$view"><FONT SIZE=-1>$ship_company</FONT></A>!
183 % : '<FONT SIZE=-1> </FONT>';
186 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
187 <A HREF="<% $view %>"><FONT SIZE=-1><% "$ship_last, $ship_first" %></FONT></A>
189 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %>>
190 <% $pship_company %></A>
194 % foreach my $addl_col ( @addl_cols ) {
195 % if ( $addl_col eq 'tickets' ) {
196 % if ( @custom_priorities ) {
198 <TD CLASS="inv" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %> ALIGN=right>
200 <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>
201 % foreach my $priority ( @custom_priorities, '' ) {
203 % FS::TicketSystem->num_customer_tickets($custnum,$priority);
205 % $ahref= '<A HREF="'.
206 % FS::TicketSystem->href_customer_tickets($custnum,$priority).
212 <FONT SIZE=-1><% $ahref.$num %></A></FONT>
215 <FONT SIZE=-1><% $ahref %><% $priority || '<i>('.emt('none').')</i>' %></A></FONT>
221 <TH ALIGN=right STYLE="border-top: dashed 1px black">
224 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %> ALIGN=right>
228 % $ahref = '<A HREF="'.
229 % FS::TicketSystem->href_customer_tickets($custnum).
231 % if $cust_main->get($addl_col);
234 <% $ahref %><% $cust_main->get($addl_col) %></A>
235 % if ( @custom_priorities ) {
238 <TH ALIGN=left STYLE="border-top: dashed 1px black">
239 <FONT SIZE=-1><% ${ahref} %>Total</A><FONT>
248 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN=<% $rowspan %> ALIGN=right><FONT SIZE=-1>
249 <% $cust_main->get($addl_col) %>
256 % foreach ( @{$all_pkgs{$custnum}} ) {
257 % my $pkgnum = $_->pkgnum;
258 % my $part_pkg = $_->part_pkg;
260 % my $pkg_comment = $part_pkg->pkg_comment(nopkgpart => 1);
261 % my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
263 % : ';show=packages';
264 % my $frag = "cust_pkg$pkgnum"; #hack for IE ignoring real #fragment
265 % my $pkgview = "${p}view/cust_main.cgi?custnum=$custnum$show;fragment=$frag#$frag";
266 % # cust_svc stuff, built earlier
267 % my %cust_svc_by_svcpart = %{ shift @all_cust_svc };
268 % my $pkg_rowspan = shift @pkg_rowspans;
270 <% $n1 %><TD CLASS="grid" BGCOLOR="<% $bgcolor %>" ROWSPAN="<% $pkg_rowspan%>">
271 <A HREF="<% $pkgview %>"><FONT SIZE=-1><% $pkg_comment |h %></FONT></A>
275 % my $td = '<TD CLASS="grid" BGCOLOR="'.$bgcolor.'">';
277 % foreach my $svcpart ( sort keys %cust_svc_by_svcpart ) { #sort order?
278 % my $these = $cust_svc_by_svcpart{$svcpart};
279 % if ( $these->[0] eq 'summarize' ) {
280 % my $part_svc = $these->[1];
281 % my $num_cust_svc = $these->[2];
284 % # link opens a new search for this pkgnum/svcpart combo
285 % my $href = $p.'search/cust_pkg_svc.html?svcpart='.$svcpart.
286 % ';pkgnum='.$pkgnum;
288 <A HREF="<% $href %>"><% $part_svc->svc %></A>
291 <A HREF="<% $href %>"><B>(<% mt("view all [_1]", $num_cust_svc) |h %>)</B></A>
295 <% $td %><& /elements/search-cust_svc.html,
296 'svcpart' => $svcpart,
298 'svcdb' => $part_svc->svcdb,
302 % elsif ( scalar @$these ) { # do not summarize
303 % foreach my $cust_svc ( @$these ) {
306 <% FS::UI::Web::svc_link($m, $cust_svc->part_svc, $cust_svc) %>
309 <% FS::UI::Web::svc_label_link($m, $cust_svc->part_svc, $cust_svc) %>
312 % } #foreach $cust_svc
314 % } # foreach $svcpart
316 % unless ( %cust_svc_by_svcpart ) {
317 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" COLSPAN=2> </TD>
323 % unless ( @{$all_pkgs{$custnum}} ) {
324 <TD CLASS="grid" BGCOLOR="<% $bgcolor %>" COLSPAN=3> </TD>
332 <& /elements/footer.html &>
334 my $curuser = $FS::CurrentUser::CurrentUser;
337 unless $curuser->access_right('List all customers');
339 my $conf = new FS::Conf;
340 my $maxrecords = $conf->config('maxsearchrecordsperpage');
341 # summarize more than this many services of the same svcpart
342 my $large_pkg_size = $conf->config('cust_pkg-large_pkg_size') || 0;
345 $limit .= "LIMIT $maxrecords" if $maxrecords;
347 my $offset = $cgi->param('offset') || 0;
348 $limit .= " OFFSET $offset" if $offset;
352 my(@cust_main, $sortby, $orderby);
354 my @addl_headers = ();
356 if ( $cgi->param('browse')
357 || $cgi->param('otaker_on')
358 || $cgi->param('agentnum_on')
363 if ( $cgi->param('browse') ) {
364 my $query = $cgi->param('browse');
365 if ( $query eq 'custnum' ) {
366 if ( $conf->exists('cust_main-default_agent_custid') ) {
367 $sortby=\*display_custnum_sort;
368 $orderby = "ORDER BY CASE WHEN agent_custid IS NOT NULL AND agent_custid != '' THEN CAST(agent_custid AS BIGINT) ELSE custnum END";
370 $sortby=\*custnum_sort;
371 $orderby = "ORDER BY custnum";
373 } elsif ( $query eq 'last' ) {
375 $orderby = "ORDER BY LOWER(last || ' ' || first)";
376 } elsif ( $query eq 'company' ) {
377 $sortby=\*company_sort;
378 $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
379 } elsif ( $query eq 'tickets' ) {
380 $sortby = \*tickets_sort;
381 $orderby = "ORDER BY tickets DESC";
382 push @select, FS::TicketSystem->sql_num_customer_tickets. " as tickets";
383 push @addl_headers, 'Tickets';
384 push @addl_cols, 'tickets';
385 } elsif ( $query eq 'uspsunvalid' ) {
386 $search{'country'} = 'US';
387 $sortby=\*custnum_sort;
388 $orderby = "ORDER BY custnum";
390 die "unknown browse field $query";
393 $sortby = \*last_sort; #??
394 $orderby = "ORDER BY LOWER(last || ' ' || first)"; #??
397 if ( $cgi->param('otaker_on') ) {
399 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
400 $cgi->param('otaker') =~ /^(\w{1,32})$/ or errorpage("Illegal otaker");
401 $search{otaker} = $1;
402 } elsif ( $cgi->param('agentnum_on') ) {
403 $cgi->param('agentnum') =~ /^(\d+)$/ or errorpage("Illegal agentnum");
404 $search{agentnum} = $1;
411 if ( $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
412 || ( $conf->exists('hidecancelledcustomers')
413 && ! $cgi->param('showcancelledcustomers') )
415 push @qual, FS::cust_main->uncancel_sql;
418 push @qual, FS::cust_main->cancel_sql if $cgi->param('cancelled');
419 push @qual, FS::cust_main->prospect_sql if $cgi->param('prospect');
420 push @qual, FS::cust_main->active_sql if $cgi->param('active');
421 push @qual, FS::cust_main->inactive_sql if $cgi->param('inactive');
422 push @qual, FS::cust_main->susp_sql if $cgi->param('suspended');
425 my $qual = join(' AND ',
426 map { "$_ = ". dbh->quote($search{$_}) } keys %search );
428 my $addl_qual = join(' AND ', @qual);
430 #here is the agent virtualization
431 $addl_qual .= ( $addl_qual ? ' AND ' : '' ).
432 $FS::CurrentUser::CurrentUser->agentnums_sql;
434 if ( $cgi->param('browse') && $cgi->param('browse') eq 'uspsunvalid' ) {
435 $addl_qual .= ' AND ( length(zip) < 9 OR upper(address1) != address1 OR upper(city) != city ) ';
439 $qual .= ' AND ' if $qual;
443 $qual = " WHERE $qual" if $qual;
444 my $statement = "SELECT COUNT(*) FROM cust_main $qual";
445 my $sth = dbh->prepare($statement) or die dbh->errstr." preparing $statement";
446 $sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
448 $total = $sth->fetchrow_arrayref->[0];
452 $addl_qual = " AND $addl_qual";
454 $addl_qual = " WHERE $addl_qual";
460 $select = 'cust_main.*, '. join (', ', @select);
465 @cust_main = qsearch('cust_main', \%search, $select,
466 "$addl_qual $orderby $limit" );
470 $sortby = \*last_sort;
472 push @cust_main, @{&custnumsearch}
473 if $cgi->param('custnum_on') && $cgi->param('custnum_text');
474 push @cust_main, @{&cardsearch}
475 if $cgi->param('card_on') && $cgi->param('card');
476 push @cust_main, @{&lastsearch}
477 if $cgi->param('last_on') && $cgi->param('last_text');
478 push @cust_main, @{&companysearch}
479 if $cgi->param('company_on') && $cgi->param('company_text');
480 push @cust_main, @{&address2search}
481 if $cgi->param('address2_on') && $cgi->param('address2_text');
482 push @cust_main, @{&phonesearch}
483 if $cgi->param('phone_on') && $cgi->param('phone_text');
484 push @cust_main, @{&referralsearch}
485 if $cgi->param('referral_custnum');
487 if ( $cgi->param('company_on') && $cgi->param('company_text') ) {
488 $sortby = \*company_sort;
489 push @cust_main, @{&companysearch};
492 if ( $cgi->param('search_cust') ) {
493 $sortby = \*company_sort;
494 $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
495 push @cust_main, smart_search(
496 'search' => scalar($cgi->param('search_cust')),
497 'no_fuzzy_on_exact' => ! ( $curuser->option('enable_fuzzy_on_exact')
498 || $conf->exists('enable_fuzzy_on_exact')
503 @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main
504 if ! $cgi->param('cancelled')
506 $cgi->param('showcancelledcustomers') eq '0' #see if it was set by me
507 || ( $conf->exists('hidecancelledcustomers')
508 && ! $cgi->param('showcancelledcustomers') )
512 @cust_main = grep { !$saw{$_->custnum}++ } @cust_main;
516 if ( $conf->exists('hidecancelledpackages' ) ) {
517 %all_pkgs = map { $_->custnum => [ $_->ncancelled_pkgs ] } @cust_main;
519 %all_pkgs = map { $_->custnum => [ $_->all_pkgs ] } @cust_main;
523 lc($a->getfield('last')) cmp lc($b->getfield('last'))
524 || lc($a->first) cmp lc($b->first);
528 return -1 if $a->company && ! $b->company;
529 return 1 if ! $a->company && $b->company;
530 lc($a->company) cmp lc($b->company)
531 || lc($a->getfield('last')) cmp lc($b->getfield('last'))
532 || lc($a->first) cmp lc($b->first);;
535 sub display_custnum_sort {
536 $a->display_custnum <=> $b->display_custnum;
540 $a->getfield('custnum') <=> $b->getfield('custnum');
544 $b->getfield('tickets') <=> $a->getfield('tickets');
549 my $custnum = $cgi->param('custnum_text');
551 $custnum =~ /^(\d{1,23})$/ or errorpage(emt("Illegal customer number"));
554 [ qsearchs('cust_main', { 'custnum' => $custnum } ) ];
559 my($card)=$cgi->param('card');
561 $card =~ /^(\d{13,16}|\d{8,9})$/ or errorpage(emt("Illegal card number"));
564 [ qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'CARD'}),
565 qsearch('cust_main',{'payinfo'=>$payinfo, 'payby'=>'DCRD'})
570 $cgi->param('referral_custnum') =~ /^(\d+)$/
571 or errorpage("Illegal referral_custnum");
572 my $cust_main = qsearchs('cust_main', { 'custnum' => $1 } )
573 or errorpage(emt("Customer [_1] not found",$1));
575 if ( $cgi->param('referral_depth') ) {
576 $cgi->param('referral_depth') =~ /^(\d+)$/
577 or errorpage(emt("Illegal referral_depth"));
582 [ $cust_main->referral_cust_main($depth) ];
588 foreach ( $cgi->param('last_type') ) {
592 $cgi->param('last_text') =~ /^([\w \,\.\-\']*)$/
593 or errorpage(emt("Illegal last name"));
596 if ( $last_type{'Exact'} || $last_type{'Fuzzy'} ) {
597 push @cust_main, qsearch( 'cust_main',
598 { 'last' => { 'op' => 'ILIKE',
599 'value' => $last } } );
601 push @cust_main, qsearch( 'cust_main',
602 { 'ship_last' => { 'op' => 'ILIKE',
603 'value' => $last } } )
604 if defined dbdef->table('cust_main')->column('ship_last');
607 if ( $last_type{'Substring'} || $last_type{'All'} ) {
609 push @cust_main, qsearch( 'cust_main',
610 { 'last' => { 'op' => 'ILIKE',
611 'value' => "%$last%" } } );
613 push @cust_main, qsearch( 'cust_main',
614 { 'ship_last' => { 'op' => 'ILIKE',
615 'value' => "%$last%" } } )
616 if defined dbdef->table('cust_main')->column('ship_last');
620 if ( $last_type{'Fuzzy'} || $last_type{'All'} ) {
621 push @cust_main, FS::cust_main::Search->fuzzy_search( { 'last' => $last } );
631 foreach ( $cgi->param('company_type') ) {
635 $cgi->param('company_text') =~
636 /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
637 or errorpage(emt("Illegal company"));
640 if ( $company_type{'Exact'} || $company_type{'Fuzzy'} ) {
641 push @cust_main, qsearch( 'cust_main',
642 { 'company' => { 'op' => 'ILIKE',
643 'value' => $company } } );
645 push @cust_main, qsearch( 'cust_main',
646 { 'ship_company' => { 'op' => 'ILIKE',
647 'value' => $company } } )
648 if defined dbdef->table('cust_main')->column('ship_last');
651 if ( $company_type{'Substring'} || $company_type{'All'} ) {
653 push @cust_main, qsearch( 'cust_main',
654 { 'company' => { 'op' => 'ILIKE',
655 'value' => "%$company%" } } );
657 push @cust_main, qsearch( 'cust_main',
658 { 'ship_company' => { 'op' => 'ILIKE',
659 'value' => "%$company%" } })
660 if defined dbdef->table('cust_main')->column('ship_last');
664 if ( $company_type{'Fuzzy'} || $company_type{'All'} ) {
665 push @cust_main, FS::cust_main::Search->fuzzy_search( { 'company' => $company } );
668 if ($company_type{'Sound-alike'}) {
677 $cgi->param('address2_text') =~
678 /^([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=]*)$/
679 or errorpage(emt("Illegal address2"));
682 push @cust_main, qsearch( 'cust_main',
683 { 'address2' => { 'op' => 'ILIKE',
684 'value' => $address2 } } );
685 push @cust_main, qsearch( 'cust_main',
686 { 'ship_address2' => { 'op' => 'ILIKE',
687 'value' => $address2 } } );
695 my $phone = $cgi->param('phone_text');
698 if ( $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ ) {
700 $phone .= " x$4" if $4;
701 } elsif ( $phone =~ /^(\d{3})(\d{4})$/ ) {
703 } elsif ( $phone =~ /^(\d{3,4})$/ ) {
706 errorpage(gettext('illegal_phone'). ": $phone");
709 my @fields = qw(daytime night fax);
710 push @fields, qw(ship_daytime ship_night ship_fax)
711 if defined dbdef->table('cust_main')->column('ship_last');
713 for my $field ( @fields ) {
714 push @cust_main, qsearch ( 'cust_main',
715 { $field => { 'op' => 'LIKE',
716 'value' => "%$phone%" } } );