summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-11-28 01:40:17 +0000
committerivan <ivan>2011-11-28 01:40:17 +0000
commit7109bfc5e06bbabb3d61c6298ce59cf287541667 (patch)
treeb15d76145109fe5ddca96c42f3ddd77c56e1eabd
parentf287c6a2314cd15bb2bd0398bc3378d34f945cbd (diff)
add inter.net numbering on freeside custnum instead, RT#15326
-rw-r--r--FS/FS/Conf.pm9
-rw-r--r--FS/FS/cust_main.pm12
-rw-r--r--FS/FS/cust_main/Search.pm13
3 files changed, 24 insertions, 10 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index e27a88584..d4983ae48 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3779,11 +3779,18 @@ and customer address. Include units.',
'type' => 'select',
'select_hash' => [ '' => 'No',
'1YMMXXXXXXXX' => '1YMMXXXXXXXX',
- '1001XXXXXXXX' => '1001XXXXXXXX',
],
},
{
+ 'key' => 'cust_main-custnum-display_prefix',
+ 'section' => 'UI',
+ 'description' => 'Prefix the customer number with this number for display purposes (and zero fill to 8 digits).',
+ 'type' => 'text',
+ #and then probably agent-virt this to merge these instances
+ },
+
+ {
'key' => 'cust_main-default_areacode',
'section' => 'UI',
'description' => 'Default area code for customers.',
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 32912afe7..12dc9ef43 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -676,15 +676,6 @@ sub auto_agent_custid {
$counter->unlock;
- } elsif ( $format eq '1001XXXXXXXX' ) {
-
- my $counter = new File::CounterFile 'cust_main.agent_custid';
- $counter->lock;
-
- $agent_custid = '1001'. $counter->inc;
-
- $counter->unlock;
-
} else {
die "Unknown cust_main-auto_agent_custid format: $format";
}
@@ -3888,6 +3879,9 @@ sub display_custnum {
my $self = shift;
if ( $conf->exists('cust_main-default_agent_custid') && $self->agent_custid ){
return $self->agent_custid;
+ } elsif ( $conf->config('cust_main-custnum-display_prefix') ) {
+ return $conf->config('cust_main-custnum-display_prefix').
+ sprintf('%08d', $self->custnum)
} else {
return $self->custnum;
}
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 5636fc6e4..e017400a5 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -142,6 +142,19 @@ sub smart_search {
} );
}
+ #if this becomes agent-virt need to get a list of all prefixes the current
+ #user can see (via their agents)
+ my $prefix = $conf->config('cust_main-custnum-display_prefix');
+ if ( $prefix && $prefix eq substr($num, 0, length($prefix)) ) {
+ push @cust_main, qsearch( {
+ 'table' => 'cust_main',
+ 'hashref' => { 'custnum' => 0 + substr($num, length($prefix)),
+ %options,
+ },
+ 'extra_sql' => " AND $agentnums_sql", #agent virtualization
+ } );
+ }
+
push @cust_main, qsearch( {
'table' => 'cust_main',
'hashref' => { 'agent_custid' => $num, %options },