diff options
author | ivan <ivan> | 2008-10-24 02:08:21 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-10-24 02:08:21 +0000 |
commit | 8032977c915b42634c70feee045b4ec42c3db98f (patch) | |
tree | 4ec7c340a9fdaf815f5b57af3704a8004b1813c0 /FS | |
parent | 4eea4e8c5dc178ccd3b478b80361896da027e481 (diff) |
fixes to facilitate using agent_custid as custnum, RT#4190
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/cust_main.pm | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 772942b6a..aa97d2233 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -5988,22 +5988,28 @@ sub smart_search { # custnum search (also try agent_custid), with some tweaking options if your # legacy cust "numbers" have letters - } elsif ( $search =~ /^\s*(\d+)\s*$/ + } + + if ( $search =~ /^\s*(\d+)\s*$/ || ( $conf->config('cust_main-agent_custid-format') eq 'ww?d+' && $search =~ /^\s*(\w\w?\d+)\s*$/ ) ) { - push @cust_main, qsearch( { - 'table' => 'cust_main', - 'hashref' => { 'custnum' => $1, %options }, - 'extra_sql' => " AND $agentnums_sql", #agent virtualization - } ); + my $num = $1; + + if ( $num <= 2147483647 ) { #need a bigint custnum? wow. + push @cust_main, qsearch( { + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $num, %options }, + 'extra_sql' => " AND $agentnums_sql", #agent virtualization + } ); + } push @cust_main, qsearch( { 'table' => 'cust_main', - 'hashref' => { 'agent_custid' => $1, %options }, + 'hashref' => { 'agent_custid' => $num, %options }, 'extra_sql' => " AND $agentnums_sql", #agent virtualization } ); |