add skip_dcontext_suffix to skip CDRs with dcontext ending in a definable string...
[freeside.git] / FS / FS / part_pkg / agent_cdr.pm
index fc8436c..a638b5b 100644 (file)
@@ -23,7 +23,7 @@ tie my %temporalities, 'Tie::IxHash',
 
 %info = (
   'name'      => 'Wholesale CDR cost billing, for master customers of an agent.',
-  'shortname' => 'Whilesale CDR cost billing for agent.',
+  'shortname' => 'Wholesale CDR cost billing for agent',
   'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ],
   'fields' => { #false laziness w/cdr_termination
 
@@ -50,13 +50,26 @@ tie my %temporalities, 'Tie::IxHash',
                          'select_options' => { FS::cdr::invoice_formats() },
                          'default'        => 'simple2', #with source
                        },
+
+    'usage_section' => { 'name' => 'Section in which to place separate usage charges',
+                       },
+
+    'summarize_usage' => { 'name' => 'Include usage summary with recurring charges when usage is in separate section',
+                          'type' => 'checkbox',
+                        },
+
+    'usage_mandate' => { 'name' => 'Always put usage details in separate section',
+                          'type' => 'checkbox',
+                       },
     #eofalse
 
   },
 
   'fieldorder' => [ qw( recur_temporality recur_method cutoff_day ),
                     FS::part_pkg::prorate_Mixin::fieldorder, 
-                    qw( output_format ),
+                    qw(
+                       output_format usage_section summarize_usage usage_mandate
+                    ),
                   ],
 
   'weight' => 53,
@@ -164,7 +177,11 @@ sub calc_recur {
         my $classnum = ''; #usage class?
 
        #option to turn off?  or just use squelch_cdr for the customer probably
-        push @$details, [ 'C', $call_details, $cost, $classnum ];
+        # XXX use detail_format for this at some point
+        push @$details, { 'format'    => 'C',
+                          'detail'    => $call_details,
+                          'amount'    => $cost,
+                          'classnum'  => $classnum };
 
         #eofalse laziness w/cdr_termination
 
@@ -176,7 +193,8 @@ sub calc_recur {
 
   #eo CDR calculations
 
-  $charges += ($cust_pkg->quantity || 1) * $self->calc_recur_Common(@_);
+  $charges += ($cust_pkg->quantity || 1)
+                * $self->calc_recur_Common($cust_pkg, $sdate, $details, $param);
 
   $charges;
 }