X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcdr.pm;h=2a235cc412da731f0a57eeed83cb1997823e17a3;hb=a70e4bb88f298f93292380d1e2feb80e1baa13f8;hp=b640bc63e3e3bf138e570e07c630d2b81ebc03ef;hpb=39120f69d4372781aba0df58d06736be450009e1;p=freeside.git diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index b640bc63e..2a235cc41 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -295,9 +295,9 @@ or to the dst field if it is a toll free number. sub set_charged_party { my $self = shift; - unless ( $self->charged_party ) { + my $conf = new FS::Conf; - my $conf = new FS::Conf; + unless ( $self->charged_party ) { if ( $conf->exists('cdr-charged_party-accountcode') && $self->accountcode ){ @@ -315,6 +315,14 @@ sub set_charged_party { } + my $prefix = $conf->config('cdr-charged_party-truncate_prefix'); + my $prefix_len = length($prefix); + my $trunc_len = $conf->config('cdr-charged_party-truncate_length'); + + $self->charged_party( substr($self->charged_party, 0, $trunc_len) ) + if $prefix_len && $trunc_len + && substr($self->charged_party, 0, $prefix_len) eq $prefix; + } =item set_status_and_rated_price STATUS [ RATED_PRICE ]