summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2012-03-08 14:56:23 -0800
committerMark Wells <mark@freeside.biz>2012-03-08 14:56:23 -0800
commit29076f9f299a582438aa731c2e0fb340837efd0d (patch)
treeee991ccf5ffa263af85a4466845436d82d89214f
parent7ae4e66432f3af0e6c3072a098b821cc3d1fe102 (diff)
option to adjust zero-filling of custnum, #16815
-rw-r--r--FS/FS/Conf.pm9
-rw-r--r--FS/FS/cust_main.pm6
2 files changed, 13 insertions, 2 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index ac80a55bd..2bc1f1960 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3848,12 +3848,19 @@ and customer address. Include units.',
{
'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).',
+ 'description' => 'Prefix the customer number with this string for display purposes.',
'type' => 'text',
#and then probably agent-virt this to merge these instances
},
{
+ 'key' => 'cust_main-custnum-display_length',
+ 'section' => 'UI',
+ 'description' => 'Zero fill the customer number to this many digits for display purposes.',
+ 'type' => 'text',
+ },
+
+ {
'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 1da788cc6..069d5b6aa 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3961,11 +3961,15 @@ cust_main-default_agent_custid is set and it has a value, custnum otherwise.
sub display_custnum {
my $self = shift;
+ my $length = $conf->config('cust_main-custnum-display_length');
if ( $conf->exists('cust_main-default_agent_custid') && $self->agent_custid ){
return $self->agent_custid;
} elsif ( $conf->config('cust_main-custnum-display_prefix') ) {
+ $length = 8 if !defined($length);
return $conf->config('cust_main-custnum-display_prefix').
- sprintf('%08d', $self->custnum)
+ sprintf('%0'.$length.'d', $self->custnum)
+ } elsif ( $length ) {
+ return sprintf('%0'.$length.'d', $self->custnum);
} else {
return $self->custnum;
}