From 5172c91b7c39161e8e01e545e4c994ea04d69996 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 17 Jan 2011 00:36:23 +0000 Subject: [PATCH] searching kingcon's idea of legacy customer numbers without remembering leading 0s --- FS/FS/Conf.pm | 1 + FS/FS/cust_main/Search.pm | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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 } ); -- 2.11.0