diff options
author | ivan <ivan> | 2002-01-09 13:29:34 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-01-09 13:29:34 +0000 |
commit | d73c1796de9df0ed14469f745d985cd706137d6d (patch) | |
tree | 39ce3d97b90c29c069f9c7a35b684067f6f1a81b | |
parent | 69a0a7504f84aa9bb1f204d1f3522e1520e0885e (diff) |
update fuzzy cache files on customer replace.
do an exact search along with the fuzzy search (webui)
-rw-r--r-- | FS/FS/cust_main.pm | 22 | ||||
-rwxr-xr-x | httemplate/search/cust_main.cgi | 24 |
2 files changed, 34 insertions, 12 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 3e92417c4..1a9d43e94 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -347,6 +347,7 @@ sub insert { } } + #false laziness with sub replace my $queue = new FS::queue { 'job' => 'FS::cust_main::append_fuzzyfiles' }; $error = $queue->insert($self->getfield('last'), $self->company); if ( $error ) { @@ -362,6 +363,7 @@ sub insert { return "queueing job (transaction rolled back): $error"; } } + #eslaf $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -509,6 +511,24 @@ sub replace { $self->invoicing_list( $invoicing_list ); } + #false laziness with sub insert + my $queue = new FS::queue { 'job' => 'FS::cust_main::append_fuzzyfiles' }; + $error = $queue->insert($self->getfield('last'), $self->company); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "queueing job (transaction rolled back): $error"; + } + + if ( defined $self->dbdef_table->column('ship_last') && $self->ship_last ) { + $queue = new FS::queue { 'job' => 'FS::cust_main::append_fuzzyfiles' }; + $error = $queue->insert($self->getfield('last'), $self->company); + if ( $error ) { + $dbh->rollback if $oldAutoCommit; + return "queueing job (transaction rolled back): $error"; + } + } + #eslaf + $dbh->commit or die $dbh->errstr if $oldAutoCommit; ''; @@ -1946,7 +1966,7 @@ sub append_fuzzyfiles { =head1 VERSION -$Id: cust_main.pm,v 1.53 2001-12-28 15:14:01 ivan Exp $ +$Id: cust_main.pm,v 1.54 2002-01-09 13:29:33 ivan Exp $ =head1 BUGS diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 4d3ec3564..65db0a815 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -1,5 +1,5 @@ <% -#<!-- $Id: cust_main.cgi,v 1.19 2001-12-26 05:19:01 ivan Exp $ --> +#<!-- $Id: cust_main.cgi,v 1.20 2002-01-09 13:29:34 ivan Exp $ --> use strict; #use vars qw( $conf %ncancelled_pkgs %all_pkgs $cgi @cust_main $sortby ); @@ -399,17 +399,18 @@ sub lastsearch { or eidiot "Illegal last name"; my($last)=$1; - if ( $last_type{'Exact'} - && ! $last_type{'Fuzzy'} - # && ! $last_type{'Sound-alike'} - ) { +# if ( $last_type{'Exact'} +# && ! $last_type{'Fuzzy'} +# # && ! $last_type{'Sound-alike'} +# ) { push @cust_main, qsearch('cust_main',{'last'=>$last}); push @cust_main, qsearch('cust_main',{'ship_last'=>$last}) if defined dbdef->table('cust_main')->column('ship_last'); - } else { +# } else { + if ( $last_type{'Fuzzy'} ) { &FS::cust_main::check_and_rebuild_fuzzyfiles; my $all_last = &FS::cust_main::all_last; @@ -445,17 +446,18 @@ sub companysearch { or eidiot "Illegal company"; my($company)=$1; - if ( $company_type{'Exact'} - && ! $company_type{'Fuzzy'} - # && ! $company_type{'Sound-alike'} - ) { +# if ( $company_type{'Exact'} +# && ! $company_type{'Fuzzy'} +# # && ! $company_type{'Sound-alike'} +# ) { push @cust_main, qsearch('cust_main',{'company'=>$company}); push @cust_main, qsearch('cust_main',{'ship_company'=>$company}) if defined dbdef->table('cust_main')->column('ship_last'); - } else { +# } else { + if ( $company_type{'Fuzzy'} ) { &FS::cust_main::check_and_rebuild_fuzzyfiles; my $all_company = &FS::cust_main::all_company; |