X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fvoip_sqlradacct.pm;h=299d5c1d02560404ddeed2f83ab1667bbb7c281a;hb=0586dafb71594726138cd3b7b721b9f1a0b79ae2;hp=a2f998a17fd702bb4b9db6fcd2318ddc098d9177;hpb=4045b74f9dbb7d195772e404966b20a18262b07e;p=freeside.git diff --git a/FS/FS/part_pkg/voip_sqlradacct.pm b/FS/FS/part_pkg/voip_sqlradacct.pm index a2f998a17..299d5c1d0 100644 --- a/FS/FS/part_pkg/voip_sqlradacct.pm +++ b/FS/FS/part_pkg/voip_sqlradacct.pm @@ -4,7 +4,7 @@ use strict; use vars qw(@ISA $DEBUG %info); use Date::Format; use FS::Record qw(qsearchs qsearch); -use FS::part_pkg; +use FS::part_pkg::flat; #use FS::rate; use FS::rate_prefix; @@ -13,34 +13,32 @@ use FS::rate_prefix; $DEBUG = 1; %info = ( + 'disabled' => 1, #they're sucked into our CDR table now instead 'name' => 'VoIP rating by plan of CDR records in an SQL RADIUS radacct table', + 'shortname' => 'VoIP/telco CDR rating (external RADIUS)', + 'inherit_fields' => [ 'global_Mixin' ], 'fields' => { - 'setup_fee' => { 'name' => 'Setup fee for this package', - 'default' => 0, - }, - 'recur_flat' => { 'name' => 'Base monthly charge for this package', - 'default' => 0, - }, - 'unused_credit' => { 'name' => 'Credit the customer for the unused portion'. - ' of service at cancellation', - 'type' => 'checkbox', - }, 'ratenum' => { 'name' => 'Rate plan', - 'type' => 'select', - 'select_table' => 'rate', - 'select_key' => 'ratenum', - 'select_label' => 'ratename', + 'type' => 'select-rate', }, }, - 'fieldorder' => [qw( setup_fee recur_flat unused_credit ratenum ignore_unrateable )], + 'fieldorder' => [qw( ratenum ignore_unrateable )], 'weight' => 40, ); +sub price_info { + my $self = shift; + my $str = $self->SUPER::price_info(@_); + $str .= " plus usage" if $str; + $str; +} + sub calc_setup { my($self, $cust_pkg ) = @_; $self->option('setup_fee'); } +#false laziness w/voip_cdr... resolve it if this one ever gets used again sub calc_recur { my($self, $cust_pkg, $sdate, $details ) = @_; @@ -133,7 +131,8 @@ sub calc_recur { # find the price and add detail to the invoice ### - $included_min{$regionnum} = $rate_detail->min_included + $included_min{$regionnum} = + ($rate_detail->min_included * $cust_pkg->quantity || 1) unless exists $included_min{$regionnum}; my $granularity = $rate_detail->sec_granularity; @@ -153,14 +152,15 @@ sub calc_recur { } my $rate_region = $rate_prefix->rate_region; - warn " (rate region $rate_region)" if $DEBUG; + warn " (rate region $rate_region)\n" if $DEBUG; my @call_details = ( - time2str("%Y %b %d - %r", $session->{'acctstarttime'}), - "+$countrycode $dest", - $rate_region->regionname, + #time2str("%Y %b %d - %r", $session->{'acctstarttime'}), + time2str("%c", $session->{'acctstarttime'}), $minutes.'m', '$'.$charge, + "+$countrycode $dest", + $rate_region->regionname, ); warn " adding details on charge to invoice: ". @@ -173,17 +173,17 @@ sub calc_recur { } # $cust_svc - $self->option('recur_flat') + $charges; + $self->option('recur_fee') + $charges; } -sub is_free { - 0; -} +sub can_discount { 0; } + +sub is_free { 0; } sub base_recur { my($self, $cust_pkg) = @_; - $self->option('recur_flat'); + $self->option('recur_fee'); } 1;