From adb66f1922f56a50212d42af9c608b4ee3c7f0a0 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 15 Jul 2009 22:49:33 +0000 Subject: [PATCH] add option to trim leading zeros when setting charged_party to accountcode, RT#5495 --- FS/FS/Conf.pm | 7 +++++++ FS/FS/cdr.pm | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) 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 { -- 2.11.0