shorter names and rearranged weights for a brighter tommorow^W^Wbetter price plan...
[freeside.git] / FS / FS / part_pkg / voip_cdr.pm
index 09b670e..8720bb6 100644 (file)
@@ -26,7 +26,8 @@ tie my %rating_method, 'Tie::IxHash',
 #;
 
 %info = (
-  'name' => 'VoIP rating by plan of CDR records in an internal (or external?) SQL table',
+  'name' => 'VoIP rating by plan of CDR records in an internal (or external) SQL table',
+  'shortname' => 'VoIP/telco CDR rating (standard)',
   'fields' => {
     'setup_fee'     => { 'name' => 'Setup fee for this package',
                          'default' => 0,
@@ -45,8 +46,8 @@ tie my %rating_method, 'Tie::IxHash',
                      'select_label' => 'ratename',
                    },
     'rating_method' => { 'name' => 'Region rating method',
-                         'type' => 'select',
-                         'select_options' => \%rating_method,
+                         'type' => 'radio',
+                         'options' => \%rating_method,
                        },
 
     'default_prefix' => { 'name'    => 'Default prefix optionally prepended to customer DID numbers when searching for CDR records',
@@ -69,7 +70,7 @@ tie my %rating_method, 'Tie::IxHash',
                                 'default' => '011',
                               },
 
-    #XXX also have option for an external db??
+    #XXX also have option for an external db
 #    'cdr_location' => { 'name' => 'CDR database location'
 #                        'type' => 'select',
 #                        'select_options' => \%cdr_location,
@@ -93,7 +94,7 @@ tie my %rating_method, 'Tie::IxHash',
 #                  },
 
   },
-  'fieldorder' => [qw( setup_fee recur_flat unused_credit ratenum rating_method default_prefix )],
+  'fieldorder' => [qw( setup_fee recur_flat unused_credit ratenum rating_method default_prefix disable_src domestic_prefix international_prefix )],
   'weight' => 40,
 );
 
@@ -207,7 +208,7 @@ sub calc_recur {
         });
 
         #
-        die "Can't find rate for call $to_or_from +$countrycode $\numbern"
+        die "Can't find rate for call $to_or_from +$countrycode $number\n"
           unless $rate_prefix;
   
         $regionnum = $rate_prefix->regionnum;
@@ -278,9 +279,10 @@ sub calc_recur {
             unless exists $included_min{$regionnum};
       
           my $granularity = $rate_detail->sec_granularity;
-          my $seconds = $cdr->billsec; # |ength($cdr->billsec) ? $cdr->billsec : $cdr->duration;
+          my $seconds = $cdr->billsec; # length($cdr->billsec) ? $cdr->billsec : $cdr->duration;
           $seconds += $granularity - ( $seconds % $granularity )
-            if $granularity; # 0 is per call
+            if $seconds      # don't granular-ize 0 billsec calls (bills them)
+            && $granularity; # 0 is per call
           my $minutes = sprintf("%.1f", $seconds / 60);
           $minutes =~ s/\.0$// if $granularity == 60;