import torrus 1.0.9
[freeside.git] / FS / FS / part_pkg / cdr_termination.pm
index 1510337..840da82 100644 (file)
@@ -16,15 +16,8 @@ tie my %temporalities, 'Tie::IxHash',
 %info = (
   'name' => 'VoIP rating of CDR records for termination partners.',
   'shortname' => 'VoIP/telco CDR termination',
+  'inherit_fields' => [ 'global_Mixin' ],
   'fields' => {
-
-    'setup_fee'     => { 'name' => 'Setup fee for this package',
-                         'default' => 0,
-                       },
-    'recur_fee'     => { 'name' => 'Base recurring fee for this package',
-                         'default' => 0,
-                       },
-
     #'cdr_column'    => { 'name' => 'Column from CDR records',
     #                     'type' => 'select',
     #                     'select_enum' => [qw(
@@ -49,15 +42,14 @@ tie my %temporalities, 'Tie::IxHash',
                              'select_options' => \%temporalities,
                            },
 
-    'unused_credit' => { 'name' => 'Credit the customer for the unused portion'.
-                                   ' of service at cancellation',
-                         'type' => 'checkbox',
-                       },
-
     'cutoff_day'    => { 'name' => 'Billing Day (1 - 28) for prorating or '.
                                    'subscription',
                          'default' => '1',
                        },
+    'add_full_period'=> { 'name' => 'When prorating first month, also bill '.
+                                    'for one full period after that',
+                          'type' => 'checkbox',
+                        },
 
     'recur_method'  => { 'name' => 'Recurring fee method',
                          #'type' => 'radio',
@@ -66,7 +58,7 @@ tie my %temporalities, 'Tie::IxHash',
                          'select_options' => \%FS::part_pkg::recur_Common::recur_method,
                        },
 
-    #false laziness w/cdr_termination.pm
+    #false laziness w/voip_cdr.pm
     'output_format' => { 'name' => 'CDR invoice display format',
                          'type' => 'select',
                          'select_options' => { FS::cdr::invoice_formats() },
@@ -80,13 +72,17 @@ tie my %temporalities, 'Tie::IxHash',
                           'type' => 'checkbox',
                         },
 
-  },
+    'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+                          'type' => 'checkbox',
+                       },
+    #eofalse
 
+  },
+                       #cdr_column
   'fieldorder' => [qw(
-                       setup_fee recur_fee
-                       cdr_column
-                       recur_temporality unused_credit recur_method cutoff_day
-                       output_format usage_section summarize_usage
+                       recur_temporality recur_method cutoff_day
+                       add_full_period
+                       output_format usage_section summarize_usage usage_mandate
                      )
                   ],
 
@@ -165,7 +161,9 @@ sub calc_recur {
 
     #add a cdr_termination record and the charges
 
-    my $term_price = sprintf('%.2f', $cdr->rated_price * $term_percent / 100 );
+    # XXX config?
+    #my $term_price = sprintf('%.2f', $cdr->rated_price * $term_percent / 100 );
+    my $term_price = sprintf('%.4f', $cdr->rated_price * $term_percent / 100 );
 
     my $cdr_termination = new FS::cdr_termination {
       'acctid'      => $cdr->acctid,