custnum}++, @cust_main)
) {
@@ -398,6 +397,39 @@ END
END
}
+ foreach my $addl_col ( @addl_cols ) {
+ print "";
+ if ( $addl_col eq 'tickets' ) {
+ if ( @custom_priorities ) {
+ print '"
+ if @custom_priorities;
+ } else {
+ print $cust_main->get($addl_col);
+ }
+ print " | ";
+ }
+
my($n1)='';
foreach ( @{$all_pkgs{$custnum}} ) {
my $pkgnum = $_->pkgnum;
@@ -406,7 +438,7 @@ END
my $pkg = $part_pkg->pkg;
my $comment = $part_pkg->comment;
- my $pkgview = $p. 'view/cust_pkg.cgi?'. $pkgnum;
+ my $pkgview = "${p}view/cust_main.cgi?$custnum#cust_pkg$pkgnum";
my @cust_svc = @{shift @lol_cust_svc};
#my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } );
my $rowspan = scalar(@cust_svc) || 1;
@@ -452,6 +484,10 @@ sub custnum_sort {
$a->getfield('custnum') <=> $b->getfield('custnum');
}
+sub tickets_sort {
+ $b->getfield('tickets') <=> $a->getfield('tickets');
+}
+
sub custnumsearch {
my $custnum = $cgi->param('custnum_text');
@@ -526,28 +562,12 @@ sub lastsearch {
}
if ( $last_type{'Fuzzy'} || $last_type{'All'} ) {
-
- &FS::cust_main::check_and_rebuild_fuzzyfiles;
- my $all_last = &FS::cust_main::all_last;
-
- my %last;
- if ( $last_type{'Fuzzy'} || $last_type{'All'} ) {
- foreach ( amatch($last, [ qw(i) ], @$all_last) ) {
- $last{$_}++;
- }
- }
-
- #if ($last_type{'Sound-alike'}) {
- #}
-
- foreach ( keys %last ) {
- push @cust_main, qsearch('cust_main',{'last'=>$_});
- push @cust_main, qsearch('cust_main',{'ship_last'=>$_})
- if defined dbdef->table('cust_main')->column('ship_last');
- }
-
+ push @cust_main, FS::cust_main->fuzzy_search( { 'last' => $last } );
}
+ #if ($last_type{'Sound-alike'}) {
+ #}
+
\@cust_main;
}
@@ -589,26 +609,10 @@ sub companysearch {
}
if ( $company_type{'Fuzzy'} || $company_type{'All'} ) {
+ push @cust_main, FS::cust_main->fuzzy_search( { 'company' => $company } );
+ }
- &FS::cust_main::check_and_rebuild_fuzzyfiles;
- my $all_company = &FS::cust_main::all_company;
-
- my %company;
- if ( $company_type{'Fuzzy'} || $company_type{'All'} ) {
- foreach ( amatch($company, [ qw(i) ], @$all_company ) ) {
- $company{$_}++;
- }
- }
-
- #if ($company_type{'Sound-alike'}) {
- #}
-
- foreach ( keys %company ) {
- push @cust_main, qsearch('cust_main',{'company'=>$_});
- push @cust_main, qsearch('cust_main',{'ship_company'=>$_})
- if defined dbdef->table('cust_main')->column('ship_last');
- }
-
+ if ($company_type{'Sound-alike'}) {
}
\@cust_main;