FS::cust_main::Billing_Discount
FS::otaker_Mixin FS::payinfo_Mixin FS::cust_main_Mixin
FS::geocode_Mixin
+ FS::o2m_Common
FS::Record
);
use vars qw( $DEBUG $me $conf
$self->signupdate(time) unless $self->signupdate;
- $self->censusyear($conf->config('census_year')) if $self->censustract;
+ $self->censusyear($conf->config('census_year')||'2012') if $self->censustract;
$self->auto_agent_custid()
if $conf->config('cust_main-auto_agent_custid') && ! $self->agent_custid;
if ( $self->censustract ne '' and $self->censustract ne $old->censustract ) {
# update censusyear whenever tract code changes
- $self->censusyear($conf->config('census_year'));
+ $self->censusyear($conf->config('census_year')||'2012');
}
return $error if $error;
}
- if ( $conf->exists('cust_main-require_phone')
+ if ( $conf->exists('cust_main-require_phone', $self->agentnum)
&& ! length($self->daytime) && ! length($self->night) && ! length($self->mobile)
) {
}
return "Email address required"
- if $conf->exists('cust_main-require_invoicing_list_email')
+ if $conf->exists('cust_main-require_invoicing_list_email', $self->agentnum)
&& ! grep { $_ !~ /^([A-Z]+)$/ } @$arrayref;
'';
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;
}