X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fvoip_inbound.pm;h=aecbe33b16d0052f9701b9916b84da3b7d0ec9f9;hb=d5d62e40593d5153afd64527accad35b7f4fda2e;hp=15af706c1c899398287d6b68dc5f3b77c61afac0;hpb=40f3374957a5b709df2a54a69f7c9883d4b9ca38;p=freeside.git diff --git a/FS/FS/part_pkg/voip_inbound.pm b/FS/FS/part_pkg/voip_inbound.pm index 15af706c1..aecbe33b1 100644 --- a/FS/FS/part_pkg/voip_inbound.pm +++ b/FS/FS/part_pkg/voip_inbound.pm @@ -64,9 +64,13 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); }, 'use_cdrtypenum' => { 'name' => 'Only charge for CDRs where the CDR Type is set to this cdrtypenum: ', + 'validate' => \&FS::part_pkg::validate_number_blank, + 'js_validate' => 'digits: true', }, 'ignore_cdrtypenum' => { 'name' => 'Do not charge for CDRs where the CDR Type is set to this cdrtypenum: ', + 'validate' => \&FS::part_pkg::validate_number_blank, + 'js_validate' => 'digits: true', }, 'use_calltypenum' => { 'name' => 'Only charge for CDRs where the CDR Call Type is set to this cdrtypenum: ', @@ -120,6 +124,10 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); 'type' => 'checkbox', }, + 'bill_only_pkg_dates' => { 'name' => 'Only bill CDRs with a date during the package billing period', + 'type' => 'checkbox', + }, + #XXX also have option for an external db # 'cdr_location' => { 'name' => 'CDR database location' # 'type' => 'select', @@ -160,6 +168,7 @@ tie my %granularity, 'Tie::IxHash', FS::rate_detail::granularities(); use_duration output_format usage_mandate summarize_usage usage_section bill_every_call + bill_only_pkg_dates ) ], 'weight' => 42, @@ -239,12 +248,18 @@ sub calc_usage { ) { my $svc_phone = $cust_svc->svc_x; - my $cdr_search = $svc_phone->psearch_cdrs( + my %options = ( 'inbound' => 1, 'default_prefix' => $self->option('default_prefix'), 'status' => '', # unprocessed only 'for_update' => 1, ); + if ( $self->option('bill_only_pkg_dates') ) { + $options{'begin'} = $last_bill; + $options{'end'} = $$sdate; + } + + my $cdr_search = $svc_phone->psearch_cdrs(%options); $cdr_search->limit(1000); $cdr_search->increment(0); while ( my $cdr = $cdr_search->fetch ) {