Wholesale CDR cost re-billing, RT#27555
[freeside.git] / FS / FS / part_pkg / agent_cdr.pm
index 8c97a01..be0f987 100644 (file)
@@ -16,6 +16,11 @@ $DEBUG = 0;
 
 $me = '[FS::part_pkg::agent_cdr]';
 
+tie my %temporalities, 'Tie::IxHash',
+  'upcoming'  => "Upcoming (future)",
+  'preceding' => "Preceding (past)",
+;
+
 %info = (
   'name'      => 'Wholesale CDR cost billing, for master customers of an agent.',
   'shortname' => 'Whilesale CDR cost billing for agent.',
@@ -43,7 +48,7 @@ $me = '[FS::part_pkg::agent_cdr]';
     'output_format' => { 'name' => 'CDR invoice display format',
                          'type' => 'select',
                          'select_options' => { FS::cdr::invoice_formats() },
-                         'default'        => 'simple2', #XXX test
+                         'default'        => 'simple2', #with source
                        },
 
     'usage_section' => { 'name' => 'Section in which to place separate usage charges',
@@ -64,7 +69,7 @@ $me = '[FS::part_pkg::agent_cdr]';
                     FS::part_pkg::prorate_Mixin::fieldorder, 
                     qw(
                        output_format usage_section summarize_usage usage_mandate
-                    )
+                    ),
                   ],
 
   'weight' => 53,
@@ -72,7 +77,7 @@ $me = '[FS::part_pkg::agent_cdr]';
 );
 
 sub calc_recur {
-  my $self, $cust_pkg, $sdate, $details, $param ) = @_;
+  my( $self, $cust_pkg, $sdate, $details, $param ) = @_;
 
   #my $last_bill = $cust_pkg->last_bill;
   my $last_bill = $cust_pkg->get('last_bill'); #->last_bill falls back to setup
@@ -83,6 +88,8 @@ sub calc_recur {
 
   my $charges = 0;
 
+  my $output_format = $self->option('output_format', 'Hush!') || 'simple2';
+
   #CDR calculations
 
   #false laziness w/agent.pm