summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2010-07-13 22:55:07 +0000
committerivan <ivan>2010-07-13 22:55:07 +0000
commit4b839572abcdc6341e8c0f3cf85eb232ac2b4609 (patch)
treef3dd20311c2820d204c0ec50cd911a640292d696
parent99af479c12baf1f7da52e06841f0ac4f4832d766 (diff)
Optional alternate rate plan when accountcode is toll free, RT#8084
-rw-r--r--FS/FS/part_pkg/voip_cdr.pm19
-rwxr-xr-xhttemplate/edit/part_pkg.cgi4
2 files changed, 21 insertions, 2 deletions
diff --git a/FS/FS/part_pkg/voip_cdr.pm b/FS/FS/part_pkg/voip_cdr.pm
index 0cb675f97..f589580f1 100644
--- a/FS/FS/part_pkg/voip_cdr.pm
+++ b/FS/FS/part_pkg/voip_cdr.pm
@@ -162,6 +162,16 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
'type' => 'checkbox',
},
+ 'accountcode_tollfree_ratenum' => {
+ 'name' => 'Optional alternate rate plan when accountcode is toll free',
+ 'type' => 'select',
+ 'select_table' => 'rate',
+ 'select_key' => 'ratenum',
+ 'select_label' => 'ratename',
+ 'disable_empty' => 0,
+ 'empty_label' => '',
+ },
+
'skip_dst_length_less' => { 'name' => 'Do not charge for CDRs where the destination is less than this many digits:',
},
@@ -240,6 +250,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities();
use_disposition_taqua use_carrierid use_cdrtypenum
skip_dcontext skip_dstchannel_prefix
skip_src_length_more noskip_src_length_accountcode_tollfree
+ accountcode_tollfree_ratenum
skip_dst_length_less skip_lastapp
use_duration
411_rewrite
@@ -436,8 +447,12 @@ sub calc_usage {
#asterisks here causes inserting the detail to barf, so:
$pretty_destnum =~ s/\*//g;
- $rate = qsearchs('rate', { 'ratenum' => $ratenum })
- or die "ratenum $ratenum not found!";
+ my $eff_ratenum = $cdr->is_tollfree('accountcode')
+ ? $cust_pkg->part_pkg->option('accountcode_tollfree_ratenum')
+ : '';
+ $eff_ratenum ||= $ratenum;
+ $rate = qsearchs('rate', { 'ratenum' => $eff_ratenum })
+ or die "ratenum $eff_ratenum not found!";
my @ltime = localtime($cdr->startdate);
$weektime = $ltime[0] +
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index c8b7ecb58..deefa9cc1 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -563,6 +563,10 @@ my $html_bottom = sub {
$html .= ' MULTIPLE'
if $href->{$field}{'type'} eq 'select_multiple';
$html .= qq! NAME="${layer}__$field">!;
+
+ $html .= '<OPTION VALUE="">'. $href->{$field}{'empty_label'}
+ if exists($href->{$field}{'disable_empty'})
+ && ! $href->{$field}{'disable_empty'};
if ( $href->{$field}{'select_table'} ) {
foreach my $record (