in rated CDR packages, multiply included minutes by package quantity, #71003
[freeside.git] / FS / FS / part_pkg / voip_sqlradacct.pm
index 5388767..299d5c1 100644 (file)
@@ -19,16 +19,20 @@ $DEBUG = 1;
   'inherit_fields' => [ 'global_Mixin' ],
   'fields' => {
     'ratenum'   => { 'name' => 'Rate plan',
-                     'type' => 'select',
-                     'select_table' => 'rate',
-                     'select_key'   => 'ratenum',
-                     'select_label' => 'ratename',
+                     'type' => 'select-rate',
                    },
   },
   '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');
@@ -127,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;