diff options
author | ivan <ivan> | 2011-01-17 00:36:23 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-01-17 00:36:23 +0000 |
commit | 5172c91b7c39161e8e01e545e4c994ea04d69996 (patch) | |
tree | 82ec4a75053fad57e59d9f8e0bfd775ee5b3c992 | |
parent | 80df847c9b2c74bef341e9f86573c9a016c9fe99 (diff) |
searching kingcon's idea of legacy customer numbers without remembering leading 0s
-rw-r--r-- | FS/FS/Conf.pm | 1 | ||||
-rw-r--r-- | FS/FS/cust_main/Search.pm | 7 |
2 files changed, 7 insertions, 1 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 635f66423..c049d41f9 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -3338,6 +3338,7 @@ and customer address. Include units.', 'type' => 'select', 'select_hash' => [ '' => 'Numeric only', + '\d{7}' => 'Numeric only, exactly 7 digits', 'ww?d+' => 'Numeric with one or two letter prefix', ], }, diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 06a4522f4..45820728d 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -142,9 +142,14 @@ sub smart_search { } ); } + my $anum = $num; + if ( $conf->config('cust_main-agent_custid-format') =~ /^\\d\{(\d+)\}$/ ) { + $anum = sprintf("%0$1u", $num); + } + push @cust_main, qsearch( { 'table' => 'cust_main', - 'hashref' => { 'agent_custid' => $num, %options }, + 'hashref' => { 'agent_custid' => $anum, %options }, 'extra_sql' => " AND $agentnums_sql", #agent virtualization } ); |