searching kingcon's idea of legacy customer numbers without remembering leading 0s
authorivan <ivan>
Mon, 17 Jan 2011 00:36:23 +0000 (00:36 +0000)
committerivan <ivan>
Mon, 17 Jan 2011 00:36:23 +0000 (00:36 +0000)
FS/FS/Conf.pm
FS/FS/cust_main/Search.pm

index 635f664..c049d41 100644 (file)
@@ -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',
                      ],
   },
index 06a4522..4582072 100644 (file)
@@ -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
     } );