From: ivan Date: Wed, 15 Jul 2009 22:49:33 +0000 (+0000) Subject: add option to trim leading zeros when setting charged_party to accountcode, RT#5495 X-Git-Tag: root_of_svc_elec_features~1017 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=adb66f1922f56a50212d42af9c608b4ee3c7f0a0 add option to trim leading zeros when setting charged_party to accountcode, RT#5495 --- 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 {