{
'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.',
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;
}