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->censusyear($conf->config('census_year')||'2012');
}
+ return "Invoicing locale is required"
+ if $old->locale
+ && ! $self->locale
+ && $conf->exists('cust_main-require_locale');
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
$self->payname($1);
}
+ return "Please select an invoicing locale"
+ if ! $self->locale
+ && ! $self->custnum
+ && $conf->exists('cust_main-require_locale');
+
foreach my $flag (qw( tax spool_cdr squelch_cdr archived email_csv_cdr )) {
$self->$flag() =~ /^(Y?)$/ or return "Illegal $flag: ". $self->$flag();
$self->$flag($1);
sub display_custnum {
my $self = shift;
+
+ my $prefix = $conf->config('cust_main-custnum-display_prefix', $self->agentnum) || '';
+ if ( my $special = $conf->config('cust_main-custnum-display_special') ) {
+ if ( $special eq 'CoStAg' ) {
+ $prefix = uc( join('',
+ $self->country,
+ ($self->state =~ /^(..)/),
+ $prefix || ($self->agent->agent =~ /^(..)/)
+ ) );
+ }
+ elsif ( $special eq 'CoStCl' ) {
+ $prefix = uc( join('',
+ $self->country,
+ ($self->state =~ /^(..)/),
+ ($self->classnum ? $self->cust_class->classname =~ /^(..)/ : '__')
+ ) );
+ }
+ # add any others here if needed
+ }
+
+ 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') ) {
- return $conf->config('cust_main-custnum-display_prefix').
- sprintf('%08d', $self->custnum)
+ } elsif ( $prefix ) {
+ $length = 8 if !defined($length);
+ return $prefix .
+ sprintf('%0'.$length.'d', $self->custnum)
+ } elsif ( $length ) {
+ return sprintf('%0'.$length.'d', $self->custnum);
} else {
return $self->custnum;
}
return;
}
+#starting to take quite a while for big dbs
+# - seq scan of h_cust_main (yuck), but not going to index paycvv, so
+# - seq scan of cust_main on signupdate... index signupdate? will that help?
+# - seq scan of cust_main on paydate... index on substrings? maybe set an
+# upgrade journal flag now that we have that, yyyy-m-dd paydates are ancient
+# - seq scan of cust_main on payinfo.. certainly not going toi ndex that...
+# upgrade journal again? this is also an ancient problem
+# - otaker upgrade? journal and call it good? (double check to make sure
+# we're not still setting otaker here)
+
sub _upgrade_data { #class method
my ($class, %opts) = @_;