fix cancellation errors with updated flat_introrate, RT#5865
[freeside.git] / FS / FS / part_pkg / voip_cdr.pm
index 3006eaa..4f05963 100644 (file)
@@ -82,7 +82,6 @@ tie my %temporalities, 'Tie::IxHash',
                    },
 
     'min_charge' => { 'name' => 'Charge per minute when using "single price per minute" rating method',
-                      'type' => 'text',
                     },
 
     'ignore_unrateable' => { 'name' => 'Ignore calls without a rate in the rate tables.  By default, the system will throw a fatal error upon encountering unrateable calls.',
@@ -476,10 +475,12 @@ sub calc_usage {
         my $minutes = sprintf("%.1f", $seconds / 60);
         $minutes =~ s/\.0$// ;# if $granularity == 60;
 
-        $charge = sprintf('%.2f', ( $self->option('min_charge') * $minutes )
-                                  + 0.00000001 ); #so 1.005 rounds to 1.01
+        # XXX config?
+        #$charge = sprintf('%.2f', ( $self->option('min_charge') * $minutes )
+                                  #+ 0.00000001 ); #so 1.005 rounds to 1.01
+        $charge = sprintf('%.4f', ( $self->option('min_charge') * $minutes )
+                                  + 0.0000000001 ); #so 1.00005 rounds to 1.0001
 
-        $charge =  
         $charges += $charge;
 
         @call_details = ($cdr->downstream_csv( 'format' => $output_format,