summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorivan <ivan>2009-07-15 22:49:33 +0000
committerivan <ivan>2009-07-15 22:49:33 +0000
commitadb66f1922f56a50212d42af9c608b4ee3c7f0a0 (patch)
tree5daf34d5c85a33d0c93371e0fb5d71c42778c8c1 /FS
parent103b35181e4d7bbf4c66fedc0550c9ad40564704 (diff)
add option to trim leading zeros when setting charged_party to accountcode, RT#5495
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Conf.pm7
-rw-r--r--FS/FS/cdr.pm5
2 files changed, 11 insertions, 1 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 70dfa6851..eb046ee42 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2751,6 +2751,13 @@ worry that config_items is freeside-specific and icky.
'type' => 'checkbox',
},
+ {
+ 'key' => 'cdr-charged_party-accountcode-trim_leading_0s',
+ 'section' => '',
+ 'description' => 'When setting the charged_party field of CDRs to the accountcode, trim any leading zeros.',
+ 'type' => 'checkbox',
+ },
+
# {
# 'key' => 'cdr-charged_party-truncate_prefix',
# 'section' => '',
diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm
index 723123a76..efccd4bae 100644
--- a/FS/FS/cdr.pm
+++ b/FS/FS/cdr.pm
@@ -349,7 +349,10 @@ sub set_charged_party {
if ( $conf->exists('cdr-charged_party-accountcode') && $self->accountcode ){
- $self->charged_party( $self->accountcode );
+ my $charged_party = $self->accountcode;
+ $charged_party =~ s/^0+//
+ if $conf->exists('cdr-charged_party-accountcode-trim_leading_0s');
+ $self->charged_party( $charged_party );
} else {