$detail->{'sdate'} = $line_item->{'sdate'};
$detail->{'edate'} = $line_item->{'edate'};
+ $detail->{'seconds'} = $line_item->{'seconds'};
push @detail_items, $detail;
push @buf, ( [ $detail->{'description'},
returned from C<_condense_section()>, i.e. C<_condensed_foo_generator>
coderefs to generate parts of the invoice. This is not advised.
-Takes way too many arguments, all mandatory:
+Arguments:
LATE: an arrayref to push the "late" section hashes onto. The "early"
-group is simply returned from the method. Yes, I know. Don't ask.
+group is simply returned from the method.
SUMMARYPAGE: a flag indicating whether this is a summary-format invoice.
Turning this on has the following effects:
- Creates sections for all non-disabled package categories, even if they
have no charges on this invoice, as well as a section with no name.
-ESCAPE: an escape function to use for section titles. Why not just
-let the calling environment escape things itself? Beats the heck out
-of me.
+ESCAPE: an escape function to use for section titles.
EXTRA_SECTIONS: an arrayref of additional sections to return after the
sorted list. If there are any of these, section subtotals exclude
push @d, &{$escape_function}($loc);
}
- }
+ } #unless hiding service details
push @d, $cust_bill_pkg->details(%details_opt)
if $cust_bill_pkg->recur == 0;
|| $cust_pkg->part_pkg->option('disable_line_item_date_ranges',1);
my @d = ();
+ my @seconds = (); # for display of usage info
#at least until cust_bill_pkg has "past" ranges in addition to
#the "future" sdate/edate ones... see #3032
push @d, &{$escape_function}($loc);
}
+ # Display of seconds_since_sqlradacct:
+ # On the invoice, when processing @detail_items, look for a field
+ # named 'seconds'. This will contain total seconds for each
+ # service, in the same order as @ext_description. For services
+ # that don't support this it will show undef.
+ if ( $conf->exists('svc_acct-usage_seconds')
+ and ! $cust_bill_pkg->pkgpart_override ) {
+ foreach my $cust_svc (
+ $cust_pkg->h_cust_svc(@dates, 'I')
+ ) {
+
+ # eval because not having any part_export_usage exports
+ # is a fatal error, last_bill/_date because that's how
+ # sqlradius_hour billing does it
+ my $sec = eval {
+ $cust_svc->seconds_since_sqlradacct($dates[1] || 0, $dates[0]);
+ };
+ push @seconds, $sec;
+ }
+ } #if svc_acct-usage_seconds
+
}
unless ( $is_summary ) {
%item_dates,
ext_description => \@d,
};
+ $r->{'seconds'} = \@seconds if grep {defined $_} @seconds;
}
} else { # $type eq 'U'