X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_pkg%2Fagent_cdr.pm;h=a638b5b5af80697c205d714996262c0b3f5c8a1b;hb=b7cf1606a66cca95e3540f803ffa66d223f23a40;hp=8c97a01e5b4677d94fe7596ad4b41c31a95cd24b;hpb=a0956b1c4c7dc4193312945353b08098106e5b48;p=freeside.git diff --git a/FS/FS/part_pkg/agent_cdr.pm b/FS/FS/part_pkg/agent_cdr.pm index 8c97a01e5..a638b5b5a 100644 --- a/FS/FS/part_pkg/agent_cdr.pm +++ b/FS/FS/part_pkg/agent_cdr.pm @@ -16,9 +16,14 @@ $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.', + 'shortname' => 'Wholesale CDR cost billing for agent', 'inherit_fields' => [ 'prorate_Mixin', 'global_Mixin' ], 'fields' => { #false laziness w/cdr_termination @@ -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 @@ -170,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 @@ -182,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; }